I managed to load it using the Typeface::Ptr in LookAndFeel.h and returning it in getTypefaceForFont().
Now my problem is that my text in AttributedString::draw looks messed up (random letters) when loading the embedded font (plain Font in Label/TextEditor/… and even GlyphArrangement looks good):
When loading the system font, it looks good.
Why is it bad only when using AttributedString::draw?
Thanks.
AttributedStrings are rendered using TextLayout.
TextLayout is unlike all the other text rendering code found in Juce. It allows for the rendering of complex languages like Arabic, Hebrew, Hindi, Thai, etc.
TextLayout uses Operating System APIs on Mac OS X 10.5 (and later) and Windows Vista SP2 PU (and later) for text layout. These APIs only access fonts that are in the operating system font collection.
CustomTypefaces are not apart of the OS font collection so I don’t think you’ll be able to render them properly unless you make modifications in juce_TextLayout.cpp to disable using native OS text APIs.
By making this modification, you are eliminating Complex Text support. You should still be able to render simple text with various fonts and various colors.
Setting JUCE_USE_DIRECTWRITE to 0 will have a similar effect as the modifications above on Windows.