Skip to content

Commit

Permalink
Fix the order of feature writers
Browse files Browse the repository at this point in the history
We want curs feature lookups to come first, then kerning, then
mark/mkmk, but we currently are calling CursFeatureWriter last which
causes its lookups to be also written last. The lookup order does not
matter for HarfBuzz, but it matters for other implementations, see:
harfbuzz/harfbuzz#4596 (comment)
  • Loading branch information
khaledhosny committed Aug 28, 2024
1 parent bb79cae commit 9dd2f92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Lib/ufo2ft/featureCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ class FeatureCompiler(BaseFeatureCompiler):
"""

defaultFeatureWriters = [
CursFeatureWriter,
KernFeatureWriter,
MarkFeatureWriter,
GdefFeatureWriter,
CursFeatureWriter,
]

def __init__(
Expand Down
20 changes: 10 additions & 10 deletions tests/featureWriters/variableFeatureWriter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ def test_variable_features(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;
feature curs {
lookup curs_rtl {
lookupflag RightToLeft IgnoreMarks;
pos cursive alef-ar.fina <anchor (wght=100:299 wght=1000:330) (wght=100:97 wght=1000:115)> <anchor NULL>;
pos cursive peh-ar.init <anchor NULL> <anchor (wght=100:161 wght=1000:73) (wght=100:54 wght=1000:89)>;
pos cursive peh-ar.init.BRACKET.varAlt01 <anchor NULL> <anchor (wght=100:89 wght=1000:73) (wght=100:53 wght=1000:85)>;
} curs_rtl;
} curs;
lookup kern_Arab {
lookupflag IgnoreMarks;
pos alef-ar.fina alef-ar.fina <(wght=100:15 wght=1000:35) 0 (wght=100:15 wght=1000:35) 0>;
Expand Down Expand Up @@ -47,16 +57,6 @@ def test_variable_features(FontClass):
table GDEF {
LigatureCaretByPos peh-ar.init 100;
} GDEF;
feature curs {
lookup curs_rtl {
lookupflag RightToLeft IgnoreMarks;
pos cursive alef-ar.fina <anchor (wght=100:299 wght=1000:330) (wght=100:97 wght=1000:115)> <anchor NULL>;
pos cursive peh-ar.init <anchor NULL> <anchor (wght=100:161 wght=1000:73) (wght=100:54 wght=1000:89)>;
pos cursive peh-ar.init.BRACKET.varAlt01 <anchor NULL> <anchor (wght=100:89 wght=1000:73) (wght=100:53 wght=1000:85)>;
} curs_rtl;
} curs;
""" # noqa: B950
)

Expand Down

0 comments on commit 9dd2f92

Please sign in to comment.