im using DirectN in my project, everything else works fine, i can use DWriteFunctions class to create a factory, except i can't find a class to access IDWriteLocalFontFileLoader interface to use the method inside. i googled a lot but i just don't know how to do that
Asked
Active
Viewed 59 times
0
-
IDWriteFactory::CreateFontFileReference(localpath, ...) will get you a IDWriteFontFile, and from this you can call IDWriteFontFile::GetLoader that you should be able to cast into a IDWriteLocalFontFileLoader since it was loaded with a local font file (if the file pointed by the path exists). – Simon Mourier Sep 01 '21 at 15:25
-
Microsoft has a code sample that illustrates an implementation for your scenario: https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/DirectWriteCustomFontSets – Peter Constable Sep 24 '21 at 16:00
1 Answers
0
You need to do this:
- get an IDWriteFactory using DWriteCreateFactory function .
- call IDWriteFactory::CreateFontFileReference with a font localpath
CreateFontFileReference(localpath, ...)
. This will get you a IDWriteFontFile reference. - call IDWriteFontFile::GetLoader this will get you a IDWriteFontFileLoader reference.
- cast that reference into a IDWriteLocalFontFileLoader. It should world since it was loaded from a local font file. The file pointed by the path must exists.

Simon Mourier
- 132,049
- 21
- 248
- 298