From 4828bd886d37eaf684f26302e312f3a19eb58cf8 Mon Sep 17 00:00:00 2001 From: attila Date: Thu, 13 Jun 2024 17:37:08 +0200 Subject: [PATCH] Fix assertion during Font fallback Since 412242774820c162be14124bc525704df446c690 assertions are guarding the FontOptions::withName, withStyle and withTypeface member functions. Since then the only way to replace an existing typeface without hitting these assertions is to clear all three fields before calling withTypeface, which then sets all three values. It is always legal to just clear an existing Typeface and rely on the name and style fields. --- modules/juce_graphics/fonts/juce_Font.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/juce_graphics/fonts/juce_Font.cpp b/modules/juce_graphics/fonts/juce_Font.cpp index 77436ac122..bd74814ba0 100644 --- a/modules/juce_graphics/fonts/juce_Font.cpp +++ b/modules/juce_graphics/fonts/juce_Font.cpp @@ -275,6 +275,9 @@ public: jassert (getReferenceCount() == 1); typeface = newTypeface; + if (typeface != nullptr) + options = options.withTypeface (nullptr).withName ("").withStyle (""); + options = options.withTypeface (typeface); }