File tree 4 files changed +14
-3
lines changed
Lib/ufo2ft/featureWriters
TestVarfea-Bold.ufo/glyphs
TestVarfea-Regular.ufo/glyphs
4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change
1
+ from fontTools .feaLib .variableScalar import VariableScalar
1
2
from fontTools .misc .fixedTools import otRound
2
3
3
4
from ufo2ft .featureWriters import BaseFeatureWriter , ast
4
5
5
6
7
+ def caretSortKey (caret ):
8
+ if isinstance (caret , VariableScalar ):
9
+ return list (caret .values .values ())[0 ]
10
+ return caret
11
+
12
+
6
13
class GdefFeatureWriter (BaseFeatureWriter ):
7
14
"""Generates a GDEF table based on OpenType Category and glyph anchors.
8
15
@@ -67,9 +74,7 @@ def _getLigatureCarets(self):
67
74
68
75
if glyphCarets :
69
76
if self .context .isVariable :
70
- carets [glyphName ] = sorted (
71
- glyphCarets , key = lambda caret : list (caret .values .values ())[0 ]
72
- )
77
+ carets [glyphName ] = sorted (glyphCarets , key = caretSortKey )
73
78
else :
74
79
carets [glyphName ] = [otRound (c ) for c in sorted (glyphCarets )]
75
80
Original file line number Diff line number Diff line change 2
2
<glyph name =" peh-ar.init" format =" 2" >
3
3
<advance width =" 600" />
4
4
<unicode hex =" 067E" />
5
+ <anchor x =" 100" y =" 100" name =" caret_1" />
5
6
<anchor x =" 73" y =" 89" name =" exit" />
6
7
<outline >
7
8
<contour >
Original file line number Diff line number Diff line change 2
2
<glyph name =" peh-ar.init" format =" 2" >
3
3
<advance width =" 600" />
4
4
<unicode hex =" 067E" />
5
+ <anchor x =" 100" y =" 100" name =" caret_1" />
5
6
<anchor x =" 161" y =" 54" name =" exit" />
6
7
<outline >
7
8
<contour >
Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ def test_variable_features(FontClass):
41
41
42
42
} mark;
43
43
44
+ table GDEF {
45
+ LigatureCaretByPos peh-ar.init 100;
46
+ } GDEF;
47
+
44
48
feature curs {
45
49
lookup curs {
46
50
lookupflag RightToLeft IgnoreMarks;
You can’t perform that action at this time.
0 commit comments