[BUG] Font style not applied on Android in JUCE 8

Hi JUCE team,

I am currently migrating one of my Android applications from JUCE 7 to JUCE 8 and have encountered an issue where font styles are not being applied correctly on Android.

Steps to reproduce

  1. Create a new blank GUI project using the Projucer

  2. Add both Xcode (iOS) and Android exporters

  3. In MainComponent.cpp, set the font as follows:

    g.setFont(juce::FontOptions().withPointHeight(16.0f).withStyle("Bold"));
    
  4. Run the project on both iOS and Android devices

Expected behaviour

The text should render in bold on both platforms.

Actual behaviour

The bold style is applied correctly on iOS, but has no effect on Android.

Environments

  • JUCE version: 8.0.12

  • iOS: iOS 26

  • Android: Android 16, Android 11 (issue reproduced on both)

Unless I am missing something, this does seem like a regression bug introduced in JUCE 8. Could you please take a look?

You can also reproduce this on emulators (iOS on the left and Android on the right)

Here is another example with the “Italic” style.

Just following up in case this got buried. We rely heavily on font styling in our UI, and this is currently blocking our migration to JUCE 8 on Android.

Any guidance would be greatly appreciated. Happy to provide more details or help test potential fixes if needed.

My workaround has been to not rely on system fonts or on JUCE to apply styles such as bold or italic. Instead I bundle my own typefaces as binary data, for example RobotoRegular, RobotoBold, RobotoItalic, etc. and have my own functions to select them. It’s not ideal but this makes sure that Android or iOS updtates can’t cause unexpected changes.

2 Likes

Thanks for the tip. I might have to do something similar if there is not an official fix.

I think what’s going on is that newer Android versions may supply a single font with multiple variable axes to specify weight/italics/spacing, whereas older Android versions were more likely to supply multiple typeface files, one for each distinct style. At the moment, JUCE doesn’t provide an API to modify settings of variable fonts, so the best workaround for the time being is to bundle your own typefaces, as mentioned above. We’re planning to add support for variable fonts in the next major version of JUCE.

1 Like

We’ve pushed a partial fix, which will improve built-in typeface selection for older devices that use non-variable fonts (single-file-per-style).

As I mentioned above, we’re planning to add variable font support in the next major version of JUCE, so the “full” fix will be included in that work.

2 Likes