Re: text-anchor and transform

 At 09:43 AM 5/18/00 +0200, Thierry Kormann wrote:
>Hi,
>
>I need clarifications about the text-anchor and transform.
>The spec says :
>
>"This property, which applies only to 'text' elements and is 
>ignored for elements 'tspan', 'tref' and 'textPath', describes how 
>the characters within a 'text' element are aligned relative to the 
>initial current text position for the 'text' element."

There is likely to be a slight modification to the rules for 'text-anchor'
so that each time there is an absolute jump in the current text position,
'text-anchor' gets reapplied. For example, it would get reapplied with each
new 'textPath'.

>
>The question is : What's the initial text position ? 

For start-aligned, left-to-right text, the initial text position is
established by the 'x' and 'y' attributes on the 'text' element. For
middle- and end-aligned left-to-right text, you have to shift the initial
text position sufficiently so that 'text-anchor' achieves the correct
result. For right-to-left text, and for vertical text, things are a bit
more complicated.

[Looking at the spec, I can see how someone might be confused. The
terminology in the spec works fine so long as you have 'text-anchor:start',
but the write-up has bugs for the other values of 'text-anchor'. Looks like
we have some cleanup to do.]

>I mean, 
>does the text-anchor should be applied before or after the 
>transform attribute ?

The 'transform' attribute changes the current user coordinate system first.
Then, you use the 'x' and 'y' attributes to figure out a reference position
within this new user coordinate system. Then you set the initial text
position as an offset from the reference position such that 'text-anchor'
causes the correct effect.

Actually, there are lots of complexities here which you probably haven't
encountered yet, such as text-on-a-path, bidirectional text, and vertical
text. Text is always the hardest part of any graphics implementation,
particularly when you go beyond European languages.

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated


>
>Thierry.
>
>-- 
>Thierry Kormann
>email: Thierry.Kormann@sophia.inria.fr  http://www.inria.fr/koala/tkormann/
>Koala/Dyade/Bull @ INRIA - Sophia Antipolis
> 

Received on Thursday, 18 May 2000 22:13:30 UTC