SVG font-family - quoted names


Illustrator quotes the font-family name in SVG files within the style attribute:

<text id="JustText" transform="matrix(1 0 0 1 8.5 23)" style="font-family:'Monaco'; font-size:12px;">Some sliders</text>

This isn’t handled by the SVGState::getFont() function so in this case the text is drawn in the default font rather than Monaco.

Could we just unquote the font name?:

Font getFont (const XmlPath& xml) const
    const float 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;

    String family (getStyleAttribute (xml, "font-family"));

    if (family.isQuotedString())
        family = family.unquoted();
    return family.isEmpty() ? Font (fontSize, style)
                            : Font (family, fontSize, style);



Thanks Martin - yes, sounds like a good idea, I’ll do that!