[ttGlyphSet_test] Add another varComposite test

This one has different characteristics, hitting more code.
This commit is contained in:
Behdad Esfahbod 2023-02-01 18:55:48 -07:00
parent 1d072aa30e
commit 2c2a0964d7
2 changed files with 231 additions and 1 deletions

Binary file not shown.

View File

@ -158,7 +158,7 @@ class TTGlyphSetTest(object):
assert actual == expected, (location, actual, expected)
def test_glyphset_varComposite(self):
def test_glyphset_varComposite1(self):
font = TTFont(self.getpath("varc-ac00-ac01.ttf"))
glyphset = font.getGlyphSet(location={"wght": 600})
@ -249,3 +249,233 @@ class TTGlyphSetTest(object):
]
assert actual == expected, (actual, expected)
def test_glyphset_varComposite2(self):
# This test font has axis variations
font = TTFont(self.getpath("varc-6868.ttf"))
glyphset = font.getGlyphSet(location={"wght": 600})
pen = RecordingPen()
glyph = glyphset["uni6868"]
glyph.draw(pen)
actual = pen.value
expected = [
("moveTo", ((460, 565),)),
(
"qCurveTo",
(
(482, 577),
(526, 603),
(568, 632),
(607, 663),
(644, 698),
(678, 735),
(708, 775),
(721, 796),
),
),
("lineTo", ((632, 835),)),
(
"qCurveTo",
(
(621, 817),
(595, 784),
(566, 753),
(534, 724),
(499, 698),
(462, 675),
(423, 653),
(403, 644),
),
),
("closePath", ()),
("moveTo", ((616, 765),)),
("lineTo", ((590, 682),)),
("lineTo", ((830, 682),)),
("lineTo", ((833, 682),)),
("lineTo", ((828, 693),)),
(
"qCurveTo",
(
(817, 671),
(775, 620),
(709, 571),
(615, 525),
(492, 490),
(413, 480),
),
),
("lineTo", ((454, 386),)),
(
"qCurveTo",
(
(544, 403),
(687, 455),
(798, 519),
(877, 590),
(926, 655),
(937, 684),
),
),
("lineTo", ((937, 765),)),
("closePath", ()),
("moveTo", ((723, 555),)),
(
"qCurveTo",
(
(713, 563),
(693, 579),
(672, 595),
(651, 610),
(629, 625),
(606, 638),
(583, 651),
(572, 657),
),
),
("lineTo", ((514, 590),)),
(
"qCurveTo",
(
(525, 584),
(547, 572),
(568, 559),
(589, 545),
(609, 531),
(629, 516),
(648, 500),
(657, 492),
),
),
("closePath", ()),
("moveTo", ((387, 375),)),
("lineTo", ((387, 830),)),
("lineTo", ((289, 830),)),
("lineTo", ((289, 375),)),
("closePath", ()),
("moveTo", ((96, 383),)),
(
"qCurveTo",
(
(116, 390),
(156, 408),
(194, 427),
(231, 449),
(268, 472),
(302, 497),
(335, 525),
(351, 539),
),
),
("lineTo", ((307, 610),)),
(
"qCurveTo",
(
(291, 597),
(257, 572),
(221, 549),
(185, 528),
(147, 509),
(108, 492),
(69, 476),
(48, 469),
),
),
("closePath", ()),
("moveTo", ((290, 653),)),
(
"qCurveTo",
(
(281, 664),
(261, 687),
(240, 708),
(219, 729),
(196, 749),
(173, 768),
(148, 786),
(136, 794),
),
),
("lineTo", ((69, 727),)),
(
"qCurveTo",
(
(81, 719),
(105, 702),
(129, 684),
(151, 665),
(173, 645),
(193, 625),
(213, 604),
(222, 593),
),
),
("closePath", ()),
("moveTo", ((913, -57),)),
("lineTo", ((953, 30),)),
(
"qCurveTo",
(
(919, 41),
(854, 67),
(790, 98),
(729, 134),
(671, 173),
(616, 217),
(564, 264),
(540, 290),
),
),
("lineTo", ((522, 286),)),
("qCurveTo", ((511, 267), (498, 235), (493, 213), (492, 206))),
("lineTo", ((515, 209),)),
("qCurveTo", ((569, 146), (695, 44), (835, -32), (913, -57))),
("closePath", ()),
("moveTo", ((474, 274),)),
("lineTo", ((452, 284),)),
(
"qCurveTo",
(
(428, 260),
(377, 214),
(323, 172),
(266, 135),
(206, 101),
(144, 71),
(80, 46),
(47, 36),
),
),
("lineTo", ((89, -53),)),
("qCurveTo", ((163, -29), (299, 46), (423, 142), (476, 201))),
("lineTo", ((498, 196),)),
("qCurveTo", ((498, 203), (494, 225), (482, 255), (474, 274))),
("closePath", ()),
("moveTo", ((450, 250),)),
("lineTo", ((550, 250),)),
("lineTo", ((550, 379),)),
("lineTo", ((450, 379),)),
("closePath", ()),
("moveTo", ((68, 215),)),
("lineTo", ((932, 215),)),
("lineTo", ((932, 305),)),
("lineTo", ((68, 305),)),
("closePath", ()),
("moveTo", ((450, -71),)),
("lineTo", ((550, -71),)),
("lineTo", ((550, -71),)),
("lineTo", ((550, 267),)),
("lineTo", ((450, 267),)),
("lineTo", ((450, -71),)),
("closePath", ()),
]
actual = [
(op, tuple((otRound(pt[0]), otRound(pt[1])) for pt in args))
for op, args in actual
]
assert actual == expected, (actual, expected)