Merge pull request #2825 from fonttools/issue2824

Fix for #2824: fix arguments in calls to (glyf) glyph.draw() and glyph.drawPoints()
This commit is contained in:
Just van Rossum 2022-09-20 11:13:04 +02:00 committed by GitHub
commit f658ca0499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -126,14 +126,14 @@ class _TTGlyphGlyf(_TTGlyph):
how that works.
"""
glyph, offset = self._getGlyphAndOffset()
glyph.draw(pen, offset)
glyph.draw(pen, self.glyphSet.glyfTable, offset)
def drawPoints(self, pen):
"""Draw the glyph onto ``pen``. See fontTools.pens.pointPen for details
how that works.
"""
glyph, offset = self._getGlyphAndOffset()
glyph.drawPoints(pen, offset)
glyph.drawPoints(pen, self.glyphSet.glyfTable, offset)
def _getGlyphAndOffset(self):
if self.glyphSet.location and self.glyphSet.gvarTable is not None:
@ -176,12 +176,12 @@ class _TTGlyphGlyf(_TTGlyph):
glyph = copy(glyfTable[self.name]) # Shallow copy
width, lsb, height, tsb = _setCoordinates(glyph, coordinates, glyfTable)
self.lsb = lsb
self.tsb = tsb
if glyphSet.hvarTable is None:
# no HVAR: let's set metrics from the phantom points
self.width = width
self.lsb = lsb
self.height = height
self.tsb = tsb
return glyph

Binary file not shown.

View File

@ -112,6 +112,18 @@ class TTGlyphSetTest(object):
("closePath", ()),
],
),
(
"issue2824.ttf",
None,
[
("moveTo", ((309, 180),)),
("qCurveTo", ((274, 151), (187, 136), (104, 166), (74, 201))),
("qCurveTo", ((45, 236), (30, 323), (59, 407), (95, 436))),
("qCurveTo", ((130, 466), (217, 480), (301, 451), (330, 415))),
("qCurveTo", ((360, 380), (374, 293), (345, 210), (309, 180))),
("closePath", ()),
],
),
],
)
def test_glyphset(self, fontfile, location, expected):