[CRASH] App crashes on Windows when font is missing

Issue:

My JUCE app crashes on Windows when trying to load a non-existent font. Specifically, when using:

g.setFont(juce::Font(juce::FontOptions("NonExistingFont", 19, 0)));
drawText(g, "Some Text", 0, 0, 100, 100, juce::Justification::top);

It hits an assertion at line 123 in juce_Font.cpp.
Then it crashes instead of falling back to a default font.
Tested with the GUI_APP_EXAMPLE template too.
It’s a big issue as the user may not have all the font installed on his system making the app crashing on some config.

Environment

• OS: Windows 11
• JUCE Version: 8.1 (develop branch)

Many thanks for devs who will check this out !!

1 Like

Thanks, I’m able to reproduce the problem and have a fix on the way. I’ll update this thread once the fix is public.

2 Likes

Thanks again. This fix is now available on the develop branch:

Edit: updated link

2 Likes