Browse Source

Linux Fonts: Replace font style if it does not exist for the requested font

pull/22/head
reuk 3 years ago
parent
commit
3c08f8beda
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      modules/juce_graphics/native/juce_linux_Fonts.cpp

+ 5
- 2
modules/juce_graphics/native/juce_linux_Fonts.cpp View File

@@ -211,10 +211,13 @@ Typeface::Ptr Font::getDefaultTypefaceForFont (const Font& font)
Font f (font); Font f (font);
const auto characteristics = defaultInfo.getRealFontCharacteristics (font.getTypefaceName());
const auto name = font.getTypefaceName();
const auto characteristics = defaultInfo.getRealFontCharacteristics (name);
f.setTypefaceName (characteristics.name); f.setTypefaceName (characteristics.name);
if (font.getTypefaceStyle() == Font::getDefaultStyle())
const auto styles = findAllTypefaceStyles (name);
if (! styles.contains (font.getTypefaceStyle()))
f.setTypefaceStyle (characteristics.style); f.setTypefaceStyle (characteristics.style);
return Typeface::createSystemTypefaceFor (f); return Typeface::createSystemTypefaceFor (f);


Loading…
Cancel
Save