Commit 9c718ff7 authored by Menner's avatar Menner Committed by Federico Mena Quintero

bgo#739329 - Remove single quotes around font-family names before passing them to Pango

If you have an SVG with

  <text style="font-family: 'New Century Schoolbook';"> ... </text>

our CSS-parsing code simply passes the singly-quoted string to Pango.  In turn,
Pango doesn't like the quotes because they are not part of the font's name.

This is a simple patch to remove single quotes from *all* style attributes, not
just strings (which is where the CSS spec allows them).  We need a real CSS
parser, not something built out of g_strsplit().
parent fdd27597
......@@ -970,12 +970,28 @@ rsvg_parse_style (RsvgHandle * ctx, RsvgState * state, const char *str)
if (g_strv_length (values) == 2) {
gboolean important;
gchar *style_value = NULL;
if (parse_style_value (values[1], &style_value, &important))
gchar *first_value = values[0];
gchar *second_value = values[1];
gchar **split_list;
/* Just remove single quotes in a trivial way. No handling for any
* special character inside the quotes is done. This relates
* especially to font-family names but cases with special characters
* are rare.
*
* We need a real CSS parser, sigh.
*/
split_list = g_strsplit (second_value, "'", -1);
second_value = g_strjoinv(NULL, split_list);
g_strfreev(split_list);
if (parse_style_value (second_value, &style_value, &important))
rsvg_parse_style_pair (ctx, state,
g_strstrip (values[0]),
g_strstrip (first_value),
style_value,
important);
g_free (style_value);
g_free (second_value);
}
g_strfreev (values);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment