googlefonts / fontc

Where in we pursue oxidizing (context: https://github.com/googlefonts/oxidize) fontmake.
Apache License 2.0
85 stars 14 forks source link

[ttx_diff] ensure only the GPOS lookups get xpath'ed for pruning #1052

Closed anthrotype closed 1 month ago

anthrotype commented 1 month ago

right now the gpos.xpath("//Lookup") ends up selecting and removing GSUB lookups of type 2, 4, 5 and 6 as well, even though we only intended to prune the GPOS ones.

That's the way // works, it will select all matching elements following the current node anywhere they appear, not only their descendants. GSUB follows GPOS since ttx sorts table alphabetically. Putting a dot in front .// ensures only the descendants of the current node are selected.

see https://www.w3schools.com/xml/xpath_syntax.asp

cmyr commented 1 month ago

well that is certainly nasty...