May 28 2017
I want to be able to load a font from a file so I can use downloaded fonts and include custom fonts as resources in programs.
IDWriteFactory::CreateTextFormat() takes an IDWriteFontCollection as the source for the font, which is set to 0 to use the default system collection. To load a font, I need to create my own font collection using IDWriteFactory::CreateCustomFontCollection(). This is a fairly involved process that includes registering a custom font collection interface and a font file loader interface.
I found a StackOverflow topic with some sample code. I also tried to install the Windows SDK.
Online MSDN article.
Creating a custom font collection: