[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: svg export -- tricks on font rendering by Firefox



On Sun, Sep 02, 2007 at 07:34:35PM +0200, Thomas Harding wrote:
> Here is the new patch, based on the above sentence.

It seems the global font-size is not handled by Inkscape :(

So, the following patch uses a fixed size in px for every text element
in the svg output.

The changes actually affects only lib/diasvgrenderer.c, I commented out
the code in svg plugin.

I think it is the definitive version.
-- 
Thomas Harding
Index: lib/diasvgrenderer.c
===================================================================
--- lib/diasvgrenderer.c	(révision 3769)
+++ lib/diasvgrenderer.c	(copie de travail)
@@ -723,8 +723,8 @@
   style = (char*)get_fill_style(renderer, colour);
   /* return value must not be freed */
   renderer->linewidth = saved_width;
-  tmp = g_strdup_printf("%s; font-size: %s", style,
-			dia_svg_dtostr(d_buf, text_line_get_height(text_line)));
+  tmp = g_strdup_printf("%s; font-size: %spx", style,
+			dia_svg_dtostr(d_buf, text_line_get_height(text_line)*0.72));
   style = tmp;
   
   tmp = g_strdup_printf("%s; length: %s", style,
Index: plug-ins/svg/render_svg.c
===================================================================
--- plug-ins/svg/render_svg.c	(révision 3769)
+++ plug-ins/svg/render_svg.c	(copie de travail)
@@ -141,6 +141,7 @@
   DiaSvgRenderer *renderer;
   FILE *file;
   gchar buf[512];
+  gchar buf2[512];
   time_t time_now;
   Rectangle *extent;
   const char *name;
@@ -189,6 +190,13 @@
 	     (int)ceil(extent->bottom - extent->top));
   xmlSetProp(renderer->root, (const xmlChar *)"viewBox", (xmlChar *) buf);
   xmlSetProp(renderer->root,(const xmlChar *)"xmlns", (const xmlChar *)"http://www.w3.org/2000/svg";);
+  /*
+   * global font-size definition
+   * here may be planned something to replace 0.72 by a user-defined value
+  g_ascii_formatd(buf2,sizeof(buf2),"%f",0.72);
+  g_snprintf(buf, sizeof(buf),"font-size: %spx",buf2);
+  xmlSetProp(renderer->root,(const xmlChar *)"style", (xmlChar *) buf);
+   */
   
   time_now = time(NULL);
   name = g_get_user_name();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]