From e281bc3fed33b9cbafff7c00cadbdeb4ff613b68 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 31 May 2017 11:55:13 +0100 Subject: [PATCH] SVG parser: changed font heights to work in points rather than pixels, to match behaviour of other parsers --- .../juce_gui_basics/drawables/juce_SVGParser.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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)); } //==============================================================================