googlefonts / ufo2ft

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

markFeatureWriter: Ignore contextual anchors #868

Closed khaledhosny closed 2 months ago

khaledhosny commented 2 months ago

We don’t support contextual anchors in markFeatureWriter, but glyphsLib subclasses it and adds support for them. However, since we are unaware of contextual anchors, we end up with positioning statements with duplicated mark positions like this:

pos base beh-ar.init
    <anchor 91 -316> mark @MC_top
    <anchor 91 -226> mark @MC_top;

(one is the regular anchor, and the other is the contextual one). Which makes no sense (feaLib shouldn’t probably allow the same mark class to be used multiple times in the same statement).

This PR adds isContextual to NamedAnchor and ignores any such anchors when writing pose statements. It is already set by glyphsLib’s MarkFeatureWriter, but otherwise should not affect ufo2ft’s as it always sets it to False.

anthrotype commented 2 months ago

can't we just bring in the whole contextual mark feature writer? It wouldn't be the first time we add some Glyphs-specific feature to ufo2ft which may benefit the rest of the UFO workflows

khaledhosny commented 2 months ago

I wouldn't mind doing that. The current setup is not making things easy, but it wasn’t me who set it up this way.

anthrotype commented 2 months ago

@simoncozens do you agree with moving the glyphsLib's custom mark writer to ufo2ft to reduce the complexity?

simoncozens commented 2 months ago

Sure, it will make things easier now, and also in the future if we convince UFO to support contextual anchors.

khaledhosny commented 2 months ago

OK, I’ll work on that.

khaledhosny commented 2 months ago

Closing in favor of #869.