googlefonts / ufo2ft

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

iterClassDefinitions() should find nested class definitions #732

Closed moyogo closed 1 year ago

moyogo commented 1 year ago

https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html#2.g.ii

Glyph class assignments can appear anywhere in the feature file. A glyph class name may be used in the feature file only after its definition.

Glyph class definitions can be top-level, inside a feature blocks but also inside a lookup block or inside lookup block itself inside a feature block. I guess other blocks like cvparameters or table would not make sense.

anthrotype commented 1 year ago

hey Denis! can you fix formatting with black, and also rebase on main where I made codecov not fail the PR checks (upload is flaky with PRs sometimes)

moyogo commented 1 year ago

@anthrotype Will do. Do you know if the feature tag argument is used in anyway? Considering classes can be defined anywhere it doesn't seem to make sense as currently used. I'm not sure what it's used for either.

anthrotype commented 1 year ago

is it not used? maybe remove it then. These methods are unlikely to be used outside ufo2ft. You're right it doesn't make much sense to narrow the search to a specific feature block given these class definitions are global in nature.

moyogo commented 1 year ago

@anthrotype Please take another look. I rewrote the function iterClassDefinitions() without the featureTag argument and formatted ast_test.py after black and isort complained.

moyogo commented 1 year ago

Thank you!

anthrotype commented 1 year ago

feel free to merge when you get a LGTM from other co-maintainers, I think you already should have write access to this repo