googlefonts / ufo2ft

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

cursFeatureWriter: Support multiple entry/exit anchor pairs #863

Closed khaledhosny closed 1 month ago

khaledhosny commented 1 month ago

Support dot suffixed entry and exit anchor names, in addition to unsuffixed names. Each anchor pair creates a new lookups. Lookups are sorted by anchor names.

khaledhosny commented 1 month ago

Glyphs supports such suffixed cursive anchor names, but I don’t know about other font editors, so in a sense this is Glyphs-specific, but UFO spec is silent on cursive anchors so I think the whole concept is Glyphs-specific.

@schriftgestalt, this supports entry.1, entry.foo etc, does glyph support suffix seperators other than .?

anthrotype commented 1 month ago

Thanks Khaled, even if only Glyphs.app supports this, I think it's OK to add this here.

schriftgestalt commented 1 month ago

I just check my code. All anchors that start with "exit/entry" a used for the curs feature. Everything following is used as suffix. So "exitABC" or "entry1234" is valid.

Glyphs uses "exit/entry" that have one char (e.g. # or 😀) prefix for component alignment but ignores them for the curs feature.

khaledhosny commented 1 month ago

I just check my code. All anchors that start with "exit/entry" a used for the curs feature. Everything following is used as suffix. So "exitABC" or "entry1234" is valid.

Interesting. Since lookup for entry.1 is named curs_1, what happens if there is also entry_1 anchor?

Glyphs uses "exit/entry" that have one char (e.g. # or 😀) prefix for component alignment but ignores them for the curs feature.

I think we already skip such anchors in glyphsLib markFeatureWriter, and since they don’t start with entry or exit, they would be skipped here as well.

schriftgestalt commented 1 month ago

Interesting. Since lookup for entry.1 is named curs_1, what happens if there is also entry_1 anchor?

Those would end up in the same lookup.

moyogo commented 1 month ago

Maybe Glyphs.app can use the "." like in the test with this semantics?

schriftgestalt commented 1 month ago

What do you mean? Use the period in the lookup name of only allow dot-suffixes?