xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G. Wade Johnson" <gwa...@anomaly.org>
Subject Re: Firefox vs. Chromium fidelity for SVG?
Date Tue, 28 Dec 2010 00:47:48 GMT
On Mon, 27 Dec 2010 18:20:49 -0500
Christian Convey <christian.convey@gmail.com> wrote:

> Hi guys,
> I'm new to SVG and Batik, so I was wondering if a problem I'm having
> is to be expected.
> I'm writing a Batik-based program creates boxes with text inside them.
>  On Chromium version, "8.0.552.224 (68599) Ubuntu 10.10" everything
> looks great.
> But on Firefox 3.6.13, the box isn't always wide enough to contain my
> text.  The degree of goofiness changes as I tell Firefox to zoom
> in/out.

Firefox is actually picky where lengths (including font size) are
concerned. If you don't provide a unit, many SVG viewing tools assume
pixels, Firefox discards the value as invalid.

Try making the font size "12px" instead of "12" and see if it helps.

G. Wade

> Is this to be expected?
> (Note:  I'm not just crossing my fingers and hoping for correct
> sizing.  I'm using font metrics in my Java code to size the box
> appropriately to the particular text.)
> In case it's useful, here's an example:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
>           'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
> <svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1;
> color-rendering:auto; color-interpolation:auto; stroke:black;
> text-rendering:auto; stroke-linecap:square; stroke-miterlimit:10;
> stroke-opacity:1; shape-rendering:auto; fill:black;
> stroke-dasharray:none; font-weight:normal; stroke-width:1;
> font-family:&apos;Dialog&apos;; font-style:normal;
> stroke-linejoin:miter; font-size:12; stroke-dashoffset:0;
> image-rendering:auto;" xmlns="http://www.w3.org/2000/svg"
> ><!--Generated by the Batik Graphics2D SVG Generator--><defs
> >id="genericDefs"
>   /><g
>   ><g style="font-family:monospace; font-size:10;"
>     ><rect x="0" y="0" width="86.2256" style="fill:none;" rx="2.5"
> ry="2.5" height="64.9219"
>       /><text x="10" xml:space="preserve" y="21.6406"
> style="stroke:none;"
>       >AAddH</text
>       ><text x="10" xml:space="preserve" y="38.2812"
>       >style="stroke:none;" 123</text
>       ><text x="10" xml:space="preserve" y="54.9219"
>       >style="stroke:none;" Foo.if1(42)</text
>     ></g
>   ></g
> ></svg

We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the works of Shakespeare. Now, thanks to the
Internet, we know this is not true.          -- Robert Wilensky, UCB

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message