Skip to content

Commit

Permalink
Merge pull request #1044 from googlefonts/ttx-diff-ignore-extension-l…
Browse files Browse the repository at this point in the history
…ookups

[ttx_diff] handle extensions when pruning kern/mark lookups
  • Loading branch information
anthrotype authored Oct 16, 2024
2 parents 37143a0 + 9a59e66 commit 9df83ca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion resources/scripts/ttx_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,23 @@ def remove_mark_and_kern_lookups(ttx):
if gpos is None:
return
for lookup in gpos.xpath("//Lookup"):
lookup_type = int(lookup.find("LookupType").attrib["value"])
lookup_type_el = lookup.find("LookupType")
lookup_type = int(lookup_type_el.attrib["value"])
is_extension = lookup_type == 9
if is_extension:
# For extension lookups, take the lookup type of the wrapped subtables;
# all extension subtables share the same lookup type so checking only
# the first is enough.
ext_subtable = lookup.find("ExtensionPos")
lookup_type = int(ext_subtable.find("ExtensionLookupType").attrib["value"])
if lookup_type not in LOOKUPS_TO_SKIP:
continue
# remove all the elements but the type:
to_remove = [child for child in lookup if child.tag != "LookupType"]
for child in to_remove:
lookup.remove(child)
if is_extension:
lookup_type_el.attrib["value"] = str(lookup_type)


def reduce_diff_noise(build_dir, fontc, fontmake):
Expand Down

0 comments on commit 9df83ca

Please sign in to comment.