From: ellson Date: Sat, 4 Mar 2006 02:36:40 +0000 (+0000) Subject: I hate this! I need a factor of 72/100 to get the font size right in SVG and i don... X-Git-Tag: LAST_LIBGRAPH~32^2~6761 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0bac6e8927fa4d03723148016534f88e7b1bf7c0;p=graphviz I hate this! I need a factor of 72/100 to get the font size right in SVG and i don't knw why!!! --- diff --git a/lib/common/svggen.c b/lib/common/svggen.c index 5a0c6444a..2a4e0c07e 100644 --- a/lib/common/svggen.c +++ b/lib/common/svggen.c @@ -117,6 +117,8 @@ static double Scale; static pointf CompScale; static pointf Offset; +#define FUDGE 0.72 + static point Viewport; static node_t *Curnode; @@ -308,15 +310,14 @@ static void svg_font(context_t * cp) { char *color, buf[BUFSIZ]; int needstyle = 0; - double fontsz = cp->fontsz * Scale; strcpy(buf, " style=\""); if (strcasecmp(cp->fontfam, DEFAULT_FONTNAME)) { sprintf(buf + strlen(buf), "font-family:%s;", cp->fontfam); needstyle++; } - if (fontsz != DEFAULT_FONTSIZE) { - sprintf(buf + strlen(buf), "font-size:%.2fpt;", fontsz); + if (cp->fontsz != DEFAULT_FONTSIZE) { + sprintf(buf + strlen(buf), "font-size:%.2fpt;", cp->fontsz * Scale * FUDGE); needstyle++; } color = svg_resolve_color(cp->pencolor, 1); @@ -489,13 +490,13 @@ static void svg_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb) svg_fputs("\n", N_pages); - if (ROUND(gvc->job->dpi.x) == POINTS_PER_INCH && ROUND(gvc->job->dpi.y) == POINTS_PER_INCH) + if (ROUND(gvc->job->dpi.x) == POINTS_PER_INCH && ROUND(gvc->job->dpi.y) == POINTS_PER_INCH) svg_printf("job->dpi.x * Viewport.x / POINTS_PER_INCH), - ROUND(gvc->job->dpi.y * Viewport.y / POINTS_PER_INCH)); + ROUND(gvc->job->dpi.x * Viewport.x / POINTS_PER_INCH), + ROUND(gvc->job->dpi.y * Viewport.y / POINTS_PER_INCH)); /* establish absolute units in points */ svg_printf(" viewBox = \"%d %d %d %d\"\n", 0, 0, Viewport.x, Viewport.y); /* namespace of svg */ @@ -529,17 +530,18 @@ svg_begin_page(graph_t * g, point page, double scale, int rot, Rot = rot; Scale = scale; +#if 0 +fprintf(stderr,"Scale=%g CompScale=%g,%f\n", Scale, CompScale.x, CompScale.y); +fprintf(stderr,"font-size=%g Scale=%g\n", cstk[0].fontsz, Scale); +#endif + /* its really just a page of the graph, but its still a graph, * and it is the entire graph if we're not currently paging */ svg_printf("\n", cstk[0].fontsz); + svg_printf(";font-size:%.2fpt;\">\n", cstk[0].fontsz * Scale * FUDGE); svg_fputs(""); svg_fputs(xml_namestring(g->name)); svg_fputs("\n");