1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

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

This commit is contained in:
jules 2017-05-31 11:55:13 +01:00
parent f212ff5923
commit e281bc3fed

View file

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