googlefonts / ufo2ft

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

Reorder class definitions in feature writers #725

Closed simoncozens closed 1 year ago

simoncozens commented 1 year ago

This fixes one of the issues in #506 - that is, when the mark feature writer is run more than once (for example, for abvm and then for mark), the mark class definitions that it emits can end up after the lookups which use those definitions, causing the font to fail to compile. Instead of trying to carefully work out where to place the definitions, we simply put them at the top of the feature file.

This also rewrites the feature writer test class to detect new statements wherever they occur in the feature file, not simply statements which have been appended.

khaledhosny commented 1 year ago

(i wish feaLib didn't care about mark class definition appearing before mark lookups)

What is that?

anthrotype commented 1 year ago

i was referring to the fact that mark class definitions appearing after the lookups which use those definitions cause the font to fail to compile, as Simon pointed out

khaledhosny commented 1 year ago

i was referring to the fact that mark class definitions appearing after the lookups which use those definitions cause the font to fail to compile, as Simon pointed out

I see. It is probably some makeotf limitation feaLib copied, if we can relax this then we should (probably it can be relaxed since the lookups are built after the parsing). Please open a FontTools issue if you think this should happen.