[dia/dia-0-97] Bug 665648 - SVG contains invalid CSS, font-size issue with Firefox
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-0-97] Bug 665648 - SVG contains invalid CSS, font-size issue with Firefox
- Date: Sat, 17 Dec 2011 14:05:27 +0000 (UTC)
commit 80d8d5ec9e9668ea3fbb979fdcf3bf1d7cee57ac
Author: Hans Breuer <hans breuer org>
Date: Sat Dec 17 15:04:35 2011 +0100
Bug 665648 - SVG contains invalid CSS, font-size issue with Firefox
Thanks to https://bugzilla.mozilla.org/show_bug.cgi?id=707071#c4
there now is an acceptable solution for the long-time font-size
problem with Firefox - just moving the font-size out of the style
attribute into it's own attribute allows to keep it w/o unit.
lib/diasvgrenderer.c | 7 +++++++
plug-ins/svg/render_svg.c | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/lib/diasvgrenderer.c b/lib/diasvgrenderer.c
index 94fd431..4dc0695 100644
--- a/lib/diasvgrenderer.c
+++ b/lib/diasvgrenderer.c
@@ -680,9 +680,11 @@ draw_text_line(DiaRenderer *self, TextLine *text_line,
style = (char*)get_fill_style(renderer, colour);
/* return value must not be freed */
renderer->linewidth = saved_width;
+#if 0 /* would need a unit: https://bugzilla.mozilla.org/show_bug.cgi?id=707071#c4 */
tmp = g_strdup_printf("%s; font-size: %s", style,
dia_svg_dtostr(d_buf, text_line_get_height(text_line)));
style = tmp;
+#endif
/* This is going to break for non-LTR texts, as SVG thinks 'start' is
* 'right' for those. */
switch (alignment) {
@@ -717,6 +719,11 @@ draw_text_line(DiaRenderer *self, TextLine *text_line,
xmlSetProp(node, (const xmlChar *)"x", (xmlChar *) d_buf);
dia_svg_dtostr(d_buf, pos->y);
xmlSetProp(node, (const xmlChar *)"y", (xmlChar *) d_buf);
+
+ /* font-size as single attribute can work like the other length w/o unit */
+ dia_svg_dtostr(d_buf, text_line_get_height(text_line));
+ xmlSetProp(node, (const xmlChar *)"font-size", (xmlChar *) d_buf);
+
dia_svg_dtostr(d_buf, text_line_get_width(text_line));
xmlSetProp(node, (const xmlChar*)"textLength", (xmlChar *) d_buf);
}
diff --git a/plug-ins/svg/render_svg.c b/plug-ins/svg/render_svg.c
index 31602fa..8d5f143 100644
--- a/plug-ins/svg/render_svg.c
+++ b/plug-ins/svg/render_svg.c
@@ -401,10 +401,16 @@ node_set_text_style (xmlNodePtr node,
style = g_strconcat(style, ";text-anchor:end", NULL);
break;
}
+#if 0 /* would need a unit according to https://bugzilla.mozilla.org/show_bug.cgi?id=707071#c4 */
tmp = g_strdup_printf("%s;font-size:%s", style,
dia_svg_dtostr(d_buf, font_size) );
g_free (style);
style = tmp;
+#else
+ /* font-size as attribute can work like the other length w/o unit */
+ dia_svg_dtostr(d_buf, font_size);
+ xmlSetProp(node, (const xmlChar *)"font-size", (xmlChar *) d_buf);
+#endif
if (font) {
tmp = g_strdup_printf("%s;font-family:%s;font-style:%s;"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]