Skip to content

Commit

Permalink
[ttx_diff] ensure only the GPOS lookups get xpath'ed for pruning
Browse files Browse the repository at this point in the history
right now the  xpath 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.

see https://www.w3schools.com/xml/xpath_syntax.asp
  • Loading branch information
anthrotype committed Oct 17, 2024
1 parent 00b2890 commit 1e3f570
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 1e3f570

Please sign in to comment.