W3C home > Mailing lists > Public > www-svg@w3.org > May 2000

Re: tspan -- adobe and ibm viewers have bugs

From: Jon Ferraiolo <jferraio@Adobe.COM>
Date: Wed, 31 May 2000 13:52:29 -0700
Message-Id: <200005312049.NAA07121@mail-345.corp.Adobe.COM>
To: Apu Nahasapeemapetilon <petilon@yahoo.com>
Cc: www-svg@w3.org
Apu,
The reason why the Adobe viewer shows different results between file #1 and
file#2 is the use of xml:space="preserve" at the top of the file.

With this option set, then all white space characters are significant,
including the white space characters (including the newline) between a
<tspan>...</tspan> on one line and a <tspan>...</tspan> on the next line.
Because xml:space="preserve" has been set on the containing 'text' element,
then everything within the 'text' element, including newlines, need to be
part of the layout and rendering.

Consider the following:

<text><tspan x="10" y="20">abc</tspan>def</text>

The correct result is to render "abcdef" starting at (10,20).

Now, if you say:

<text style="text-anchor:middle"><tspan x="10" y="20">abc</tspan>def</text>

then the string "abcdef" will be centerd at (10,20).

Finally, if you say:

<text xml:space="preserve" style="text-anchor:middle">
   <tspan x="10" y="20">abc</tspan>def
</text>

then the string "abcdef\n" will be centered at (10,20), except that the
newline (\n) will be replaced by a space.

My conclusion is that the Adobe viewer is handling this case correctly,
even if the result isn't intuitive.

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated


Message-ID: <20000527184321.10561.qmail@web2303.mail.yahoo.com>
Date: Sat, 27 May 2000 11:43:21 -0700 (PDT)
From: Apu Nahasapeemapetilon <petilon@yahoo.com>
To: www-svg@w3.org
Subject: tspan -- adobe and ibm viewers have bugs?

Take a look at the two simple SVG files below.
The first doesn't use <tspan> but the second does.
Both files ought to produce identical results.

But in the Adobe viewer, if you flip from one file to the
next you can see that the text shifts many pixels to the
left when you use <tspan>.

In order to confirm that this is a bug in the Adobe viewer
I decided to test these files using the IBM viewer. However
IBM completely ignores text-anchor when you use <tspan>.

Can someone confirm that the bug is in the viewers and not
in the SVG files below?

----------------------------------------
file #1
----------------------------------------
<?xml version="1.0" standalone="no"?>
<svg xml:space="preserve" width="167" height="126">
<g transform="matrix(1 0 0 1 83.7 32.05)" 
style="font-family:Arial; font-size:24; text-anchor:middle">
<text x="0" y="0">The quick</text>
<text x="0" y="26">brown fox</text>
<text x="0" y="52">jumps over</text>
<text x="0" y="78">the lazy dog.</text>
</g>
<path style="stroke:#000000;stroke-width:1;fill:none"
d="M9.624 9.364
l148.156 0
0 106.735
-148.156 0
z"/>
</svg>

----------------------------------------
file #2
----------------------------------------
<?xml version="1.0" standalone="no"?>
<svg xml:space="preserve" width="167" height="126">
<g transform="matrix(1 0 0 1 83.7 32.05)" 
style="font-family:Arial; font-size:24; text-anchor:middle">
<text>
<tspan x="0" y="0">The quick</tspan>
<tspan x="0" y="26">brown fox</tspan>
<tspan x="0" y="52">jumps over</tspan>
<tspan x="0" y="78">the lazy dog.</tspan>
</text>
</g>
<path style="stroke:#000000;stroke-width:1;fill:none"
d="M9.624 9.364
l148.156 0
0 106.735
-148.156 0
z"/>
</svg>
Received on Wednesday, 31 May 2000 16:50:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:47 GMT