mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Fall back to default sans serif font if resolution would fail otherwise
This restores the JUCE 7 behaviour when the JUCE 8 font fallback mechanism fails to resolve a non-null Typeface::Ptr. This behaviour is significant when the base font specified is not available on the system.
This commit is contained in:
parent
ba61c9edb9
commit
d73b1768a7
1 changed files with 12 additions and 2 deletions
|
|
@ -836,9 +836,19 @@ Font Font::findSuitableFontForText (const String& text, const String& language)
|
|||
return copy;
|
||||
}
|
||||
|
||||
if (auto current = getTypefacePtr())
|
||||
const auto fallbackTypefacePtr = std::invoke ([&]
|
||||
{
|
||||
if (auto suggested = current->createSystemFallback (text, language))
|
||||
if (auto current = getTypefacePtr())
|
||||
return current;
|
||||
|
||||
auto copy = *this;
|
||||
copy.setTypefaceName (Font::getDefaultSansSerifFontName());
|
||||
return copy.getTypefacePtr();
|
||||
});
|
||||
|
||||
if (fallbackTypefacePtr != nullptr)
|
||||
{
|
||||
if (auto suggested = fallbackTypefacePtr->createSystemFallback (text, language))
|
||||
{
|
||||
auto copy = *this;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue