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:
parent
f212ff5923
commit
e281bc3fed
1 changed files with 11 additions and 9 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue