1*e1fe3e4aSElliott Hughesfrom fontTools.ttLib import TTFont 2*e1fe3e4aSElliott Hughesfrom fontTools.ttLib import ttGlyphSet 3*e1fe3e4aSElliott Hughesfrom fontTools.ttLib.ttGlyphSet import LerpGlyphSet 4*e1fe3e4aSElliott Hughesfrom fontTools.pens.recordingPen import ( 5*e1fe3e4aSElliott Hughes RecordingPen, 6*e1fe3e4aSElliott Hughes RecordingPointPen, 7*e1fe3e4aSElliott Hughes DecomposingRecordingPen, 8*e1fe3e4aSElliott Hughes) 9*e1fe3e4aSElliott Hughesfrom fontTools.misc.roundTools import otRound 10*e1fe3e4aSElliott Hughesfrom fontTools.misc.transform import DecomposedTransform 11*e1fe3e4aSElliott Hughesimport os 12*e1fe3e4aSElliott Hughesimport pytest 13*e1fe3e4aSElliott Hughes 14*e1fe3e4aSElliott Hughes 15*e1fe3e4aSElliott Hughesclass TTGlyphSetTest(object): 16*e1fe3e4aSElliott Hughes @staticmethod 17*e1fe3e4aSElliott Hughes def getpath(testfile): 18*e1fe3e4aSElliott Hughes path = os.path.dirname(__file__) 19*e1fe3e4aSElliott Hughes return os.path.join(path, "data", testfile) 20*e1fe3e4aSElliott Hughes 21*e1fe3e4aSElliott Hughes @pytest.mark.parametrize( 22*e1fe3e4aSElliott Hughes "fontfile, location, expected", 23*e1fe3e4aSElliott Hughes [ 24*e1fe3e4aSElliott Hughes ( 25*e1fe3e4aSElliott Hughes "I.ttf", 26*e1fe3e4aSElliott Hughes None, 27*e1fe3e4aSElliott Hughes [ 28*e1fe3e4aSElliott Hughes ("moveTo", ((175, 0),)), 29*e1fe3e4aSElliott Hughes ("lineTo", ((367, 0),)), 30*e1fe3e4aSElliott Hughes ("lineTo", ((367, 1456),)), 31*e1fe3e4aSElliott Hughes ("lineTo", ((175, 1456),)), 32*e1fe3e4aSElliott Hughes ("closePath", ()), 33*e1fe3e4aSElliott Hughes ], 34*e1fe3e4aSElliott Hughes ), 35*e1fe3e4aSElliott Hughes ( 36*e1fe3e4aSElliott Hughes "I.ttf", 37*e1fe3e4aSElliott Hughes {}, 38*e1fe3e4aSElliott Hughes [ 39*e1fe3e4aSElliott Hughes ("moveTo", ((175, 0),)), 40*e1fe3e4aSElliott Hughes ("lineTo", ((367, 0),)), 41*e1fe3e4aSElliott Hughes ("lineTo", ((367, 1456),)), 42*e1fe3e4aSElliott Hughes ("lineTo", ((175, 1456),)), 43*e1fe3e4aSElliott Hughes ("closePath", ()), 44*e1fe3e4aSElliott Hughes ], 45*e1fe3e4aSElliott Hughes ), 46*e1fe3e4aSElliott Hughes ( 47*e1fe3e4aSElliott Hughes "I.ttf", 48*e1fe3e4aSElliott Hughes {"wght": 100}, 49*e1fe3e4aSElliott Hughes [ 50*e1fe3e4aSElliott Hughes ("moveTo", ((175, 0),)), 51*e1fe3e4aSElliott Hughes ("lineTo", ((271, 0),)), 52*e1fe3e4aSElliott Hughes ("lineTo", ((271, 1456),)), 53*e1fe3e4aSElliott Hughes ("lineTo", ((175, 1456),)), 54*e1fe3e4aSElliott Hughes ("closePath", ()), 55*e1fe3e4aSElliott Hughes ], 56*e1fe3e4aSElliott Hughes ), 57*e1fe3e4aSElliott Hughes ( 58*e1fe3e4aSElliott Hughes "I.ttf", 59*e1fe3e4aSElliott Hughes {"wght": 1000}, 60*e1fe3e4aSElliott Hughes [ 61*e1fe3e4aSElliott Hughes ("moveTo", ((128, 0),)), 62*e1fe3e4aSElliott Hughes ("lineTo", ((550, 0),)), 63*e1fe3e4aSElliott Hughes ("lineTo", ((550, 1456),)), 64*e1fe3e4aSElliott Hughes ("lineTo", ((128, 1456),)), 65*e1fe3e4aSElliott Hughes ("closePath", ()), 66*e1fe3e4aSElliott Hughes ], 67*e1fe3e4aSElliott Hughes ), 68*e1fe3e4aSElliott Hughes ( 69*e1fe3e4aSElliott Hughes "I.ttf", 70*e1fe3e4aSElliott Hughes {"wght": 1000, "wdth": 25}, 71*e1fe3e4aSElliott Hughes [ 72*e1fe3e4aSElliott Hughes ("moveTo", ((140, 0),)), 73*e1fe3e4aSElliott Hughes ("lineTo", ((553, 0),)), 74*e1fe3e4aSElliott Hughes ("lineTo", ((553, 1456),)), 75*e1fe3e4aSElliott Hughes ("lineTo", ((140, 1456),)), 76*e1fe3e4aSElliott Hughes ("closePath", ()), 77*e1fe3e4aSElliott Hughes ], 78*e1fe3e4aSElliott Hughes ), 79*e1fe3e4aSElliott Hughes ( 80*e1fe3e4aSElliott Hughes "I.ttf", 81*e1fe3e4aSElliott Hughes {"wght": 1000, "wdth": 50}, 82*e1fe3e4aSElliott Hughes [ 83*e1fe3e4aSElliott Hughes ("moveTo", ((136, 0),)), 84*e1fe3e4aSElliott Hughes ("lineTo", ((552, 0),)), 85*e1fe3e4aSElliott Hughes ("lineTo", ((552, 1456),)), 86*e1fe3e4aSElliott Hughes ("lineTo", ((136, 1456),)), 87*e1fe3e4aSElliott Hughes ("closePath", ()), 88*e1fe3e4aSElliott Hughes ], 89*e1fe3e4aSElliott Hughes ), 90*e1fe3e4aSElliott Hughes ( 91*e1fe3e4aSElliott Hughes "I.otf", 92*e1fe3e4aSElliott Hughes {"wght": 1000}, 93*e1fe3e4aSElliott Hughes [ 94*e1fe3e4aSElliott Hughes ("moveTo", ((179, 74),)), 95*e1fe3e4aSElliott Hughes ("lineTo", ((28, 59),)), 96*e1fe3e4aSElliott Hughes ("lineTo", ((28, 0),)), 97*e1fe3e4aSElliott Hughes ("lineTo", ((367, 0),)), 98*e1fe3e4aSElliott Hughes ("lineTo", ((367, 59),)), 99*e1fe3e4aSElliott Hughes ("lineTo", ((212, 74),)), 100*e1fe3e4aSElliott Hughes ("lineTo", ((179, 74),)), 101*e1fe3e4aSElliott Hughes ("closePath", ()), 102*e1fe3e4aSElliott Hughes ("moveTo", ((179, 578),)), 103*e1fe3e4aSElliott Hughes ("lineTo", ((212, 578),)), 104*e1fe3e4aSElliott Hughes ("lineTo", ((367, 593),)), 105*e1fe3e4aSElliott Hughes ("lineTo", ((367, 652),)), 106*e1fe3e4aSElliott Hughes ("lineTo", ((28, 652),)), 107*e1fe3e4aSElliott Hughes ("lineTo", ((28, 593),)), 108*e1fe3e4aSElliott Hughes ("lineTo", ((179, 578),)), 109*e1fe3e4aSElliott Hughes ("closePath", ()), 110*e1fe3e4aSElliott Hughes ("moveTo", ((98, 310),)), 111*e1fe3e4aSElliott Hughes ("curveTo", ((98, 205), (98, 101), (95, 0))), 112*e1fe3e4aSElliott Hughes ("lineTo", ((299, 0),)), 113*e1fe3e4aSElliott Hughes ("curveTo", ((296, 103), (296, 207), (296, 311))), 114*e1fe3e4aSElliott Hughes ("lineTo", ((296, 342),)), 115*e1fe3e4aSElliott Hughes ("curveTo", ((296, 447), (296, 551), (299, 652))), 116*e1fe3e4aSElliott Hughes ("lineTo", ((95, 652),)), 117*e1fe3e4aSElliott Hughes ("curveTo", ((98, 549), (98, 445), (98, 342))), 118*e1fe3e4aSElliott Hughes ("lineTo", ((98, 310),)), 119*e1fe3e4aSElliott Hughes ("closePath", ()), 120*e1fe3e4aSElliott Hughes ], 121*e1fe3e4aSElliott Hughes ), 122*e1fe3e4aSElliott Hughes ( 123*e1fe3e4aSElliott Hughes # In this font, /I has an lsb of 30, but an xMin of 25, so an 124*e1fe3e4aSElliott Hughes # offset of 5 units needs to be applied when drawing the outline. 125*e1fe3e4aSElliott Hughes # See https://github.com/fonttools/fonttools/issues/2824 126*e1fe3e4aSElliott Hughes "issue2824.ttf", 127*e1fe3e4aSElliott Hughes None, 128*e1fe3e4aSElliott Hughes [ 129*e1fe3e4aSElliott Hughes ("moveTo", ((309, 180),)), 130*e1fe3e4aSElliott Hughes ("qCurveTo", ((274, 151), (187, 136), (104, 166), (74, 201))), 131*e1fe3e4aSElliott Hughes ("qCurveTo", ((45, 236), (30, 323), (59, 407), (95, 436))), 132*e1fe3e4aSElliott Hughes ("qCurveTo", ((130, 466), (217, 480), (301, 451), (330, 415))), 133*e1fe3e4aSElliott Hughes ("qCurveTo", ((360, 380), (374, 293), (345, 210), (309, 180))), 134*e1fe3e4aSElliott Hughes ("closePath", ()), 135*e1fe3e4aSElliott Hughes ], 136*e1fe3e4aSElliott Hughes ), 137*e1fe3e4aSElliott Hughes ], 138*e1fe3e4aSElliott Hughes ) 139*e1fe3e4aSElliott Hughes def test_glyphset(self, fontfile, location, expected): 140*e1fe3e4aSElliott Hughes font = TTFont(self.getpath(fontfile)) 141*e1fe3e4aSElliott Hughes glyphset = font.getGlyphSet(location=location) 142*e1fe3e4aSElliott Hughes 143*e1fe3e4aSElliott Hughes assert isinstance(glyphset, ttGlyphSet._TTGlyphSet) 144*e1fe3e4aSElliott Hughes 145*e1fe3e4aSElliott Hughes assert list(glyphset.keys()) == [".notdef", "I"] 146*e1fe3e4aSElliott Hughes 147*e1fe3e4aSElliott Hughes assert "I" in glyphset 148*e1fe3e4aSElliott Hughes with pytest.deprecated_call(): 149*e1fe3e4aSElliott Hughes assert glyphset.has_key("I") # we should really get rid of this... 150*e1fe3e4aSElliott Hughes 151*e1fe3e4aSElliott Hughes assert len(glyphset) == 2 152*e1fe3e4aSElliott Hughes 153*e1fe3e4aSElliott Hughes pen = RecordingPen() 154*e1fe3e4aSElliott Hughes glyph = glyphset["I"] 155*e1fe3e4aSElliott Hughes 156*e1fe3e4aSElliott Hughes assert glyphset.get("foobar") is None 157*e1fe3e4aSElliott Hughes 158*e1fe3e4aSElliott Hughes assert isinstance(glyph, ttGlyphSet._TTGlyph) 159*e1fe3e4aSElliott Hughes is_glyf = fontfile.endswith(".ttf") 160*e1fe3e4aSElliott Hughes glyphType = ttGlyphSet._TTGlyphGlyf if is_glyf else ttGlyphSet._TTGlyphCFF 161*e1fe3e4aSElliott Hughes assert isinstance(glyph, glyphType) 162*e1fe3e4aSElliott Hughes 163*e1fe3e4aSElliott Hughes glyph.draw(pen) 164*e1fe3e4aSElliott Hughes actual = pen.value 165*e1fe3e4aSElliott Hughes 166*e1fe3e4aSElliott Hughes assert actual == expected, (location, actual, expected) 167*e1fe3e4aSElliott Hughes 168*e1fe3e4aSElliott Hughes @pytest.mark.parametrize( 169*e1fe3e4aSElliott Hughes "fontfile, locations, factor, expected", 170*e1fe3e4aSElliott Hughes [ 171*e1fe3e4aSElliott Hughes ( 172*e1fe3e4aSElliott Hughes "I.ttf", 173*e1fe3e4aSElliott Hughes ({"wght": 400}, {"wght": 1000}), 174*e1fe3e4aSElliott Hughes 0.5, 175*e1fe3e4aSElliott Hughes [ 176*e1fe3e4aSElliott Hughes ("moveTo", ((151.5, 0.0),)), 177*e1fe3e4aSElliott Hughes ("lineTo", ((458.5, 0.0),)), 178*e1fe3e4aSElliott Hughes ("lineTo", ((458.5, 1456.0),)), 179*e1fe3e4aSElliott Hughes ("lineTo", ((151.5, 1456.0),)), 180*e1fe3e4aSElliott Hughes ("closePath", ()), 181*e1fe3e4aSElliott Hughes ], 182*e1fe3e4aSElliott Hughes ), 183*e1fe3e4aSElliott Hughes ( 184*e1fe3e4aSElliott Hughes "I.ttf", 185*e1fe3e4aSElliott Hughes ({"wght": 400}, {"wght": 1000}), 186*e1fe3e4aSElliott Hughes 0.25, 187*e1fe3e4aSElliott Hughes [ 188*e1fe3e4aSElliott Hughes ("moveTo", ((163.25, 0.0),)), 189*e1fe3e4aSElliott Hughes ("lineTo", ((412.75, 0.0),)), 190*e1fe3e4aSElliott Hughes ("lineTo", ((412.75, 1456.0),)), 191*e1fe3e4aSElliott Hughes ("lineTo", ((163.25, 1456.0),)), 192*e1fe3e4aSElliott Hughes ("closePath", ()), 193*e1fe3e4aSElliott Hughes ], 194*e1fe3e4aSElliott Hughes ), 195*e1fe3e4aSElliott Hughes ], 196*e1fe3e4aSElliott Hughes ) 197*e1fe3e4aSElliott Hughes def test_lerp_glyphset(self, fontfile, locations, factor, expected): 198*e1fe3e4aSElliott Hughes font = TTFont(self.getpath(fontfile)) 199*e1fe3e4aSElliott Hughes glyphset1 = font.getGlyphSet(location=locations[0]) 200*e1fe3e4aSElliott Hughes glyphset2 = font.getGlyphSet(location=locations[1]) 201*e1fe3e4aSElliott Hughes glyphset = LerpGlyphSet(glyphset1, glyphset2, factor) 202*e1fe3e4aSElliott Hughes 203*e1fe3e4aSElliott Hughes assert "I" in glyphset 204*e1fe3e4aSElliott Hughes 205*e1fe3e4aSElliott Hughes pen = RecordingPen() 206*e1fe3e4aSElliott Hughes glyph = glyphset["I"] 207*e1fe3e4aSElliott Hughes 208*e1fe3e4aSElliott Hughes assert glyphset.get("foobar") is None 209*e1fe3e4aSElliott Hughes 210*e1fe3e4aSElliott Hughes glyph.draw(pen) 211*e1fe3e4aSElliott Hughes actual = pen.value 212*e1fe3e4aSElliott Hughes 213*e1fe3e4aSElliott Hughes assert actual == expected, (locations, actual, expected) 214*e1fe3e4aSElliott Hughes 215*e1fe3e4aSElliott Hughes def test_glyphset_varComposite_components(self): 216*e1fe3e4aSElliott Hughes font = TTFont(self.getpath("varc-ac00-ac01.ttf")) 217*e1fe3e4aSElliott Hughes glyphset = font.getGlyphSet() 218*e1fe3e4aSElliott Hughes 219*e1fe3e4aSElliott Hughes pen = RecordingPen() 220*e1fe3e4aSElliott Hughes glyph = glyphset["uniAC00"] 221*e1fe3e4aSElliott Hughes 222*e1fe3e4aSElliott Hughes glyph.draw(pen) 223*e1fe3e4aSElliott Hughes actual = pen.value 224*e1fe3e4aSElliott Hughes 225*e1fe3e4aSElliott Hughes expected = [ 226*e1fe3e4aSElliott Hughes ( 227*e1fe3e4aSElliott Hughes "addVarComponent", 228*e1fe3e4aSElliott Hughes ( 229*e1fe3e4aSElliott Hughes "glyph00003", 230*e1fe3e4aSElliott Hughes DecomposedTransform(460.0, 676.0, 0, 1, 1, 0, 0, 0, 0), 231*e1fe3e4aSElliott Hughes { 232*e1fe3e4aSElliott Hughes "0000": 0.84661865234375, 233*e1fe3e4aSElliott Hughes "0001": 0.98944091796875, 234*e1fe3e4aSElliott Hughes "0002": 0.47283935546875, 235*e1fe3e4aSElliott Hughes "0003": 0.446533203125, 236*e1fe3e4aSElliott Hughes }, 237*e1fe3e4aSElliott Hughes ), 238*e1fe3e4aSElliott Hughes ), 239*e1fe3e4aSElliott Hughes ( 240*e1fe3e4aSElliott Hughes "addVarComponent", 241*e1fe3e4aSElliott Hughes ( 242*e1fe3e4aSElliott Hughes "glyph00004", 243*e1fe3e4aSElliott Hughes DecomposedTransform(932.0, 382.0, 0, 1, 1, 0, 0, 0, 0), 244*e1fe3e4aSElliott Hughes { 245*e1fe3e4aSElliott Hughes "0000": 0.93359375, 246*e1fe3e4aSElliott Hughes "0001": 0.916015625, 247*e1fe3e4aSElliott Hughes "0002": 0.523193359375, 248*e1fe3e4aSElliott Hughes "0003": 0.32806396484375, 249*e1fe3e4aSElliott Hughes "0004": 0.85089111328125, 250*e1fe3e4aSElliott Hughes }, 251*e1fe3e4aSElliott Hughes ), 252*e1fe3e4aSElliott Hughes ), 253*e1fe3e4aSElliott Hughes ] 254*e1fe3e4aSElliott Hughes 255*e1fe3e4aSElliott Hughes assert actual == expected, (actual, expected) 256*e1fe3e4aSElliott Hughes 257*e1fe3e4aSElliott Hughes def test_glyphset_varComposite1(self): 258*e1fe3e4aSElliott Hughes font = TTFont(self.getpath("varc-ac00-ac01.ttf")) 259*e1fe3e4aSElliott Hughes glyphset = font.getGlyphSet(location={"wght": 600}) 260*e1fe3e4aSElliott Hughes 261*e1fe3e4aSElliott Hughes pen = DecomposingRecordingPen(glyphset) 262*e1fe3e4aSElliott Hughes glyph = glyphset["uniAC00"] 263*e1fe3e4aSElliott Hughes 264*e1fe3e4aSElliott Hughes glyph.draw(pen) 265*e1fe3e4aSElliott Hughes actual = pen.value 266*e1fe3e4aSElliott Hughes 267*e1fe3e4aSElliott Hughes expected = [ 268*e1fe3e4aSElliott Hughes ("moveTo", ((432, 678),)), 269*e1fe3e4aSElliott Hughes ("lineTo", ((432, 620),)), 270*e1fe3e4aSElliott Hughes ( 271*e1fe3e4aSElliott Hughes "qCurveTo", 272*e1fe3e4aSElliott Hughes ( 273*e1fe3e4aSElliott Hughes (419, 620), 274*e1fe3e4aSElliott Hughes (374, 621), 275*e1fe3e4aSElliott Hughes (324, 619), 276*e1fe3e4aSElliott Hughes (275, 618), 277*e1fe3e4aSElliott Hughes (237, 617), 278*e1fe3e4aSElliott Hughes (228, 616), 279*e1fe3e4aSElliott Hughes ), 280*e1fe3e4aSElliott Hughes ), 281*e1fe3e4aSElliott Hughes ("qCurveTo", ((218, 616), (188, 612), (160, 605), (149, 601))), 282*e1fe3e4aSElliott Hughes ("qCurveTo", ((127, 611), (83, 639), (67, 654))), 283*e1fe3e4aSElliott Hughes ("qCurveTo", ((64, 657), (63, 662), (64, 666))), 284*e1fe3e4aSElliott Hughes ("lineTo", ((72, 678),)), 285*e1fe3e4aSElliott Hughes ("qCurveTo", ((93, 674), (144, 672), (164, 672))), 286*e1fe3e4aSElliott Hughes ( 287*e1fe3e4aSElliott Hughes "qCurveTo", 288*e1fe3e4aSElliott Hughes ( 289*e1fe3e4aSElliott Hughes (173, 672), 290*e1fe3e4aSElliott Hughes (213, 672), 291*e1fe3e4aSElliott Hughes (266, 673), 292*e1fe3e4aSElliott Hughes (323, 674), 293*e1fe3e4aSElliott Hughes (377, 675), 294*e1fe3e4aSElliott Hughes (421, 678), 295*e1fe3e4aSElliott Hughes (432, 678), 296*e1fe3e4aSElliott Hughes ), 297*e1fe3e4aSElliott Hughes ), 298*e1fe3e4aSElliott Hughes ("closePath", ()), 299*e1fe3e4aSElliott Hughes ("moveTo", ((525, 619),)), 300*e1fe3e4aSElliott Hughes ("lineTo", ((412, 620),)), 301*e1fe3e4aSElliott Hughes ("lineTo", ((429, 678),)), 302*e1fe3e4aSElliott Hughes ("lineTo", ((466, 697),)), 303*e1fe3e4aSElliott Hughes ("qCurveTo", ((470, 698), (482, 698), (486, 697))), 304*e1fe3e4aSElliott Hughes ("qCurveTo", ((494, 693), (515, 682), (536, 670), (541, 667))), 305*e1fe3e4aSElliott Hughes ("qCurveTo", ((545, 663), (545, 656), (543, 652))), 306*e1fe3e4aSElliott Hughes ("lineTo", ((525, 619),)), 307*e1fe3e4aSElliott Hughes ("closePath", ()), 308*e1fe3e4aSElliott Hughes ("moveTo", ((63, 118),)), 309*e1fe3e4aSElliott Hughes ("lineTo", ((47, 135),)), 310*e1fe3e4aSElliott Hughes ("qCurveTo", ((42, 141), (48, 146))), 311*e1fe3e4aSElliott Hughes ("qCurveTo", ((135, 213), (278, 373), (383, 541), (412, 620))), 312*e1fe3e4aSElliott Hughes ("lineTo", ((471, 642),)), 313*e1fe3e4aSElliott Hughes ("lineTo", ((525, 619),)), 314*e1fe3e4aSElliott Hughes ("qCurveTo", ((496, 529), (365, 342), (183, 179), (75, 121))), 315*e1fe3e4aSElliott Hughes ("qCurveTo", ((72, 119), (65, 118), (63, 118))), 316*e1fe3e4aSElliott Hughes ("closePath", ()), 317*e1fe3e4aSElliott Hughes ("moveTo", ((925, 372),)), 318*e1fe3e4aSElliott Hughes ("lineTo", ((739, 368),)), 319*e1fe3e4aSElliott Hughes ("lineTo", ((739, 427),)), 320*e1fe3e4aSElliott Hughes ("lineTo", ((822, 430),)), 321*e1fe3e4aSElliott Hughes ("lineTo", ((854, 451),)), 322*e1fe3e4aSElliott Hughes ("qCurveTo", ((878, 453), (930, 449), (944, 445))), 323*e1fe3e4aSElliott Hughes ("qCurveTo", ((961, 441), (962, 426))), 324*e1fe3e4aSElliott Hughes ("qCurveTo", ((964, 411), (956, 386), (951, 381))), 325*e1fe3e4aSElliott Hughes ("qCurveTo", ((947, 376), (931, 372), (925, 372))), 326*e1fe3e4aSElliott Hughes ("closePath", ()), 327*e1fe3e4aSElliott Hughes ("moveTo", ((729, -113),)), 328*e1fe3e4aSElliott Hughes ("lineTo", ((674, -113),)), 329*e1fe3e4aSElliott Hughes ("qCurveTo", ((671, -98), (669, -42), (666, 22), (665, 83), (665, 102))), 330*e1fe3e4aSElliott Hughes ("lineTo", ((665, 763),)), 331*e1fe3e4aSElliott Hughes ("qCurveTo", ((654, 780), (608, 810), (582, 820))), 332*e1fe3e4aSElliott Hughes ("lineTo", ((593, 850),)), 333*e1fe3e4aSElliott Hughes ("qCurveTo", ((594, 852), (599, 856), (607, 856))), 334*e1fe3e4aSElliott Hughes ("qCurveTo", ((628, 855), (684, 846), (736, 834), (752, 827))), 335*e1fe3e4aSElliott Hughes ("qCurveTo", ((766, 818), (766, 802))), 336*e1fe3e4aSElliott Hughes ("lineTo", ((762, 745),)), 337*e1fe3e4aSElliott Hughes ("lineTo", ((762, 134),)), 338*e1fe3e4aSElliott Hughes ("qCurveTo", ((762, 107), (757, 43), (749, -25), (737, -87), (729, -113))), 339*e1fe3e4aSElliott Hughes ("closePath", ()), 340*e1fe3e4aSElliott Hughes ] 341*e1fe3e4aSElliott Hughes 342*e1fe3e4aSElliott Hughes actual = [ 343*e1fe3e4aSElliott Hughes (op, tuple((otRound(pt[0]), otRound(pt[1])) for pt in args)) 344*e1fe3e4aSElliott Hughes for op, args in actual 345*e1fe3e4aSElliott Hughes ] 346*e1fe3e4aSElliott Hughes 347*e1fe3e4aSElliott Hughes assert actual == expected, (actual, expected) 348*e1fe3e4aSElliott Hughes 349*e1fe3e4aSElliott Hughes # Test that drawing twice works, we accidentally don't change the component 350*e1fe3e4aSElliott Hughes pen = DecomposingRecordingPen(glyphset) 351*e1fe3e4aSElliott Hughes glyph.draw(pen) 352*e1fe3e4aSElliott Hughes actual = pen.value 353*e1fe3e4aSElliott Hughes actual = [ 354*e1fe3e4aSElliott Hughes (op, tuple((otRound(pt[0]), otRound(pt[1])) for pt in args)) 355*e1fe3e4aSElliott Hughes for op, args in actual 356*e1fe3e4aSElliott Hughes ] 357*e1fe3e4aSElliott Hughes assert actual == expected, (actual, expected) 358*e1fe3e4aSElliott Hughes 359*e1fe3e4aSElliott Hughes pen = RecordingPointPen() 360*e1fe3e4aSElliott Hughes glyph.drawPoints(pen) 361*e1fe3e4aSElliott Hughes assert pen.value 362*e1fe3e4aSElliott Hughes 363*e1fe3e4aSElliott Hughes def test_glyphset_varComposite2(self): 364*e1fe3e4aSElliott Hughes # This test font has axis variations 365*e1fe3e4aSElliott Hughes 366*e1fe3e4aSElliott Hughes font = TTFont(self.getpath("varc-6868.ttf")) 367*e1fe3e4aSElliott Hughes glyphset = font.getGlyphSet(location={"wght": 600}) 368*e1fe3e4aSElliott Hughes 369*e1fe3e4aSElliott Hughes pen = DecomposingRecordingPen(glyphset) 370*e1fe3e4aSElliott Hughes glyph = glyphset["uni6868"] 371*e1fe3e4aSElliott Hughes 372*e1fe3e4aSElliott Hughes glyph.draw(pen) 373*e1fe3e4aSElliott Hughes actual = pen.value 374*e1fe3e4aSElliott Hughes 375*e1fe3e4aSElliott Hughes expected = [ 376*e1fe3e4aSElliott Hughes ("moveTo", ((460, 565),)), 377*e1fe3e4aSElliott Hughes ( 378*e1fe3e4aSElliott Hughes "qCurveTo", 379*e1fe3e4aSElliott Hughes ( 380*e1fe3e4aSElliott Hughes (482, 577), 381*e1fe3e4aSElliott Hughes (526, 603), 382*e1fe3e4aSElliott Hughes (568, 632), 383*e1fe3e4aSElliott Hughes (607, 663), 384*e1fe3e4aSElliott Hughes (644, 698), 385*e1fe3e4aSElliott Hughes (678, 735), 386*e1fe3e4aSElliott Hughes (708, 775), 387*e1fe3e4aSElliott Hughes (721, 796), 388*e1fe3e4aSElliott Hughes ), 389*e1fe3e4aSElliott Hughes ), 390*e1fe3e4aSElliott Hughes ("lineTo", ((632, 835),)), 391*e1fe3e4aSElliott Hughes ( 392*e1fe3e4aSElliott Hughes "qCurveTo", 393*e1fe3e4aSElliott Hughes ( 394*e1fe3e4aSElliott Hughes (621, 817), 395*e1fe3e4aSElliott Hughes (595, 784), 396*e1fe3e4aSElliott Hughes (566, 753), 397*e1fe3e4aSElliott Hughes (534, 724), 398*e1fe3e4aSElliott Hughes (499, 698), 399*e1fe3e4aSElliott Hughes (462, 675), 400*e1fe3e4aSElliott Hughes (423, 653), 401*e1fe3e4aSElliott Hughes (403, 644), 402*e1fe3e4aSElliott Hughes ), 403*e1fe3e4aSElliott Hughes ), 404*e1fe3e4aSElliott Hughes ("closePath", ()), 405*e1fe3e4aSElliott Hughes ("moveTo", ((616, 765),)), 406*e1fe3e4aSElliott Hughes ("lineTo", ((590, 682),)), 407*e1fe3e4aSElliott Hughes ("lineTo", ((830, 682),)), 408*e1fe3e4aSElliott Hughes ("lineTo", ((833, 682),)), 409*e1fe3e4aSElliott Hughes ("lineTo", ((828, 693),)), 410*e1fe3e4aSElliott Hughes ( 411*e1fe3e4aSElliott Hughes "qCurveTo", 412*e1fe3e4aSElliott Hughes ( 413*e1fe3e4aSElliott Hughes (817, 671), 414*e1fe3e4aSElliott Hughes (775, 620), 415*e1fe3e4aSElliott Hughes (709, 571), 416*e1fe3e4aSElliott Hughes (615, 525), 417*e1fe3e4aSElliott Hughes (492, 490), 418*e1fe3e4aSElliott Hughes (413, 480), 419*e1fe3e4aSElliott Hughes ), 420*e1fe3e4aSElliott Hughes ), 421*e1fe3e4aSElliott Hughes ("lineTo", ((454, 386),)), 422*e1fe3e4aSElliott Hughes ( 423*e1fe3e4aSElliott Hughes "qCurveTo", 424*e1fe3e4aSElliott Hughes ( 425*e1fe3e4aSElliott Hughes (544, 403), 426*e1fe3e4aSElliott Hughes (687, 455), 427*e1fe3e4aSElliott Hughes (798, 519), 428*e1fe3e4aSElliott Hughes (877, 590), 429*e1fe3e4aSElliott Hughes (926, 655), 430*e1fe3e4aSElliott Hughes (937, 684), 431*e1fe3e4aSElliott Hughes ), 432*e1fe3e4aSElliott Hughes ), 433*e1fe3e4aSElliott Hughes ("lineTo", ((937, 765),)), 434*e1fe3e4aSElliott Hughes ("closePath", ()), 435*e1fe3e4aSElliott Hughes ("moveTo", ((723, 555),)), 436*e1fe3e4aSElliott Hughes ( 437*e1fe3e4aSElliott Hughes "qCurveTo", 438*e1fe3e4aSElliott Hughes ( 439*e1fe3e4aSElliott Hughes (713, 563), 440*e1fe3e4aSElliott Hughes (693, 579), 441*e1fe3e4aSElliott Hughes (672, 595), 442*e1fe3e4aSElliott Hughes (651, 610), 443*e1fe3e4aSElliott Hughes (629, 625), 444*e1fe3e4aSElliott Hughes (606, 638), 445*e1fe3e4aSElliott Hughes (583, 651), 446*e1fe3e4aSElliott Hughes (572, 657), 447*e1fe3e4aSElliott Hughes ), 448*e1fe3e4aSElliott Hughes ), 449*e1fe3e4aSElliott Hughes ("lineTo", ((514, 590),)), 450*e1fe3e4aSElliott Hughes ( 451*e1fe3e4aSElliott Hughes "qCurveTo", 452*e1fe3e4aSElliott Hughes ( 453*e1fe3e4aSElliott Hughes (525, 584), 454*e1fe3e4aSElliott Hughes (547, 572), 455*e1fe3e4aSElliott Hughes (568, 559), 456*e1fe3e4aSElliott Hughes (589, 545), 457*e1fe3e4aSElliott Hughes (609, 531), 458*e1fe3e4aSElliott Hughes (629, 516), 459*e1fe3e4aSElliott Hughes (648, 500), 460*e1fe3e4aSElliott Hughes (657, 492), 461*e1fe3e4aSElliott Hughes ), 462*e1fe3e4aSElliott Hughes ), 463*e1fe3e4aSElliott Hughes ("closePath", ()), 464*e1fe3e4aSElliott Hughes ("moveTo", ((387, 375),)), 465*e1fe3e4aSElliott Hughes ("lineTo", ((387, 830),)), 466*e1fe3e4aSElliott Hughes ("lineTo", ((289, 830),)), 467*e1fe3e4aSElliott Hughes ("lineTo", ((289, 375),)), 468*e1fe3e4aSElliott Hughes ("closePath", ()), 469*e1fe3e4aSElliott Hughes ("moveTo", ((96, 383),)), 470*e1fe3e4aSElliott Hughes ( 471*e1fe3e4aSElliott Hughes "qCurveTo", 472*e1fe3e4aSElliott Hughes ( 473*e1fe3e4aSElliott Hughes (116, 390), 474*e1fe3e4aSElliott Hughes (156, 408), 475*e1fe3e4aSElliott Hughes (194, 427), 476*e1fe3e4aSElliott Hughes (231, 449), 477*e1fe3e4aSElliott Hughes (268, 472), 478*e1fe3e4aSElliott Hughes (302, 497), 479*e1fe3e4aSElliott Hughes (335, 525), 480*e1fe3e4aSElliott Hughes (351, 539), 481*e1fe3e4aSElliott Hughes ), 482*e1fe3e4aSElliott Hughes ), 483*e1fe3e4aSElliott Hughes ("lineTo", ((307, 610),)), 484*e1fe3e4aSElliott Hughes ( 485*e1fe3e4aSElliott Hughes "qCurveTo", 486*e1fe3e4aSElliott Hughes ( 487*e1fe3e4aSElliott Hughes (291, 597), 488*e1fe3e4aSElliott Hughes (257, 572), 489*e1fe3e4aSElliott Hughes (221, 549), 490*e1fe3e4aSElliott Hughes (185, 528), 491*e1fe3e4aSElliott Hughes (147, 509), 492*e1fe3e4aSElliott Hughes (108, 492), 493*e1fe3e4aSElliott Hughes (69, 476), 494*e1fe3e4aSElliott Hughes (48, 469), 495*e1fe3e4aSElliott Hughes ), 496*e1fe3e4aSElliott Hughes ), 497*e1fe3e4aSElliott Hughes ("closePath", ()), 498*e1fe3e4aSElliott Hughes ("moveTo", ((290, 653),)), 499*e1fe3e4aSElliott Hughes ( 500*e1fe3e4aSElliott Hughes "qCurveTo", 501*e1fe3e4aSElliott Hughes ( 502*e1fe3e4aSElliott Hughes (281, 664), 503*e1fe3e4aSElliott Hughes (261, 687), 504*e1fe3e4aSElliott Hughes (240, 708), 505*e1fe3e4aSElliott Hughes (219, 729), 506*e1fe3e4aSElliott Hughes (196, 749), 507*e1fe3e4aSElliott Hughes (173, 768), 508*e1fe3e4aSElliott Hughes (148, 786), 509*e1fe3e4aSElliott Hughes (136, 794), 510*e1fe3e4aSElliott Hughes ), 511*e1fe3e4aSElliott Hughes ), 512*e1fe3e4aSElliott Hughes ("lineTo", ((69, 727),)), 513*e1fe3e4aSElliott Hughes ( 514*e1fe3e4aSElliott Hughes "qCurveTo", 515*e1fe3e4aSElliott Hughes ( 516*e1fe3e4aSElliott Hughes (81, 719), 517*e1fe3e4aSElliott Hughes (105, 702), 518*e1fe3e4aSElliott Hughes (129, 684), 519*e1fe3e4aSElliott Hughes (151, 665), 520*e1fe3e4aSElliott Hughes (173, 645), 521*e1fe3e4aSElliott Hughes (193, 625), 522*e1fe3e4aSElliott Hughes (213, 604), 523*e1fe3e4aSElliott Hughes (222, 593), 524*e1fe3e4aSElliott Hughes ), 525*e1fe3e4aSElliott Hughes ), 526*e1fe3e4aSElliott Hughes ("closePath", ()), 527*e1fe3e4aSElliott Hughes ("moveTo", ((913, -57),)), 528*e1fe3e4aSElliott Hughes ("lineTo", ((953, 30),)), 529*e1fe3e4aSElliott Hughes ( 530*e1fe3e4aSElliott Hughes "qCurveTo", 531*e1fe3e4aSElliott Hughes ( 532*e1fe3e4aSElliott Hughes (919, 41), 533*e1fe3e4aSElliott Hughes (854, 67), 534*e1fe3e4aSElliott Hughes (790, 98), 535*e1fe3e4aSElliott Hughes (729, 134), 536*e1fe3e4aSElliott Hughes (671, 173), 537*e1fe3e4aSElliott Hughes (616, 217), 538*e1fe3e4aSElliott Hughes (564, 264), 539*e1fe3e4aSElliott Hughes (540, 290), 540*e1fe3e4aSElliott Hughes ), 541*e1fe3e4aSElliott Hughes ), 542*e1fe3e4aSElliott Hughes ("lineTo", ((522, 286),)), 543*e1fe3e4aSElliott Hughes ("qCurveTo", ((511, 267), (498, 235), (493, 213), (492, 206))), 544*e1fe3e4aSElliott Hughes ("lineTo", ((515, 209),)), 545*e1fe3e4aSElliott Hughes ("qCurveTo", ((569, 146), (695, 44), (835, -32), (913, -57))), 546*e1fe3e4aSElliott Hughes ("closePath", ()), 547*e1fe3e4aSElliott Hughes ("moveTo", ((474, 274),)), 548*e1fe3e4aSElliott Hughes ("lineTo", ((452, 284),)), 549*e1fe3e4aSElliott Hughes ( 550*e1fe3e4aSElliott Hughes "qCurveTo", 551*e1fe3e4aSElliott Hughes ( 552*e1fe3e4aSElliott Hughes (428, 260), 553*e1fe3e4aSElliott Hughes (377, 214), 554*e1fe3e4aSElliott Hughes (323, 172), 555*e1fe3e4aSElliott Hughes (266, 135), 556*e1fe3e4aSElliott Hughes (206, 101), 557*e1fe3e4aSElliott Hughes (144, 71), 558*e1fe3e4aSElliott Hughes (80, 46), 559*e1fe3e4aSElliott Hughes (47, 36), 560*e1fe3e4aSElliott Hughes ), 561*e1fe3e4aSElliott Hughes ), 562*e1fe3e4aSElliott Hughes ("lineTo", ((89, -53),)), 563*e1fe3e4aSElliott Hughes ("qCurveTo", ((163, -29), (299, 46), (423, 142), (476, 201))), 564*e1fe3e4aSElliott Hughes ("lineTo", ((498, 196),)), 565*e1fe3e4aSElliott Hughes ("qCurveTo", ((498, 203), (494, 225), (482, 255), (474, 274))), 566*e1fe3e4aSElliott Hughes ("closePath", ()), 567*e1fe3e4aSElliott Hughes ("moveTo", ((450, 250),)), 568*e1fe3e4aSElliott Hughes ("lineTo", ((550, 250),)), 569*e1fe3e4aSElliott Hughes ("lineTo", ((550, 379),)), 570*e1fe3e4aSElliott Hughes ("lineTo", ((450, 379),)), 571*e1fe3e4aSElliott Hughes ("closePath", ()), 572*e1fe3e4aSElliott Hughes ("moveTo", ((68, 215),)), 573*e1fe3e4aSElliott Hughes ("lineTo", ((932, 215),)), 574*e1fe3e4aSElliott Hughes ("lineTo", ((932, 305),)), 575*e1fe3e4aSElliott Hughes ("lineTo", ((68, 305),)), 576*e1fe3e4aSElliott Hughes ("closePath", ()), 577*e1fe3e4aSElliott Hughes ("moveTo", ((450, -71),)), 578*e1fe3e4aSElliott Hughes ("lineTo", ((550, -71),)), 579*e1fe3e4aSElliott Hughes ("lineTo", ((550, -71),)), 580*e1fe3e4aSElliott Hughes ("lineTo", ((550, 267),)), 581*e1fe3e4aSElliott Hughes ("lineTo", ((450, 267),)), 582*e1fe3e4aSElliott Hughes ("lineTo", ((450, -71),)), 583*e1fe3e4aSElliott Hughes ("closePath", ()), 584*e1fe3e4aSElliott Hughes ] 585*e1fe3e4aSElliott Hughes 586*e1fe3e4aSElliott Hughes actual = [ 587*e1fe3e4aSElliott Hughes (op, tuple((otRound(pt[0]), otRound(pt[1])) for pt in args)) 588*e1fe3e4aSElliott Hughes for op, args in actual 589*e1fe3e4aSElliott Hughes ] 590*e1fe3e4aSElliott Hughes 591*e1fe3e4aSElliott Hughes assert actual == expected, (actual, expected) 592*e1fe3e4aSElliott Hughes 593*e1fe3e4aSElliott Hughes pen = RecordingPointPen() 594*e1fe3e4aSElliott Hughes glyph.drawPoints(pen) 595*e1fe3e4aSElliott Hughes assert pen.value 596*e1fe3e4aSElliott Hughes 597*e1fe3e4aSElliott Hughes def test_cubic_glyf(self): 598*e1fe3e4aSElliott Hughes font = TTFont(self.getpath("dot-cubic.ttf")) 599*e1fe3e4aSElliott Hughes glyphset = font.getGlyphSet() 600*e1fe3e4aSElliott Hughes 601*e1fe3e4aSElliott Hughes expected = [ 602*e1fe3e4aSElliott Hughes ("moveTo", ((76, 181),)), 603*e1fe3e4aSElliott Hughes ("curveTo", ((103, 181), (125, 158), (125, 131))), 604*e1fe3e4aSElliott Hughes ("curveTo", ((125, 104), (103, 82), (76, 82))), 605*e1fe3e4aSElliott Hughes ("curveTo", ((48, 82), (26, 104), (26, 131))), 606*e1fe3e4aSElliott Hughes ("curveTo", ((26, 158), (48, 181), (76, 181))), 607*e1fe3e4aSElliott Hughes ("closePath", ()), 608*e1fe3e4aSElliott Hughes ] 609*e1fe3e4aSElliott Hughes 610*e1fe3e4aSElliott Hughes pen = RecordingPen() 611*e1fe3e4aSElliott Hughes glyphset["one"].draw(pen) 612*e1fe3e4aSElliott Hughes assert pen.value == expected 613*e1fe3e4aSElliott Hughes 614*e1fe3e4aSElliott Hughes expectedPoints = [ 615*e1fe3e4aSElliott Hughes ("beginPath", (), {}), 616*e1fe3e4aSElliott Hughes ("addPoint", ((76, 181), "curve", False, None), {}), 617*e1fe3e4aSElliott Hughes ("addPoint", ((103, 181), None, False, None), {}), 618*e1fe3e4aSElliott Hughes ("addPoint", ((125, 158), None, False, None), {}), 619*e1fe3e4aSElliott Hughes ("addPoint", ((125, 104), None, False, None), {}), 620*e1fe3e4aSElliott Hughes ("addPoint", ((103, 82), None, False, None), {}), 621*e1fe3e4aSElliott Hughes ("addPoint", ((76, 82), "curve", False, None), {}), 622*e1fe3e4aSElliott Hughes ("addPoint", ((48, 82), None, False, None), {}), 623*e1fe3e4aSElliott Hughes ("addPoint", ((26, 104), None, False, None), {}), 624*e1fe3e4aSElliott Hughes ("addPoint", ((26, 158), None, False, None), {}), 625*e1fe3e4aSElliott Hughes ("addPoint", ((48, 181), None, False, None), {}), 626*e1fe3e4aSElliott Hughes ("endPath", (), {}), 627*e1fe3e4aSElliott Hughes ] 628*e1fe3e4aSElliott Hughes pen = RecordingPointPen() 629*e1fe3e4aSElliott Hughes glyphset["one"].drawPoints(pen) 630*e1fe3e4aSElliott Hughes assert pen.value == expectedPoints 631*e1fe3e4aSElliott Hughes 632*e1fe3e4aSElliott Hughes pen = RecordingPen() 633*e1fe3e4aSElliott Hughes glyphset["two"].draw(pen) 634*e1fe3e4aSElliott Hughes assert pen.value == expected 635*e1fe3e4aSElliott Hughes 636*e1fe3e4aSElliott Hughes expectedPoints = [ 637*e1fe3e4aSElliott Hughes ("beginPath", (), {}), 638*e1fe3e4aSElliott Hughes ("addPoint", ((26, 158), None, False, None), {}), 639*e1fe3e4aSElliott Hughes ("addPoint", ((48, 181), None, False, None), {}), 640*e1fe3e4aSElliott Hughes ("addPoint", ((76, 181), "curve", False, None), {}), 641*e1fe3e4aSElliott Hughes ("addPoint", ((103, 181), None, False, None), {}), 642*e1fe3e4aSElliott Hughes ("addPoint", ((125, 158), None, False, None), {}), 643*e1fe3e4aSElliott Hughes ("addPoint", ((125, 104), None, False, None), {}), 644*e1fe3e4aSElliott Hughes ("addPoint", ((103, 82), None, False, None), {}), 645*e1fe3e4aSElliott Hughes ("addPoint", ((76, 82), "curve", False, None), {}), 646*e1fe3e4aSElliott Hughes ("addPoint", ((48, 82), None, False, None), {}), 647*e1fe3e4aSElliott Hughes ("addPoint", ((26, 104), None, False, None), {}), 648*e1fe3e4aSElliott Hughes ("endPath", (), {}), 649*e1fe3e4aSElliott Hughes ] 650*e1fe3e4aSElliott Hughes pen = RecordingPointPen() 651*e1fe3e4aSElliott Hughes glyphset["two"].drawPoints(pen) 652*e1fe3e4aSElliott Hughes assert pen.value == expectedPoints 653*e1fe3e4aSElliott Hughes 654*e1fe3e4aSElliott Hughes pen = RecordingPen() 655*e1fe3e4aSElliott Hughes glyphset["three"].draw(pen) 656*e1fe3e4aSElliott Hughes assert pen.value == expected 657*e1fe3e4aSElliott Hughes 658*e1fe3e4aSElliott Hughes expectedPoints = [ 659*e1fe3e4aSElliott Hughes ("beginPath", (), {}), 660*e1fe3e4aSElliott Hughes ("addPoint", ((48, 82), None, False, None), {}), 661*e1fe3e4aSElliott Hughes ("addPoint", ((26, 104), None, False, None), {}), 662*e1fe3e4aSElliott Hughes ("addPoint", ((26, 158), None, False, None), {}), 663*e1fe3e4aSElliott Hughes ("addPoint", ((48, 181), None, False, None), {}), 664*e1fe3e4aSElliott Hughes ("addPoint", ((76, 181), "curve", False, None), {}), 665*e1fe3e4aSElliott Hughes ("addPoint", ((103, 181), None, False, None), {}), 666*e1fe3e4aSElliott Hughes ("addPoint", ((125, 158), None, False, None), {}), 667*e1fe3e4aSElliott Hughes ("addPoint", ((125, 104), None, False, None), {}), 668*e1fe3e4aSElliott Hughes ("addPoint", ((103, 82), None, False, None), {}), 669*e1fe3e4aSElliott Hughes ("addPoint", ((76, 82), "curve", False, None), {}), 670*e1fe3e4aSElliott Hughes ("endPath", (), {}), 671*e1fe3e4aSElliott Hughes ] 672*e1fe3e4aSElliott Hughes pen = RecordingPointPen() 673*e1fe3e4aSElliott Hughes glyphset["three"].drawPoints(pen) 674*e1fe3e4aSElliott Hughes assert pen.value == expectedPoints 675*e1fe3e4aSElliott Hughes 676*e1fe3e4aSElliott Hughes pen = RecordingPen() 677*e1fe3e4aSElliott Hughes glyphset["four"].draw(pen) 678*e1fe3e4aSElliott Hughes assert pen.value == [ 679*e1fe3e4aSElliott Hughes ("moveTo", ((75.5, 181),)), 680*e1fe3e4aSElliott Hughes ("curveTo", ((103, 181), (125, 158), (125, 131))), 681*e1fe3e4aSElliott Hughes ("curveTo", ((125, 104), (103, 82), (75.5, 82))), 682*e1fe3e4aSElliott Hughes ("curveTo", ((48, 82), (26, 104), (26, 131))), 683*e1fe3e4aSElliott Hughes ("curveTo", ((26, 158), (48, 181), (75.5, 181))), 684*e1fe3e4aSElliott Hughes ("closePath", ()), 685*e1fe3e4aSElliott Hughes ] 686*e1fe3e4aSElliott Hughes 687*e1fe3e4aSElliott Hughes # Ouch! We can't represent all-cubic-offcurves in pointPen! 688*e1fe3e4aSElliott Hughes # https://github.com/fonttools/fonttools/issues/3191 689*e1fe3e4aSElliott Hughes expectedPoints = [ 690*e1fe3e4aSElliott Hughes ("beginPath", (), {}), 691*e1fe3e4aSElliott Hughes ("addPoint", ((103, 181), None, False, None), {}), 692*e1fe3e4aSElliott Hughes ("addPoint", ((125, 158), None, False, None), {}), 693*e1fe3e4aSElliott Hughes ("addPoint", ((125, 104), None, False, None), {}), 694*e1fe3e4aSElliott Hughes ("addPoint", ((103, 82), None, False, None), {}), 695*e1fe3e4aSElliott Hughes ("addPoint", ((48, 82), None, False, None), {}), 696*e1fe3e4aSElliott Hughes ("addPoint", ((26, 104), None, False, None), {}), 697*e1fe3e4aSElliott Hughes ("addPoint", ((26, 158), None, False, None), {}), 698*e1fe3e4aSElliott Hughes ("addPoint", ((48, 181), None, False, None), {}), 699*e1fe3e4aSElliott Hughes ("endPath", (), {}), 700*e1fe3e4aSElliott Hughes ] 701*e1fe3e4aSElliott Hughes pen = RecordingPointPen() 702*e1fe3e4aSElliott Hughes glyphset["four"].drawPoints(pen) 703*e1fe3e4aSElliott Hughes print(pen.value) 704*e1fe3e4aSElliott Hughes assert pen.value == expectedPoints 705