diff --git a/Lib/fontTools/ttLib/ttGlyphSet.py b/Lib/fontTools/ttLib/ttGlyphSet.py index 1ca7e2e82..5bf91dff8 100644 --- a/Lib/fontTools/ttLib/ttGlyphSet.py +++ b/Lib/fontTools/ttLib/ttGlyphSet.py @@ -1,5 +1,6 @@ """GlyphSets returned by a TTFont.""" +from abc import ABCMeta, abstractmethod from collections.abc import Mapping from copy import copy from fontTools.misc.fixedTools import otRound @@ -75,7 +76,7 @@ class _TTGlyphSetCFF(_TTGlyphSet): return _TTGlyphCFF(self, glyphName) -class _TTGlyph: +class _TTGlyph(metaclass=ABCMeta): """Glyph object that supports the Pen protocol, meaning that it has .draw() and .drawPoints() methods that take a pen object as their only @@ -103,6 +104,20 @@ class _TTGlyph: self.width += glyphSet.hvarInstancer[varidx] # TODO: VVAR/VORG + @abstractmethod + def draw(self, pen): + """Draw the glyph onto ``pen``. See fontTools.pens.basePen for details + how that works. + """ + raise NotImplementedError + + @abstractmethod + def drawPoints(self, pen): + """Draw the glyph onto ``pen``. See fontTools.pens.pointPen for details + how that works. + """ + raise NotImplementedError + class _TTGlyphGlyf(_TTGlyph): def draw(self, pen):