googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
152 stars 43 forks source link

Don't skip over spacing marks when kerning #720

Closed simoncozens closed 1 year ago

simoncozens commented 1 year ago

Consider the following font:

Screenshot 2023-03-03 at 09 24 18

We want to kern between ka-deva and ra-deva:

Screenshot 2023-03-03 at 09 24 55

But (to do certain bits of OpenType magic) we make highspacingdot-deva a "spacing combining" mark (spacing mark). This is so we can filter it out when doing conjuncts or something like that. (This is slightly contrived, but an analogous situation does exist for many Indic scripts.)

We also want kerning between ka-deva and the mark, so we make a base-mark kern:

Screenshot 2023-03-03 at 09 27 25

But because it's a mark class in GDEF, when we apply base-base kerning, this gets skipped. So with a sequence like ka-deva|highspacingdot-deva|ra-deva, the result, with current ufo2ft, is:

shape

Instead what we need to do is, rather than filtering out all marks, only filter out non-spacing marks, allowing spacing marks to break the base-base kern, so that only base-mark kerning is applied:

shape