Skip to content

Commit

Permalink
Merge pull request #1052 from googlefonts/fix-ttx-diff-xpath
Browse files Browse the repository at this point in the history
[ttx_diff] ensure only the GPOS lookups get xpath'ed for pruning
  • Loading branch information
anthrotype authored Oct 17, 2024
2 parents 00b2890 + 1e3f570 commit 488e7be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion resources/scripts/ttx_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,10 @@ def remove_mark_and_kern_lookups(ttx):
gpos = ttx.find("GPOS")
if gpos is None:
return
for lookup in gpos.xpath("//Lookup"):
# './/Lookup' xpath selects all the 'Lookup' elements that are descendants of
# the current 'GPOS' node - no matter where they are under it.
# Most importantly, this _excludes_ GSUB lookups, which shouldn't be pruned.
for lookup in gpos.xpath(".//Lookup"):
lookup_type_el = lookup.find("LookupType")
lookup_type = int(lookup_type_el.attrib["value"])
is_extension = lookup_type == 9
Expand Down

0 comments on commit 488e7be

Please sign in to comment.