googlefonts / ufo2ft

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

Improve mark writer for character used in multiple scripts #678

Closed khaledhosny closed 1 year ago

khaledhosny commented 1 year ago

If a character is used in multiple scripts, and on of these scripts uses e.g. USE shaper, the mark writer will write its anchors in abvm/blwm features exclusively. This breaks the mark attachment if the shaper of the indented script does not enable abvm/blwm features.

This is a partial fix, by looking into the language systems declared in the feature file and filtering out abvm scripts not in them.

Part of https://github.com/googlefonts/ufo2ft/issues/579

anthrotype commented 1 year ago

a partial fix

what's left for a full fix?

by looking into the language systems declared in the feature file

does it mean that to enable generating abvm/blwm features we would now require that the indic scripts be explicitly defined as global languagesystem statements? Is it conceivable that they might not declared as such in real-world font projects? I am only concerned this might break existing workflows.

khaledhosny commented 1 year ago

a partial fix

what's left for a full fix?

If the character is used in multiple scripts, write features for all scripts, right now if one of the scripts needs abvm/blwm we don’t write mark feature.

by looking into the language systems declared in the feature file

does it mean that to enable generating abvm/blwm features we would now require that the indic scripts be explicitly defined as global languagesystem statements? Is it conceivable that they might not declared as such in real-world font projects? I am only concerned this might break existing workflows.

The assumption is that since all scripts requiring abvm/blwm are scripts that require other features to work correctly, it is unlikely that they will be missing such declaration. We also don’t write any script/language statements in the generated code, so if global languagesystem is not there the mark positioning is unlikely to work anyway.

simoncozens commented 1 year ago

I'll try to take a look at this today.

khaledhosny commented 1 year ago

a partial fix

what's left for a full fix?

If the character is used in multiple scripts, write features for all scripts, right now if one of the scripts needs abvm/blwm we don’t write mark feature.

This is done now.

simoncozens commented 1 year ago

Looks good to me; thank you!