You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Christian Convey <ch...@gmail.com> on 2010/12/28 00:20:49 UTC

Firefox vs. Chromium fidelity for SVG?

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.

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
>

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


Re: Firefox vs. Chromium fidelity for SVG?

Posted by Christian Convey <ch...@gmail.com>.
s/specifiny/specifying/

On Mon, Dec 27, 2010 at 7:55 PM, Christian Convey
<ch...@gmail.com> wrote:
> Thanks, adding "px" seems to have fixed it.  Does this mean Batik is
> at fault for not specifiny "px" in the SVG file it produced?  Or is
> that something I'm supposed to tell Batik to do?
>
> On Mon, Dec 27, 2010 at 7:47 PM, G. Wade Johnson <gw...@anomaly.org> wrote:
>> On Mon, 27 Dec 2010 18:20:49 -0500
>> Christian Convey <ch...@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
>>
>>
>

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


Re: Firefox vs. Chromium fidelity for SVG?

Posted by "G. Wade Johnson" <gw...@anomaly.org>.
On Mon, 27 Dec 2010 19:55:16 -0500
Christian Convey <ch...@gmail.com> wrote:

> Thanks, adding "px" seems to have fixed it.  Does this mean Batik is
> at fault for not specifiny "px" in the SVG file it produced?  Or is
> that something I'm supposed to tell Batik to do?

I guess it depends on how the style attribute on the svg element was
specified.

> On Mon, Dec 27, 2010 at 7:47 PM, G. Wade Johnson <gw...@anomaly.org>
> wrote:
> > On Mon, 27 Dec 2010 18:20:49 -0500
> > Christian Convey <ch...@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
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
> 


-- 
Any intelligent fool can make things bigger, more complex, and more
violent. It takes a touch of genius, and a lot of courage, to move in
the opposite direction.                               -- Albert Einstein

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


Re: Firefox vs. Chromium fidelity for SVG?

Posted by Christian Convey <ch...@gmail.com>.
Thanks, adding "px" seems to have fixed it.  Does this mean Batik is
at fault for not specifiny "px" in the SVG file it produced?  Or is
that something I'm supposed to tell Batik to do?

On Mon, Dec 27, 2010 at 7:47 PM, G. Wade Johnson <gw...@anomaly.org> wrote:
> On Mon, 27 Dec 2010 18:20:49 -0500
> Christian Convey <ch...@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
>
>

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


Re: Firefox vs. Chromium fidelity for SVG?

Posted by "G. Wade Johnson" <gw...@anomaly.org>.
On Mon, 27 Dec 2010 18:20:49 -0500
Christian Convey <ch...@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