Calling setBold, setItalic, etc. on a font cause iOS to revert to the default system font

A snippet of code speaks more than a thousand words…

// Get a Label
auto *lbl = new Label("myLabel", "This text will be displayed with a beatiful font");

// Choose a font name
String FontFace = "myBeautifulFont.ttf";

Font lblFont;

int ff_size(0);
auto ff_data = BinaryData::getNamedResource(FontFace.replace(".", "_").replace("-", "").toRawUTF8(), ff_size);
if (ff_size > 0) 
	lblFont = Font(Typeface::createSystemTypefaceFor(ff_data, ff_size));

// Set font height... this will however look bigger on iOS! (but that's a different matter)
lblFont.setHeight(juce::jmax<float>(8.f, (float)Parameter_Height - 4.f));

// Set some style options...
String Style = "Bold Italic";

// Don't set if not necessary! Setting these will revert to the default system font on iOS (Juce bug?!)


And yes… on a side note, all fonts look bigger on iOS.

As far as I know, a ttf file only contains a single font. Different variants of the font (bold, italic etc.) are contained in separate ttf files (or they can all be wrapped into a collection, “.ttc”).

The system is probably failing to find a font with the style that you request, and falling back to the default style.

Note that the FontsDemo from the JUCE repo does support bold/italic correctly on iOS, so it’s definitely possible to get different font styles to work.

The system is actually falling back to the default font, not only to the default style.
I have tried with many fonts and I can indeed obtain bolds, italics and other styles as long as these can be found. But once I have loaded a TTF, if only I call font.setBold(false) the font reverts to the default system font.