Browse Source

SVG parser: changed font heights to work in points rather than pixels, to match behaviour of other parsers

tags/2021-05-28
jules 8 years ago
parent
commit
e281bc3fed
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      modules/juce_gui_basics/drawables/juce_SVGParser.cpp

+ 9
- 7
modules/juce_gui_basics/drawables/juce_SVGParser.cpp View File

@@ -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));
}
//==============================================================================


Loading…
Cancel
Save