Re: ligature formation across text chunks

Hi Cameron,

On May 12, 2011, at 7:53 PM, Cameron McCormack wrote:

> The spec says that every x or y value on a <text> element starts a new
> text chunk, and that ligatures do not get formed across text chunk
> boundaries.  However, in http://www.w3.org/TR/SVG/text.html#TSpanElement
> just below the attribute definitions, there is this text:
> 
>  The following additional rules apply to attributes ‘x’, ‘y’, ‘dx’,
>  ‘dy’ and ‘rotate’ when they contain a list of numbers:
>    ...
>    * When multiple XML characters map to a single glyph (e.g., when a
>      ligature is used) - Suppose that the i-th and (i+1)-th XML
>      characters map to a single glyph. In this case, the i-th value for
>      the ‘x’, ‘y’, ‘dx’, ‘dy’ and ‘rotate’ attributes all apply when
>      rendering the glyph. The (i+1)-th values, however, for ‘x’, ‘y’
>      and ‘rotate’ are ignored (exception: the final ‘rotate’ value in
>      the list would still apply to subsequent characters), whereas the
>      ‘dx’ and ‘dy’ are applied to the subsequent XML character (i.e.,
>      the (i+2)-th character), if one exists, by translating the current
>      text position by the given amounts before rendering the first
>      glyph associated with that character.
> 
> You can never have a multiple XML characters mapping to a single glyph
> when you have an x or y value specified for the second or subsequent XML
> characters, because it would cause the ligature not to be formed.
> 
>  <text x="10 20">fi</text>
> 
> Even with a font that would otherwise form a ligature here, the f should
> be painted at x = 10 and the i at x = 20.  I think the text quoted above
> is misleading, then.
> 
> Can someone confirm my reading of the spec?

(disclaimer: I had a bit of a long day, so I may not be processing this clearly enough :-)

If I read the paragraph you quote and apply it to the example:

a. the "f" and "i" characters map to a single 'fi' glyph (assuming the font has a ligature for the "f" + "i" character sequence). So characters at index i = 0 and i+1 = 1 map to a single glyph.
b. for i = 0, we should apply the x value at index 0, i.e., 10.
c. for i=1, we should ignore the value x, y and rotate, i.e., 20 is ignored.

So I would say that the spec. says that in this case, the second x value is ignored. In implementation work I did (ok, that dates back a bit :-), I am pretty sure that is how I interpreted this.

Cheers,
Vincent

Received on Friday, 13 May 2011 03:51:25 UTC