From 995912469c43797600286584f929394622b0ace3 Mon Sep 17 00:00:00 2001 From: Knut Nergaard Date: Tue, 3 Sep 2024 01:11:14 +0200 Subject: [PATCH] Add annotations.py. --- Lib/fontParts/base/annotations.py | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Lib/fontParts/base/annotations.py diff --git a/Lib/fontParts/base/annotations.py b/Lib/fontParts/base/annotations.py new file mode 100644 index 00000000..fa0700b5 --- /dev/null +++ b/Lib/fontParts/base/annotations.py @@ -0,0 +1,38 @@ +# pylint: disable=C0103, C0114 + +from __future__ import annotations +from typing import Dict, List, Tuple, TypeVar, Union + +from fontTools.pens.basePen import AbstractPen +from fontTools.pens.pointPen import AbstractPointPen + +# ------------ +# Type Aliases +# ------------ + +# Builtins + +T = TypeVar('T') +CollectionType = Union[List[T], Tuple[T, ...]] +IntFloatType = Union[int, float] + +# FontTools + +PenType = AbstractPen +PointPenType = AbstractPointPen + +# FontParts + +BoundsType = Tuple[IntFloatType, IntFloatType, IntFloatType, IntFloatType] +CharacterMappingType = Dict[int, Tuple[str, ...]] +ColorType = Tuple[IntFloatType, IntFloatType, IntFloatType, IntFloatType] +CoordinateType = Tuple[IntFloatType, IntFloatType] +FactorType = Union[IntFloatType, Tuple[float, float]] +KerningKeyType = Tuple[str, str] +KerningDictType = Dict[KerningKeyType, IntFloatType] +ReverseComponentMappingType = Dict[str, Tuple[str, ...]] +ScaleType = Tuple[IntFloatType, IntFloatType] +TransformationMatrixType = Tuple[ + IntFloatType, IntFloatType, IntFloatType, + IntFloatType, IntFloatType, IntFloatType +]