diff --git a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp index 7270237986..88e456a873 100644 --- a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp +++ b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp @@ -1015,17 +1015,19 @@ private: Font getFont (const XmlPath& xml) const { - auto fontSize = getCoordLength (getStyleAttribute (xml, "font-size"), 1.0f); + Font f; + auto family = getStyleAttribute (xml, "font-family").unquoted(); - int style = getStyleAttribute (xml, "font-style").containsIgnoreCase ("italic") ? Font::italic : Font::plain; + if (family.isNotEmpty()) + f.setTypefaceName (family); - if (getStyleAttribute (xml, "font-weight").containsIgnoreCase ("bold")) - style |= Font::bold; + if (getStyleAttribute (xml, "font-style").containsIgnoreCase ("italic")) + f.setItalic (true); - auto family = getStyleAttribute (xml, "font-family").unquoted(); + if (getStyleAttribute (xml, "font-weight").containsIgnoreCase ("bold")) + f.setBold (true); - return family.isEmpty() ? Font (fontSize, style) - : Font (family, fontSize, style); + return f.withPointHeight (getCoordLength (getStyleAttribute (xml, "font-size"), 1.0f)); } //==============================================================================