From 5e141f027b2f9c9a5316c0c28c49bbce3b34680d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 21 Feb 2023 16:52:36 -0700 Subject: [PATCH] [cubic-glyf] Add test for offcurve wrap-around and all-offcurve --- Tests/ttLib/data/dot-cubic.ttf | Bin 0 -> 416 bytes Tests/ttLib/ttGlyphSet_test.py | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Tests/ttLib/data/dot-cubic.ttf diff --git a/Tests/ttLib/data/dot-cubic.ttf b/Tests/ttLib/data/dot-cubic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..229c9e93dc001ba5495cbe487fc95ed019b2b314 GIT binary patch literal 416 zcmZQzWME)mV{l+#Vo*rWsZ6^l>vw^Hfsq9$IwvDFF-69X*9^$c0b;WZpaAQ)|C532 zB|xl_ky}#1tjsV8$bJFDd^!2ai3|Y@WkB{1Am+(UtSDe$XW$01PXMt31IR8WCO^+< z@r&a5ZN4%vGlTRo+$lMH4n#kYW;I}tVhCcWW!MVjvH{%$0YH7Maew82nj?VnQb2i- zNyvZ+EW*mb1(iXU2kDGsm=4wrG64ca7&I7c82o^GV778HFqm(eHl0)B$2s;5ekV=pM literal 0 HcmV?d00001 diff --git a/Tests/ttLib/ttGlyphSet_test.py b/Tests/ttLib/ttGlyphSet_test.py index f6bee1ad7..2579fc1c4 100644 --- a/Tests/ttLib/ttGlyphSet_test.py +++ b/Tests/ttLib/ttGlyphSet_test.py @@ -544,3 +544,38 @@ class TTGlyphSetTest(object): pen = RecordingPointPen() glyph.drawPoints(pen) assert pen.value + + def test_cubic_glyf(self): + font = TTFont(self.getpath("dot-cubic.ttf")) + glyphset = font.getGlyphSet() + + expected = [ + ("moveTo", ((76, 181),)), + ("curveTo", ((103, 181), (125, 158), (125, 131))), + ("curveTo", ((125, 104), (103, 82), (76, 82))), + ("curveTo", ((48, 82), (26, 104), (26, 131))), + ("curveTo", ((26, 158), (48, 181), (76, 181))), + ("closePath", ()), + ] + + pen = RecordingPen() + glyphset["glyph00001"].draw(pen) + assert pen.value == expected + + pen = RecordingPen() + glyphset["glyph00002"].draw(pen) + assert pen.value == expected + + pen = RecordingPen() + glyphset["glyph00003"].draw(pen) + assert pen.value == expected + + pen = RecordingPen() + glyphset["glyph00004"].draw(pen) + assert pen.value == [ + ("curveTo", ((103, 181), (125, 158), (125, 131))), + ("curveTo", ((125, 104), (103, 82), (75.5, 82))), + ("curveTo", ((48, 82), (26, 104), (26, 131))), + ("curveTo", ((26, 158), (48, 181), (75.5, 181))), + ("closePath", ()), + ]