[HarfBuzz] Skipping Control for Attaching Marks using OpenType

Behdad Esfahbod behdad at behdad.org
Thu Jun 13 14:17:49 PDT 2013

On 13-06-09 07:36 AM, Richard Wordingham wrote:
> I have fallen foul of another gotcha - the requirement that the
> sequence indices for each context in a (chained) context lookup be in
> strictly monotonic increasing order. Is there a list of restrictions not
> mentioned in the Microsoft definitions of the lookups
> (http://www.microsoft.com/typography/otspec/gsub.htm and linked pages),
> or does one have to read through hb-ot-layout-g*.hh?

Right.  That's a limitation of HarfBuzz.  In
hb-ot-layout-gsubgpos-private.hh:apply_lookup() you can find:

  /* TODO We don't support lookupRecord arrays that are not increasing:
   *      Should be easy for in_place ones at least. */

I'm interested to know whether Uniscribe implements them fully.

> Is the definition of the sequence index in SubstLookupRecord in
> http://www.microsoft.com/typography/otspec/gsub.htm#CS wrong?  In one
> of my experiments, I have a chained context substitution (with
> empty lookahead and back track sequences) applying to the sequence
> mai_kang_lai mai_ke low_kha
> I apply a ligature at sequence index 0 replacing <mai_kang_lai,
> mai_ke> by <mai_ke>, and I then attempt to apply a 'multiple
> substitution' to low_kha.  According to the Microsoft documentation, I
> should use sequence index 1, because the input sequence will have been
> transformed to <mai_ke, low_kha> by the time I come to apply it.
> However, to make it work with HarfBuzz Version 0.9.14 or 0.9.18 (other
> versions not tested), I have to use sequence index 2.

Looks to me like a HarfBuzz bug.  Can you send me a test font and test
sequence?  Can you test the attached patch?

Jonathan, can you review the patch please?

> If the Microsoft specification is not wrong, I have a work around in
> this case.  Instead of the ligature at index 0, I do a single
> substitution 'mai_kang_lai > condemned', and then apply the ligature
> 'condemned mai_ke' > mai_ke in the next lookup in the feature.  I used
> the same trick to get round the HarfBuzz requirement that sequence
> indices be in ascending order.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CONTEXTUAL.patch
Type: text/x-patch
Size: 1196 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20130613/36a69412/attachment.bin>

More information about the HarfBuzz mailing list