[OTLayout] Ignore default-ignorables when matching GSUB/GPOS
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 14 Feb 2013 12:43:13 +0000 (07:43 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 14 Feb 2013 17:57:50 +0000 (12:57 -0500)
commit607feb7cff0e50f8738d2e49ca463fc9d7d494de
tree8ef28996f7c319bf6dae4ec96331fe7720ce8654
parentec5448667b30ad662401c2b4f5fc0da524c013fd
[OTLayout] Ignore default-ignorables when matching GSUB/GPOS

When matching lookups, be smart about default-ignorable characters.
In particular:

Do nothing specific about ZWNJ, but for the other default-ignorables:

If the lookup in question uses the ignorable character in a sequence,
then match it as we used to do.  However, if the sequence match will
fail because the default-ignorable blocked it, try skipping the
ignorable character and continue.

The most immediate thing it means is that if Lam-Alef forms a ligature,
then Lam-ZWJ-Alef will do to.  Finally!

One exception: when matching for GPOS, or for backtrack/lookahead of
GSUB, we ignore ZWNJ too.  That's the right thing to do.

It certainly is possible to build fonts that this feature will result
in undesirable glyphs, but it's hard to think of a real-world case
that that would happen.

This *does* break Indic shaping right now, since Indic Unicode has
specific rules for what ZWJ/ZWNJ mean, and skipping ZWJ is breaking
those rules.  That will be fixed in upcoming commits.
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-private.hh
src/hb-ot-shape-private.hh