From e9551c483ac42bea8bd59f0ed09c52fa541bba48 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 15 Dec 2023 19:20:39 -0700 Subject: [PATCH] Remove some more remnants of VarComposites in ttGlyphSet Going to re-add for VARC table. --- Lib/fontTools/ttLib/ttGlyphSet.py | 47 ++----------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/Lib/fontTools/ttLib/ttGlyphSet.py b/Lib/fontTools/ttLib/ttGlyphSet.py index 7cfdfd75f..8f329885e 100644 --- a/Lib/fontTools/ttLib/ttGlyphSet.py +++ b/Lib/fontTools/ttLib/ttGlyphSet.py @@ -30,11 +30,6 @@ class _TTGlyphSet(Mapping): else {} ) self.location = location if location is not None else {} - self.rawLocation = {} # VarComponent-only location - self.originalLocation = location if location is not None else {} - self.depth = 0 - self.locationStack = [] - self.rawLocationStack = [] self.glyphsMapping = glyphsMapping self.hMetrics = font["hmtx"].metrics self.vMetrics = getattr(font.get("vmtx"), "metrics", None) @@ -49,34 +44,6 @@ class _TTGlyphSet(Mapping): ) # TODO VVAR, VORG - @contextmanager - def pushLocation(self, location, reset: bool): - self.locationStack.append(self.location) - self.rawLocationStack.append(self.rawLocation) - if reset: - self.location = self.originalLocation.copy() - self.rawLocation = self.defaultLocationNormalized.copy() - else: - self.location = self.location.copy() - self.rawLocation = {} - self.location.update(location) - self.rawLocation.update(location) - - try: - yield None - finally: - self.location = self.locationStack.pop() - self.rawLocation = self.rawLocationStack.pop() - - @contextmanager - def pushDepth(self): - try: - depth = self.depth - self.depth += 1 - yield depth - finally: - self.depth -= 1 - def __contains__(self, glyphName): return glyphName in self.glyphsMapping @@ -173,24 +140,14 @@ class _TTGlyphGlyf(_TTGlyph): how that works. """ glyph, offset = self._getGlyphAndOffset() - - with self.glyphSet.pushDepth() as depth: - if depth: - offset = 0 # Offset should only apply at top-level - - glyph.draw(pen, self.glyphSet.glyfTable, 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() - - with self.glyphSet.pushDepth() as depth: - if depth: - offset = 0 # Offset should only apply at top-level - - glyph.drawPoints(pen, self.glyphSet.glyfTable, offset) + glyph.drawPoints(pen, self.glyphSet.glyfTable, offset) def _getGlyphAndOffset(self): if self.glyphSet.location and self.glyphSet.gvarTable is not None: