|
| 1 | +# from fontTools.misc.loggingTools |
| 2 | +from abc import ABCMeta, abstractmethod |
| 3 | +from collections.abc import Mapping |
| 4 | +from logging import Logger |
| 5 | +from typing import Protocol |
| 6 | +from typing_extensions import TypeAlias |
| 7 | + |
| 8 | +# from fonttools.ttLib.ttGlyphSet |
| 9 | +class _TTGlyph(Protocol): |
| 10 | + def __init__(self, glyphSet: _TTGlyphSet, glyphName: str) -> None: ... |
| 11 | + def draw(self, pen) -> None: ... |
| 12 | + def drawPoints(self, pen) -> None: ... |
| 13 | + |
| 14 | +_TTGlyphSet: TypeAlias = Mapping[str, _TTGlyph] # Simplified for our needs |
| 15 | + |
| 16 | +# from fontTools.misc.loggingTools |
| 17 | + |
| 18 | +class LogMixin: |
| 19 | + @property |
| 20 | + def log(self) -> Logger: ... |
| 21 | + |
| 22 | +# from fontTools.pens.basePen |
| 23 | +class AbstractPen: |
| 24 | + @abstractmethod |
| 25 | + def moveTo(self, pt: tuple[float, float]) -> None: ... |
| 26 | + @abstractmethod |
| 27 | + def lineTo(self, pt: tuple[float, float]) -> None: ... |
| 28 | + @abstractmethod |
| 29 | + def curveTo(self, *points: tuple[float, float]) -> None: ... |
| 30 | + @abstractmethod |
| 31 | + def qCurveTo(self, *points: tuple[float, float]) -> None: ... |
| 32 | + def closePath(self) -> None: ... |
| 33 | + def endPath(self) -> None: ... |
| 34 | + @abstractmethod |
| 35 | + def addComponent(self, glyphName: str, transformation: tuple[float, float, float, float, float, float]) -> None: ... |
| 36 | + |
| 37 | +class LoggingPen(LogMixin, AbstractPen, metaclass=ABCMeta): ... |
| 38 | + |
| 39 | +class DecomposingPen(LoggingPen, metaclass=ABCMeta): |
| 40 | + skipMissingComponents: bool |
| 41 | + glyphSet: _TTGlyphSet | None |
| 42 | + def __init__(self, glyphSet: _TTGlyphSet | None) -> None: ... |
| 43 | + def addComponent(self, glyphName: str, transformation: tuple[float, float, float, float, float, float]) -> None: ... |
| 44 | + |
| 45 | +class BasePen(DecomposingPen): |
| 46 | + def __init__(self, glyphSet: _TTGlyphSet | None = ...) -> None: ... |
| 47 | + def closePath(self) -> None: ... |
| 48 | + def endPath(self) -> None: ... |
| 49 | + def moveTo(self, pt: tuple[float, float]) -> None: ... |
| 50 | + def lineTo(self, pt: tuple[float, float]) -> None: ... |
| 51 | + def curveTo(self, *points: tuple[float, float]) -> None: ... |
| 52 | + def qCurveTo(self, *points: tuple[float, float]) -> None: ... |
0 commit comments