Re: ligature formation across text chunks

On May 12, 2011, at 8:56 PM, Cameron McCormack wrote:

> Vincent Hardy:
>> (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.
> 
> I neglected to quote from the spec about text chunks:
> 
>  An absolute position adjustment occurs in the following circumstances:
>    * At the start of a ‘text’ element
>    * At the start of each ‘textPath’ element
>    * For each character within a ‘text’, ‘tspan’, ‘tref’ and ‘altGlyph’
>      element which has an ‘x’ or ‘y’ attribute value assigned to it
>      explicitly
>  ...
>  Each absolute position adjustment defines a new text chunk. Absolute
>  position adjustments impact text layout in the following ways:
>    * Ligatures only occur when a set of characters which might map to a
>      ligature are all in the same text chunk.
> 
> So my thought is that the ligature can never be formed in the first
> place, because the two characters are in different text chunks.

Yes, I see. I think what I did at the time was (again, I may be off):

1. break  first along the element boundaries (i.e., text and tspan) (this was for SVG tiny, so I did not have tref). This produces text chunks.
2. do glyph matching
3. position the glyphs according to their x/y/dx/dy values and/or glyph advances. This follows the rules you quoted before on x/y/dx/dy/rotate processing.

I think you are right: this is not what the letter of the spec. says. But I think this is what it meant (i.e., do glyph matching on character chunks) because otherwise, there would be no way to combine character positioning and ligatures, as you said. And if it works as I describe, you can still forbid a ligature if needed:

<text><tspan>f</tspan>i</text>

Vincent.

Received on Friday, 13 May 2011 04:26:39 UTC