-
- realesmedia
- Posts: 85
- Joined:
[C++] Custom FontProvider
Described custom FontProvider derived from Noesis::CachedFontProvider with overriden functions:
Using root path "C:\#Arial" shows correct font in application, but "C:\fonts\#Arial" not load font. Both path have arial.ttf file.
Code: Select all
public:
void ScanFolder(const NsChar* folder) override;
Noesis::Ptr<Noesis::Core::Stream> OpenFont(const NsChar* folder, const NsChar* id) const override;
-
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Custom FontProvider
First problem has solved.
Have a new one.
Change provider.
XAML:
First text block have incorrect font.
All are good with second block.
Debug shows RegisterFont() got same params.
Have a new one.
Change provider.
Code: Select all
resourceProvider.fontProvider = new ui::MyFontProvider("c:/xaml");
Code: Select all
<TextBlock text="path Themes\Fonts\#Arial" FontFamily="Themes\Fonts\#Arial"/>
<TextBlock text="path c:\xaml\Themes\Fonts\#Arial" FontFamily="c:\xaml\Themes\Fonts\#Arial"/>
All are good with second block.
Debug shows RegisterFont() got same params.
-
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Custom FontProvider
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.
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.
Re: [C++] Custom FontProvider
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