realesmedia
Topic Author
Posts: 85
Joined: 18 May 2016, 10:26

[C++] Custom FontProvider

26 Apr 2017, 10:24

Described custom FontProvider derived from Noesis::CachedFontProvider with overriden functions:
public:
	void ScanFolder(const NsChar* folder) override;
	Noesis::Ptr<Noesis::Core::Stream> OpenFont(const NsChar* folder, const NsChar* id) const  override;
Using root path "C:\#Arial" shows correct font in application, but "C:\fonts\#Arial" not load font. Both path have arial.ttf file.
 
realesmedia
Topic Author
Posts: 85
Joined: 18 May 2016, 10:26

Re: [C++] Custom FontProvider

26 Apr 2017, 15:51

First problem has solved.

Have a new one.
Change provider.
resourceProvider.fontProvider = new ui::MyFontProvider("c:/xaml");
XAML:
<TextBlock text="path Themes\Fonts\#Arial" FontFamily="Themes\Fonts\#Arial"/>
<TextBlock text="path c:\xaml\Themes\Fonts\#Arial" FontFamily="c:\xaml\Themes\Fonts\#Arial"/>
First text block have incorrect font.
All are good with second block.
Debug shows RegisterFont() got same params.
 
realesmedia
Topic Author
Posts: 85
Joined: 18 May 2016, 10:26

Re: [C++] Custom FontProvider

26 Apr 2017, 16:32

1. XAML have absolute font path. RegisterFont() get absolute font path. Works good.
2. XAML have relative font path. RegisterFont() get absolute font path. Doesn't work.
So, my opinion that MatchFont from parent class somehow saves info about baseUri and try to register with relative path instead of using my absolute path from RegisterFont() param.
Can you provide me sample implementation of MatchFont()? I can't call parent function because it's private.
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: [C++] Custom FontProvider

28 Apr 2017, 22:29

Could you please paste here the full implementation of your font provider?

Who is online

Users browsing this forum: No registered users and 1 guest