[HarfBuzz] HB_CLOSURE_MAX_STAGES

Richard Wordingham richard.wordingham at ntlworld.com
Thu Jul 26 19:29:29 UTC 2018


On Thu, 26 Jul 2018 16:39:49 +0200
Petr Kobalíček <kobalicek.petr at gmail.com> wrote:

> I initially thought that this was to prevent an infinite recursion of
> contextual lookups.

That trap was implemented many months ago.

> To write a bit more about it. I thought that contextual lookup has
> basically 3 parts:
> 
>   - backtrack sequence
>   - input sequence
>   - lookahead sequence
> 
> I would imagine that "input" sequence would be pretty short, like one
> character most of the time, and the lookup applied if we have a match
> would only consist of "input sequence". So the question is, does it
> make sense to apply another contextual lookup to just the isolated
> "input sequence" in case we had a match?

Most may be short, but some are long.  When I eliminate spurious
dotted circles introduced by the Microsoft implementation of the USE,
I need to handle input sequences of at least 6 glyphs.  (I handle
sequences of 8 to be on the safe side.)

I can conceive of cases where it would be convenient for a context
lookup to invoke a context lookup.  Consider doing simple Indic
rearrangement - layout engine support is not available for
transliteration fonts or cleaning up Tai Tham after the USE.
Simplifying, one could have the lookup sequence:

lookup_A (context lookup, one pattern):

consonant preposed_vowel

0 lookup_B

1 lookup_C



lookup_B: (context lookup with 5 patterns)

| consonant | mai_ke

0 lookup_D

1 lookup_C

| consonant | mai_kae

0 lookup_F

1 lookup_C

| consonant | mai_ko

0 lookup_G

1 lookup_C

| consonant | mai_kai

0 lookup_H

1 lookup_C

| consonant | mai_kaue

0 lookup_I

1 lookup_C

lookup_C: (single substitution)

preposed_vowel > deleted glyph

lookup_D: (multiple_substitution, one expansion for each cosonant)

consonant > mai_ke consonant


lookup_F: (multiple_substitution, one expansion for each cosonant)

consonant > mai_kae consonant

lookup_G: (multiple_substitution, one expansion for each cosonant)

consonant > mai_ko consonant

lookup_H: (multiple_substitution, one expansion for each cosonant)

consonant > mai_kai consonant

lookup_I: (multiple_substitution, one expansion for each cosonant)

consonant > mai_kaue consonant

I would use another lookup to get rid of the deleted glyph, but it
seems to be possible to leave it in place.

> Do you guys here know any material that would further explain how such
> cases of GSUB should be correctly handled?

I presume it's a Microsoft trade secret.  After all, it's not as though
OpenType is an ISO standard, is it?

Richard.


More information about the HarfBuzz mailing list