1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Fonts (Linux): Return a null typeface when no default typefaces can be found

This commit is contained in:
Anthony Nicholls 2024-12-18 15:57:32 +00:00
parent 4d5636c66d
commit 7a1f397de6

View file

@ -143,7 +143,12 @@ private:
if (name.containsIgnoreCase (choice))
return name;
return names[0];
for (auto& name : names)
if (name.isNotEmpty())
return name;
jassertfalse;
return {};
}
static String getDefaultSansSerifFontName()
@ -200,8 +205,11 @@ Typeface::Ptr Font::Native::getDefaultPlatformTypefaceForFont (const Font& font)
const auto name = font.getTypefaceName();
const auto realName = defaultInfo.getRealFontName (name);
f.setTypefaceName (realName);
if (realName.isEmpty())
return nullptr;
f.setTypefaceName (realName);
return Typeface::createSystemTypefaceFor (f);
}