Hi, I’m trying to embed a custom typeface. I have the ttf file, turned it into a binary resource and am using the following call to load it:
auto p_typeface = Typeface::createSystemTypefaceFor( BinaryData::NunitoRegular_ttf, BinaryData::NunitoRegular_ttfSize );
This seems to work and I get a valid ptr and all looks good, but if I then make a call to Font::findAllTypefaceNames() it doesn’t appear. Are there any other steps I need to perform?
I don’t know for sure but I’d guess Font::findAllTypefaceNames() returns a list of typefaces on the system (on windows Control Panel > Appearance and Personalization > Fonts) but not any that are currently held in memory.
findAllTypefaceNames() returns a StringArray so you’d have to add any extra ones manually:
auto tfs = Font::findAllTypefaceNames();
auto myFont = Font(Typeface::createSystemTypefaceFor(...));
tfs.add(myFont.getTypefaceName());
// might also want to sort after for UX:
tfs.sort(true);