Skip to content

Commit

Permalink
Port over #866
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Sep 3, 2024
1 parent 39cec2d commit f80b117
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
8 changes: 7 additions & 1 deletion Lib/ufo2ft/featureWriters/kernFeatureWriter2.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,13 @@ def get_variable_kerning_pairs(
if default_location not in value.values:
value.values[default_location] = 0
value = collapse_varscalar(value)
result.append(KerningPair(side1, side2, value))
pair = KerningPair(side1, side2, value)
# Ignore zero-valued class kern pairs. They are the most general
# kerns, so they don't override anything else like glyph kerns would
# and zero is the default.
if pair.firstIsClass and pair.secondIsClass and pair.value == 0:
continue
result.append(pair)

return result

Expand Down
13 changes: 1 addition & 12 deletions tests/featureWriters/variableFeatureWriter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,9 @@ def test_variable_features_old_kern_writer(FontClass):
markClass dotabove-ar <anchor (wght=100:100 wght=1000:125) (wght=100:320 wght=1000:416)> @MC_top;
markClass gravecmb <anchor 250 400> @MC_top;
@kern1.ltr.a = [a];
@kern1.rtl.alef = [alef-ar.fina];
@kern2.ltr.a = [a];
@kern2.rtl.alef = [alef-ar.fina];
lookup kern_ltr {
lookupflag IgnoreMarks;
pos @kern1.ltr.a @kern2.ltr.a 0;
} kern_ltr;
lookup kern_rtl {
lookupflag IgnoreMarks;
pos alef-ar.fina alef-ar.fina <(wght=100:15 wght=1000:35) 0 (wght=100:15 wght=1000:35) 0>;
Expand All @@ -122,15 +115,11 @@ def test_variable_features_old_kern_writer(FontClass):
feature kern {
script DFLT;
language dflt;
lookup kern_ltr;
lookup kern_rtl;
script arab;
language dflt;
lookup kern_rtl;
script latn;
language dflt;
lookup kern_ltr;
} kern;
feature mark {
Expand Down

0 comments on commit f80b117

Please sign in to comment.