Hi,
I’m a noob. But digging in the code for Win32. But yes there seems to be a problem there to display fonts that are not already installed on windows
Looking at the windows specific code for BitmapDC there seems to be a few bugs in the code.
I did find a workaround that requires no code chages: Call setFontName on the label like this
Note
The name of the ttf file MUST match the font face inside. So Mark_Felt.ttf that is provided by the examples can’t be loaded and must be renamed to Felt.ttf the name of the font
The code to add the Font Resource from file is incorrectly placed in a block that is only called when removing a previously loaded font: see BitmapDC::setFont in platform/win32/CCImage.cpp:160
The font-face to load in the call CreateFontIndirectA is generated from the file name (taking the file name without the extension) however TTF files contain the font-face name in the definition. That means that if the font-face is not the same as the file name the operation will fail.
An example it the Marker Felt.ttf provided as an example. The font-face in the TTf file is Felt so it will not load correctly without renaming.
Additional Issues:
Windows errors are not reported. For instance if AddFontResource fails to load the ttf file the error is not reported anywhere
The windows documentation says that the WM_FONTCHANGE should be sent with HWND_BROADCAST to inform all windows of the new font however the SendMessage is called with to a single specific window
The current design has additional Fonts generated for every Label instead of loaded once to the application and then reused.