GNOME Bugzilla – Bug 439298
OpenType feature apply order
Last modified: 2012-08-25 19:22:47 UTC
Pango currently applies OpenType features in the order added to the ruleset. This is problematic as the OT spec doesn't order the features, and that when we allow OT feature attributes in the future, there's no meaningful way to order them. As pointed in bug 325714, features should be applied in the font order, and it's the fonts' responsibility to order them correctly. This makes a lot of sense and is most probably what was meant by the OT spec. However, Owen points out that Pango used to work that way but many Indic fonts were not working, so the ruleset order was followed. Digging history, seems like that's not quite the case. As far as can be seen in history, it was introduced to fix a certain Arabic font. Bug 122330. Anyway, we need to figure out if we can revert that change. If not, we need to support both orders, and choose on a per-engine basis. We can dump the features in fonts and see if they follow the order the module would use them.
I asked on OpenType list, and George Williams says that lookups should be applied in the order they appear in LookupList, such that lookups from various features can interweave. Makes a lot of sense indeed, and is what pango used to do. Adam Twardoch adds that he believes Uniscribe reorders lookups into the "standard" order for Arabic, because the early "TrueType Open" Arabic fonts were produced with the assumption that lookup order doesn't matter.
More progress, seems like there are in fact three steps: - Standard GSUB features, applied one by one. - Remaining GSUB features, applied all at once, by lookup index order. - All GPOS features, applied all at once, by lookup index order.
Also seems like ccmp and locl are applied together at the very beginning.
Paul Nelson casually confirmed that the three-step process is what it should look like: - Preparatory features applied combined: ccmp, locl, rtla, ... - Per-script shaping, features applied one at a time - Any other features, applied combhined
Fixed in HarfBuzz.