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 --- .../drawables/juce_SVGParser.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 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); - - int style = getStyleAttribute (xml, "font-style").containsIgnoreCase ("italic") ? Font::italic : Font::plain; - - if (getStyleAttribute (xml, "font-weight").containsIgnoreCase ("bold")) - style |= Font::bold; - + Font f; auto family = getStyleAttribute (xml, "font-family").unquoted(); - return family.isEmpty() ? Font (fontSize, style) - : Font (family, fontSize, style); + if (family.isNotEmpty()) + f.setTypefaceName (family); + + if (getStyleAttribute (xml, "font-style").containsIgnoreCase ("italic")) + f.setItalic (true); + + if (getStyleAttribute (xml, "font-weight").containsIgnoreCase ("bold")) + f.setBold (true); + + return f.withPointHeight (getCoordLength (getStyleAttribute (xml, "font-size"), 1.0f)); } //==============================================================================