-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Any subclassing in
fpdf2
(#9536)
- Loading branch information
Showing
3 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# from fontTools.misc.loggingTools | ||
from abc import ABCMeta, abstractmethod | ||
from collections.abc import Mapping | ||
from logging import Logger | ||
from typing import Protocol | ||
from typing_extensions import TypeAlias | ||
|
||
# from fonttools.ttLib.ttGlyphSet | ||
class _TTGlyph(Protocol): | ||
def __init__(self, glyphSet: _TTGlyphSet, glyphName: str) -> None: ... | ||
def draw(self, pen) -> None: ... | ||
def drawPoints(self, pen) -> None: ... | ||
|
||
_TTGlyphSet: TypeAlias = Mapping[str, _TTGlyph] # Simplified for our needs | ||
|
||
# from fontTools.misc.loggingTools | ||
|
||
class LogMixin: | ||
@property | ||
def log(self) -> Logger: ... | ||
|
||
# from fontTools.pens.basePen | ||
class AbstractPen: | ||
@abstractmethod | ||
def moveTo(self, pt: tuple[float, float]) -> None: ... | ||
@abstractmethod | ||
def lineTo(self, pt: tuple[float, float]) -> None: ... | ||
@abstractmethod | ||
def curveTo(self, *points: tuple[float, float]) -> None: ... | ||
@abstractmethod | ||
def qCurveTo(self, *points: tuple[float, float]) -> None: ... | ||
def closePath(self) -> None: ... | ||
def endPath(self) -> None: ... | ||
@abstractmethod | ||
def addComponent(self, glyphName: str, transformation: tuple[float, float, float, float, float, float]) -> None: ... | ||
|
||
class LoggingPen(LogMixin, AbstractPen, metaclass=ABCMeta): ... | ||
|
||
class DecomposingPen(LoggingPen, metaclass=ABCMeta): | ||
skipMissingComponents: bool | ||
glyphSet: _TTGlyphSet | None | ||
def __init__(self, glyphSet: _TTGlyphSet | None) -> None: ... | ||
def addComponent(self, glyphName: str, transformation: tuple[float, float, float, float, float, float]) -> None: ... | ||
|
||
class BasePen(DecomposingPen): | ||
def __init__(self, glyphSet: _TTGlyphSet | None = ...) -> None: ... | ||
def closePath(self) -> None: ... | ||
def endPath(self) -> None: ... | ||
def moveTo(self, pt: tuple[float, float]) -> None: ... | ||
def lineTo(self, pt: tuple[float, float]) -> None: ... | ||
def curveTo(self, *points: tuple[float, float]) -> None: ... | ||
def qCurveTo(self, *points: tuple[float, float]) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters