diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__init__.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/__init__.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3418fc93771a11f79704569fbf6ba03b8d15fc5f Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/__init__.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/builder.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/builder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e0baf57795691f6774100b9f050606f5b398e1e Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/builder.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/errors.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/errors.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a2a3ac0dc822ea7b8109ff190fefdfe2792aa20 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/errors.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/geometry.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/geometry.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9314e8fde7c034dbb32abf06d02d46b24b41f38c Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/geometry.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/table_builder.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/table_builder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40eae856c49987d8f73cb259e620768d018d0cbf Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/table_builder.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/unbuilder.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/unbuilder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36f9051182cee4c2425ee8e5811f8374664aee69 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/__pycache__/unbuilder.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/builder.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/builder.py new file mode 100644 index 0000000000000000000000000000000000000000..6e45e7a885003764c7092a377abb87f73bca1008 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/builder.py @@ -0,0 +1,664 @@ +""" +colorLib.builder: Build COLR/CPAL tables from scratch + +""" + +import collections +import copy +import enum +from functools import partial +from math import ceil, log +from typing import ( + Any, + Dict, + Generator, + Iterable, + List, + Mapping, + Optional, + Sequence, + Tuple, + Type, + TypeVar, + Union, +) +from fontTools.misc.arrayTools import intRect +from fontTools.misc.fixedTools import fixedToFloat +from fontTools.misc.treeTools import build_n_ary_tree +from fontTools.ttLib.tables import C_O_L_R_ +from fontTools.ttLib.tables import C_P_A_L_ +from fontTools.ttLib.tables import _n_a_m_e +from fontTools.ttLib.tables import otTables as ot +from fontTools.ttLib.tables.otTables import ExtendMode, CompositeMode +from .errors import ColorLibError +from .geometry import round_start_circle_stable_containment +from .table_builder import BuildCallback, TableBuilder + + +# TODO move type aliases to colorLib.types? +T = TypeVar("T") +_Kwargs = Mapping[str, Any] +_PaintInput = Union[int, _Kwargs, ot.Paint, Tuple[str, "_PaintInput"]] +_PaintInputList = Sequence[_PaintInput] +_ColorGlyphsDict = Dict[str, Union[_PaintInputList, _PaintInput]] +_ColorGlyphsV0Dict = Dict[str, Sequence[Tuple[str, int]]] +_ClipBoxInput = Union[ + Tuple[int, int, int, int, int], # format 1, variable + Tuple[int, int, int, int], # format 0, non-variable + ot.ClipBox, +] + + +MAX_PAINT_COLR_LAYER_COUNT = 255 +_DEFAULT_ALPHA = 1.0 +_MAX_REUSE_LEN = 32 + + +def _beforeBuildPaintRadialGradient(paint, source): + x0 = source["x0"] + y0 = source["y0"] + r0 = source["r0"] + x1 = source["x1"] + y1 = source["y1"] + r1 = source["r1"] + + # TODO apparently no builder_test confirms this works (?) + + # avoid abrupt change after rounding when c0 is near c1's perimeter + c = round_start_circle_stable_containment((x0, y0), r0, (x1, y1), r1) + x0, y0 = c.centre + r0 = c.radius + + # update source to ensure paint is built with corrected values + source["x0"] = x0 + source["y0"] = y0 + source["r0"] = r0 + source["x1"] = x1 + source["y1"] = y1 + source["r1"] = r1 + + return paint, source + + +def _defaultColorStop(): + colorStop = ot.ColorStop() + colorStop.Alpha = _DEFAULT_ALPHA + return colorStop + + +def _defaultVarColorStop(): + colorStop = ot.VarColorStop() + colorStop.Alpha = _DEFAULT_ALPHA + return colorStop + + +def _defaultColorLine(): + colorLine = ot.ColorLine() + colorLine.Extend = ExtendMode.PAD + return colorLine + + +def _defaultVarColorLine(): + colorLine = ot.VarColorLine() + colorLine.Extend = ExtendMode.PAD + return colorLine + + +def _defaultPaintSolid(): + paint = ot.Paint() + paint.Alpha = _DEFAULT_ALPHA + return paint + + +def _buildPaintCallbacks(): + return { + ( + BuildCallback.BEFORE_BUILD, + ot.Paint, + ot.PaintFormat.PaintRadialGradient, + ): _beforeBuildPaintRadialGradient, + ( + BuildCallback.BEFORE_BUILD, + ot.Paint, + ot.PaintFormat.PaintVarRadialGradient, + ): _beforeBuildPaintRadialGradient, + (BuildCallback.CREATE_DEFAULT, ot.ColorStop): _defaultColorStop, + (BuildCallback.CREATE_DEFAULT, ot.VarColorStop): _defaultVarColorStop, + (BuildCallback.CREATE_DEFAULT, ot.ColorLine): _defaultColorLine, + (BuildCallback.CREATE_DEFAULT, ot.VarColorLine): _defaultVarColorLine, + ( + BuildCallback.CREATE_DEFAULT, + ot.Paint, + ot.PaintFormat.PaintSolid, + ): _defaultPaintSolid, + ( + BuildCallback.CREATE_DEFAULT, + ot.Paint, + ot.PaintFormat.PaintVarSolid, + ): _defaultPaintSolid, + } + + +def populateCOLRv0( + table: ot.COLR, + colorGlyphsV0: _ColorGlyphsV0Dict, + glyphMap: Optional[Mapping[str, int]] = None, +): + """Build v0 color layers and add to existing COLR table. + + Args: + table: a raw ``otTables.COLR()`` object (not ttLib's ``table_C_O_L_R_``). + colorGlyphsV0: map of base glyph names to lists of (layer glyph names, + color palette index) tuples. Can be empty. + glyphMap: a map from glyph names to glyph indices, as returned from + ``TTFont.getReverseGlyphMap()``, to optionally sort base records by GID. + """ + if glyphMap is not None: + colorGlyphItems = sorted( + colorGlyphsV0.items(), key=lambda item: glyphMap[item[0]] + ) + else: + colorGlyphItems = colorGlyphsV0.items() + baseGlyphRecords = [] + layerRecords = [] + for baseGlyph, layers in colorGlyphItems: + baseRec = ot.BaseGlyphRecord() + baseRec.BaseGlyph = baseGlyph + baseRec.FirstLayerIndex = len(layerRecords) + baseRec.NumLayers = len(layers) + baseGlyphRecords.append(baseRec) + + for layerGlyph, paletteIndex in layers: + layerRec = ot.LayerRecord() + layerRec.LayerGlyph = layerGlyph + layerRec.PaletteIndex = paletteIndex + layerRecords.append(layerRec) + + table.BaseGlyphRecordArray = table.LayerRecordArray = None + if baseGlyphRecords: + table.BaseGlyphRecordArray = ot.BaseGlyphRecordArray() + table.BaseGlyphRecordArray.BaseGlyphRecord = baseGlyphRecords + if layerRecords: + table.LayerRecordArray = ot.LayerRecordArray() + table.LayerRecordArray.LayerRecord = layerRecords + table.BaseGlyphRecordCount = len(baseGlyphRecords) + table.LayerRecordCount = len(layerRecords) + + +def buildCOLR( + colorGlyphs: _ColorGlyphsDict, + version: Optional[int] = None, + *, + glyphMap: Optional[Mapping[str, int]] = None, + varStore: Optional[ot.VarStore] = None, + varIndexMap: Optional[ot.DeltaSetIndexMap] = None, + clipBoxes: Optional[Dict[str, _ClipBoxInput]] = None, + allowLayerReuse: bool = True, +) -> C_O_L_R_.table_C_O_L_R_: + """Build COLR table from color layers mapping. + + Args: + + colorGlyphs: map of base glyph name to, either list of (layer glyph name, + color palette index) tuples for COLRv0; or a single ``Paint`` (dict) or + list of ``Paint`` for COLRv1. + version: the version of COLR table. If None, the version is determined + by the presence of COLRv1 paints or variation data (varStore), which + require version 1; otherwise, if all base glyphs use only simple color + layers, version 0 is used. + glyphMap: a map from glyph names to glyph indices, as returned from + TTFont.getReverseGlyphMap(), to optionally sort base records by GID. + varStore: Optional ItemVarationStore for deltas associated with v1 layer. + varIndexMap: Optional DeltaSetIndexMap for deltas associated with v1 layer. + clipBoxes: Optional map of base glyph name to clip box 4- or 5-tuples: + (xMin, yMin, xMax, yMax) or (xMin, yMin, xMax, yMax, varIndexBase). + + Returns: + A new COLR table. + """ + self = C_O_L_R_.table_C_O_L_R_() + + if varStore is not None and version == 0: + raise ValueError("Can't add VarStore to COLRv0") + + if version in (None, 0) and not varStore: + # split color glyphs into v0 and v1 and encode separately + colorGlyphsV0, colorGlyphsV1 = _split_color_glyphs_by_version(colorGlyphs) + if version == 0 and colorGlyphsV1: + raise ValueError("Can't encode COLRv1 glyphs in COLRv0") + else: + # unless explicitly requested for v1 or have variations, in which case + # we encode all color glyph as v1 + colorGlyphsV0, colorGlyphsV1 = {}, colorGlyphs + + colr = ot.COLR() + + populateCOLRv0(colr, colorGlyphsV0, glyphMap) + + colr.LayerList, colr.BaseGlyphList = buildColrV1( + colorGlyphsV1, + glyphMap, + allowLayerReuse=allowLayerReuse, + ) + + if version is None: + version = 1 if (varStore or colorGlyphsV1) else 0 + elif version not in (0, 1): + raise NotImplementedError(version) + self.version = colr.Version = version + + if version == 0: + self.ColorLayers = self._decompileColorLayersV0(colr) + else: + colr.ClipList = buildClipList(clipBoxes) if clipBoxes else None + colr.VarIndexMap = varIndexMap + colr.VarStore = varStore + self.table = colr + + return self + + +def buildClipList(clipBoxes: Dict[str, _ClipBoxInput]) -> ot.ClipList: + clipList = ot.ClipList() + clipList.Format = 1 + clipList.clips = {name: buildClipBox(box) for name, box in clipBoxes.items()} + return clipList + + +def buildClipBox(clipBox: _ClipBoxInput) -> ot.ClipBox: + if isinstance(clipBox, ot.ClipBox): + return clipBox + n = len(clipBox) + clip = ot.ClipBox() + if n not in (4, 5): + raise ValueError(f"Invalid ClipBox: expected 4 or 5 values, found {n}") + clip.xMin, clip.yMin, clip.xMax, clip.yMax = intRect(clipBox[:4]) + clip.Format = int(n == 5) + 1 + if n == 5: + clip.VarIndexBase = int(clipBox[4]) + return clip + + +class ColorPaletteType(enum.IntFlag): + USABLE_WITH_LIGHT_BACKGROUND = 0x0001 + USABLE_WITH_DARK_BACKGROUND = 0x0002 + + @classmethod + def _missing_(cls, value): + # enforce reserved bits + if isinstance(value, int) and (value < 0 or value & 0xFFFC != 0): + raise ValueError(f"{value} is not a valid {cls.__name__}") + return super()._missing_(value) + + +# None, 'abc' or {'en': 'abc', 'de': 'xyz'} +_OptionalLocalizedString = Union[None, str, Dict[str, str]] + + +def buildPaletteLabels( + labels: Iterable[_OptionalLocalizedString], nameTable: _n_a_m_e.table__n_a_m_e +) -> List[Optional[int]]: + return [ + ( + nameTable.addMultilingualName(l, mac=False) + if isinstance(l, dict) + else ( + C_P_A_L_.table_C_P_A_L_.NO_NAME_ID + if l is None + else nameTable.addMultilingualName({"en": l}, mac=False) + ) + ) + for l in labels + ] + + +def buildCPAL( + palettes: Sequence[Sequence[Tuple[float, float, float, float]]], + paletteTypes: Optional[Sequence[ColorPaletteType]] = None, + paletteLabels: Optional[Sequence[_OptionalLocalizedString]] = None, + paletteEntryLabels: Optional[Sequence[_OptionalLocalizedString]] = None, + nameTable: Optional[_n_a_m_e.table__n_a_m_e] = None, +) -> C_P_A_L_.table_C_P_A_L_: + """Build CPAL table from list of color palettes. + + Args: + palettes: list of lists of colors encoded as tuples of (R, G, B, A) floats + in the range [0..1]. + paletteTypes: optional list of ColorPaletteType, one for each palette. + paletteLabels: optional list of palette labels. Each lable can be either: + None (no label), a string (for for default English labels), or a + localized string (as a dict keyed with BCP47 language codes). + paletteEntryLabels: optional list of palette entry labels, one for each + palette entry (see paletteLabels). + nameTable: optional name table where to store palette and palette entry + labels. Required if either paletteLabels or paletteEntryLabels is set. + + Return: + A new CPAL v0 or v1 table, if custom palette types or labels are specified. + """ + if len({len(p) for p in palettes}) != 1: + raise ColorLibError("color palettes have different lengths") + + if (paletteLabels or paletteEntryLabels) and not nameTable: + raise TypeError( + "nameTable is required if palette or palette entries have labels" + ) + + cpal = C_P_A_L_.table_C_P_A_L_() + cpal.numPaletteEntries = len(palettes[0]) + + cpal.palettes = [] + for i, palette in enumerate(palettes): + colors = [] + for j, color in enumerate(palette): + if not isinstance(color, tuple) or len(color) != 4: + raise ColorLibError( + f"In palette[{i}][{j}]: expected (R, G, B, A) tuple, got {color!r}" + ) + if any(v > 1 or v < 0 for v in color): + raise ColorLibError( + f"palette[{i}][{j}] has invalid out-of-range [0..1] color: {color!r}" + ) + # input colors are RGBA, CPAL encodes them as BGRA + red, green, blue, alpha = color + colors.append( + C_P_A_L_.Color(*(round(v * 255) for v in (blue, green, red, alpha))) + ) + cpal.palettes.append(colors) + + if any(v is not None for v in (paletteTypes, paletteLabels, paletteEntryLabels)): + cpal.version = 1 + + if paletteTypes is not None: + if len(paletteTypes) != len(palettes): + raise ColorLibError( + f"Expected {len(palettes)} paletteTypes, got {len(paletteTypes)}" + ) + cpal.paletteTypes = [ColorPaletteType(t).value for t in paletteTypes] + else: + cpal.paletteTypes = [C_P_A_L_.table_C_P_A_L_.DEFAULT_PALETTE_TYPE] * len( + palettes + ) + + if paletteLabels is not None: + if len(paletteLabels) != len(palettes): + raise ColorLibError( + f"Expected {len(palettes)} paletteLabels, got {len(paletteLabels)}" + ) + cpal.paletteLabels = buildPaletteLabels(paletteLabels, nameTable) + else: + cpal.paletteLabels = [C_P_A_L_.table_C_P_A_L_.NO_NAME_ID] * len(palettes) + + if paletteEntryLabels is not None: + if len(paletteEntryLabels) != cpal.numPaletteEntries: + raise ColorLibError( + f"Expected {cpal.numPaletteEntries} paletteEntryLabels, " + f"got {len(paletteEntryLabels)}" + ) + cpal.paletteEntryLabels = buildPaletteLabels(paletteEntryLabels, nameTable) + else: + cpal.paletteEntryLabels = [ + C_P_A_L_.table_C_P_A_L_.NO_NAME_ID + ] * cpal.numPaletteEntries + else: + cpal.version = 0 + + return cpal + + +# COLR v1 tables +# See draft proposal at: https://github.com/googlefonts/colr-gradients-spec + + +def _is_colrv0_layer(layer: Any) -> bool: + # Consider as COLRv0 layer any sequence of length 2 (be it tuple or list) in which + # the first element is a str (the layerGlyph) and the second element is an int + # (CPAL paletteIndex). + # https://github.com/googlefonts/ufo2ft/issues/426 + try: + layerGlyph, paletteIndex = layer + except (TypeError, ValueError): + return False + else: + return isinstance(layerGlyph, str) and isinstance(paletteIndex, int) + + +def _split_color_glyphs_by_version( + colorGlyphs: _ColorGlyphsDict, +) -> Tuple[_ColorGlyphsV0Dict, _ColorGlyphsDict]: + colorGlyphsV0 = {} + colorGlyphsV1 = {} + for baseGlyph, layers in colorGlyphs.items(): + if all(_is_colrv0_layer(l) for l in layers): + colorGlyphsV0[baseGlyph] = layers + else: + colorGlyphsV1[baseGlyph] = layers + + # sanity check + assert set(colorGlyphs) == (set(colorGlyphsV0) | set(colorGlyphsV1)) + + return colorGlyphsV0, colorGlyphsV1 + + +def _reuse_ranges(num_layers: int) -> Generator[Tuple[int, int], None, None]: + # TODO feels like something itertools might have already + for lbound in range(num_layers): + # Reuse of very large #s of layers is relatively unlikely + # +2: we want sequences of at least 2 + # otData handles single-record duplication + for ubound in range( + lbound + 2, min(num_layers + 1, lbound + 2 + _MAX_REUSE_LEN) + ): + yield (lbound, ubound) + + +class LayerReuseCache: + reusePool: Mapping[Tuple[Any, ...], int] + tuples: Mapping[int, Tuple[Any, ...]] + keepAlive: List[ot.Paint] # we need id to remain valid + + def __init__(self): + self.reusePool = {} + self.tuples = {} + self.keepAlive = [] + + def _paint_tuple(self, paint: ot.Paint): + # start simple, who even cares about cyclic graphs or interesting field types + def _tuple_safe(value): + if isinstance(value, enum.Enum): + return value + elif hasattr(value, "__dict__"): + return tuple( + (k, _tuple_safe(v)) for k, v in sorted(value.__dict__.items()) + ) + elif isinstance(value, collections.abc.MutableSequence): + return tuple(_tuple_safe(e) for e in value) + return value + + # Cache the tuples for individual Paint instead of the whole sequence + # because the seq could be a transient slice + result = self.tuples.get(id(paint), None) + if result is None: + result = _tuple_safe(paint) + self.tuples[id(paint)] = result + self.keepAlive.append(paint) + return result + + def _as_tuple(self, paints: Sequence[ot.Paint]) -> Tuple[Any, ...]: + return tuple(self._paint_tuple(p) for p in paints) + + def try_reuse(self, layers: List[ot.Paint]) -> List[ot.Paint]: + found_reuse = True + while found_reuse: + found_reuse = False + + ranges = sorted( + _reuse_ranges(len(layers)), + key=lambda t: (t[1] - t[0], t[1], t[0]), + reverse=True, + ) + for lbound, ubound in ranges: + reuse_lbound = self.reusePool.get( + self._as_tuple(layers[lbound:ubound]), -1 + ) + if reuse_lbound == -1: + continue + new_slice = ot.Paint() + new_slice.Format = int(ot.PaintFormat.PaintColrLayers) + new_slice.NumLayers = ubound - lbound + new_slice.FirstLayerIndex = reuse_lbound + layers = layers[:lbound] + [new_slice] + layers[ubound:] + found_reuse = True + break + return layers + + def add(self, layers: List[ot.Paint], first_layer_index: int): + for lbound, ubound in _reuse_ranges(len(layers)): + self.reusePool[self._as_tuple(layers[lbound:ubound])] = ( + lbound + first_layer_index + ) + + +class LayerListBuilder: + layers: List[ot.Paint] + cache: LayerReuseCache + allowLayerReuse: bool + + def __init__(self, *, allowLayerReuse=True): + self.layers = [] + if allowLayerReuse: + self.cache = LayerReuseCache() + else: + self.cache = None + + # We need to intercept construction of PaintColrLayers + callbacks = _buildPaintCallbacks() + callbacks[ + ( + BuildCallback.BEFORE_BUILD, + ot.Paint, + ot.PaintFormat.PaintColrLayers, + ) + ] = self._beforeBuildPaintColrLayers + self.tableBuilder = TableBuilder(callbacks) + + # COLR layers is unusual in that it modifies shared state + # so we need a callback into an object + def _beforeBuildPaintColrLayers(self, dest, source): + # Sketchy gymnastics: a sequence input will have dropped it's layers + # into NumLayers; get it back + if isinstance(source.get("NumLayers", None), collections.abc.Sequence): + layers = source["NumLayers"] + else: + layers = source["Layers"] + + # Convert maps seqs or whatever into typed objects + layers = [self.buildPaint(l) for l in layers] + + # No reason to have a colr layers with just one entry + if len(layers) == 1: + return layers[0], {} + + if self.cache is not None: + # Look for reuse, with preference to longer sequences + # This may make the layer list smaller + layers = self.cache.try_reuse(layers) + + # The layer list is now final; if it's too big we need to tree it + is_tree = len(layers) > MAX_PAINT_COLR_LAYER_COUNT + layers = build_n_ary_tree(layers, n=MAX_PAINT_COLR_LAYER_COUNT) + + # We now have a tree of sequences with Paint leaves. + # Convert the sequences into PaintColrLayers. + def listToColrLayers(layer): + if isinstance(layer, collections.abc.Sequence): + return self.buildPaint( + { + "Format": ot.PaintFormat.PaintColrLayers, + "Layers": [listToColrLayers(l) for l in layer], + } + ) + return layer + + layers = [listToColrLayers(l) for l in layers] + + # No reason to have a colr layers with just one entry + if len(layers) == 1: + return layers[0], {} + + paint = ot.Paint() + paint.Format = int(ot.PaintFormat.PaintColrLayers) + paint.NumLayers = len(layers) + paint.FirstLayerIndex = len(self.layers) + self.layers.extend(layers) + + # Register our parts for reuse provided we aren't a tree + # If we are a tree the leaves registered for reuse and that will suffice + if self.cache is not None and not is_tree: + self.cache.add(layers, paint.FirstLayerIndex) + + # we've fully built dest; empty source prevents generalized build from kicking in + return paint, {} + + def buildPaint(self, paint: _PaintInput) -> ot.Paint: + return self.tableBuilder.build(ot.Paint, paint) + + def build(self) -> Optional[ot.LayerList]: + if not self.layers: + return None + layers = ot.LayerList() + layers.LayerCount = len(self.layers) + layers.Paint = self.layers + return layers + + +def buildBaseGlyphPaintRecord( + baseGlyph: str, layerBuilder: LayerListBuilder, paint: _PaintInput +) -> ot.BaseGlyphList: + self = ot.BaseGlyphPaintRecord() + self.BaseGlyph = baseGlyph + self.Paint = layerBuilder.buildPaint(paint) + return self + + +def _format_glyph_errors(errors: Mapping[str, Exception]) -> str: + lines = [] + for baseGlyph, error in sorted(errors.items()): + lines.append(f" {baseGlyph} => {type(error).__name__}: {error}") + return "\n".join(lines) + + +def buildColrV1( + colorGlyphs: _ColorGlyphsDict, + glyphMap: Optional[Mapping[str, int]] = None, + *, + allowLayerReuse: bool = True, +) -> Tuple[Optional[ot.LayerList], ot.BaseGlyphList]: + if glyphMap is not None: + colorGlyphItems = sorted( + colorGlyphs.items(), key=lambda item: glyphMap[item[0]] + ) + else: + colorGlyphItems = colorGlyphs.items() + + errors = {} + baseGlyphs = [] + layerBuilder = LayerListBuilder(allowLayerReuse=allowLayerReuse) + for baseGlyph, paint in colorGlyphItems: + try: + baseGlyphs.append(buildBaseGlyphPaintRecord(baseGlyph, layerBuilder, paint)) + + except (ColorLibError, OverflowError, ValueError, TypeError) as e: + errors[baseGlyph] = e + + if errors: + failed_glyphs = _format_glyph_errors(errors) + exc = ColorLibError(f"Failed to build BaseGlyphList:\n{failed_glyphs}") + exc.errors = errors + raise exc from next(iter(errors.values())) + + layers = layerBuilder.build() + glyphs = ot.BaseGlyphList() + glyphs.BaseGlyphCount = len(baseGlyphs) + glyphs.BaseGlyphPaintRecord = baseGlyphs + return (layers, glyphs) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/errors.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..18cbebbaf91ff7d5a515321a006be3eb1d83faaf --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/errors.py @@ -0,0 +1,2 @@ +class ColorLibError(Exception): + pass diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/geometry.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/geometry.py new file mode 100644 index 0000000000000000000000000000000000000000..1ce161bfa117df1632b507d161f0dd4abb633bcc --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/geometry.py @@ -0,0 +1,143 @@ +"""Helpers for manipulating 2D points and vectors in COLR table.""" + +from math import copysign, cos, hypot, isclose, pi +from fontTools.misc.roundTools import otRound + + +def _vector_between(origin, target): + return (target[0] - origin[0], target[1] - origin[1]) + + +def _round_point(pt): + return (otRound(pt[0]), otRound(pt[1])) + + +def _unit_vector(vec): + length = hypot(*vec) + if length == 0: + return None + return (vec[0] / length, vec[1] / length) + + +_CIRCLE_INSIDE_TOLERANCE = 1e-4 + + +# The unit vector's X and Y components are respectively +# U = (cos(α), sin(α)) +# where α is the angle between the unit vector and the positive x axis. +_UNIT_VECTOR_THRESHOLD = cos(3 / 8 * pi) # == sin(1/8 * pi) == 0.38268343236508984 + + +def _rounding_offset(direction): + # Return 2-tuple of -/+ 1.0 or 0.0 approximately based on the direction vector. + # We divide the unit circle in 8 equal slices oriented towards the cardinal + # (N, E, S, W) and intermediate (NE, SE, SW, NW) directions. To each slice we + # map one of the possible cases: -1, 0, +1 for either X and Y coordinate. + # E.g. Return (+1.0, -1.0) if unit vector is oriented towards SE, or + # (-1.0, 0.0) if it's pointing West, etc. + uv = _unit_vector(direction) + if not uv: + return (0, 0) + + result = [] + for uv_component in uv: + if -_UNIT_VECTOR_THRESHOLD <= uv_component < _UNIT_VECTOR_THRESHOLD: + # unit vector component near 0: direction almost orthogonal to the + # direction of the current axis, thus keep coordinate unchanged + result.append(0) + else: + # nudge coord by +/- 1.0 in direction of unit vector + result.append(copysign(1.0, uv_component)) + return tuple(result) + + +class Circle: + def __init__(self, centre, radius): + self.centre = centre + self.radius = radius + + def __repr__(self): + return f"Circle(centre={self.centre}, radius={self.radius})" + + def round(self): + return Circle(_round_point(self.centre), otRound(self.radius)) + + def inside(self, outer_circle, tolerance=_CIRCLE_INSIDE_TOLERANCE): + dist = self.radius + hypot(*_vector_between(self.centre, outer_circle.centre)) + return ( + isclose(outer_circle.radius, dist, rel_tol=_CIRCLE_INSIDE_TOLERANCE) + or outer_circle.radius > dist + ) + + def concentric(self, other): + return self.centre == other.centre + + def move(self, dx, dy): + self.centre = (self.centre[0] + dx, self.centre[1] + dy) + + +def round_start_circle_stable_containment(c0, r0, c1, r1): + """Round start circle so that it stays inside/outside end circle after rounding. + + The rounding of circle coordinates to integers may cause an abrupt change + if the start circle c0 is so close to the end circle c1's perimiter that + it ends up falling outside (or inside) as a result of the rounding. + To keep the gradient unchanged, we nudge it in the right direction. + + See: + https://github.com/googlefonts/colr-gradients-spec/issues/204 + https://github.com/googlefonts/picosvg/issues/158 + """ + start, end = Circle(c0, r0), Circle(c1, r1) + + inside_before_round = start.inside(end) + + round_start = start.round() + round_end = end.round() + inside_after_round = round_start.inside(round_end) + + if inside_before_round == inside_after_round: + return round_start + elif inside_after_round: + # start was outside before rounding: we need to push start away from end + direction = _vector_between(round_end.centre, round_start.centre) + radius_delta = +1.0 + else: + # start was inside before rounding: we need to push start towards end + direction = _vector_between(round_start.centre, round_end.centre) + radius_delta = -1.0 + dx, dy = _rounding_offset(direction) + + # At most 2 iterations ought to be enough to converge. Before the loop, we + # know the start circle didn't keep containment after normal rounding; thus + # we continue adjusting by -/+ 1.0 until containment is restored. + # Normal rounding can at most move each coordinates -/+0.5; in the worst case + # both the start and end circle's centres and radii will be rounded in opposite + # directions, e.g. when they move along a 45 degree diagonal: + # c0 = (1.5, 1.5) ===> (2.0, 2.0) + # r0 = 0.5 ===> 1.0 + # c1 = (0.499, 0.499) ===> (0.0, 0.0) + # r1 = 2.499 ===> 2.0 + # In this example, the relative distance between the circles, calculated + # as r1 - (r0 + distance(c0, c1)) is initially 0.57437 (c0 is inside c1), and + # -1.82842 after rounding (c0 is now outside c1). Nudging c0 by -1.0 on both + # x and y axes moves it towards c1 by hypot(-1.0, -1.0) = 1.41421. Two of these + # moves cover twice that distance, which is enough to restore containment. + max_attempts = 2 + for _ in range(max_attempts): + if round_start.concentric(round_end): + # can't move c0 towards c1 (they are the same), so we change the radius + round_start.radius += radius_delta + assert round_start.radius >= 0 + else: + round_start.move(dx, dy) + if inside_before_round == round_start.inside(round_end): + break + else: # likely a bug + raise AssertionError( + f"Rounding circle {start} " + f"{'inside' if inside_before_round else 'outside'} " + f"{end} failed after {max_attempts} attempts!" + ) + + return round_start diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/table_builder.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/table_builder.py new file mode 100644 index 0000000000000000000000000000000000000000..f1e182c432eae48545b2264d57d58c754ff6cd30 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/table_builder.py @@ -0,0 +1,223 @@ +""" +colorLib.table_builder: Generic helper for filling in BaseTable derivatives from tuples and maps and such. + +""" + +import collections +import enum +from fontTools.ttLib.tables.otBase import ( + BaseTable, + FormatSwitchingBaseTable, + UInt8FormatSwitchingBaseTable, +) +from fontTools.ttLib.tables.otConverters import ( + ComputedInt, + SimpleValue, + Struct, + Short, + UInt8, + UShort, + IntValue, + FloatValue, + OptionalValue, +) +from fontTools.misc.roundTools import otRound + + +class BuildCallback(enum.Enum): + """Keyed on (BEFORE_BUILD, class[, Format if available]). + Receives (dest, source). + Should return (dest, source), which can be new objects. + """ + + BEFORE_BUILD = enum.auto() + + """Keyed on (AFTER_BUILD, class[, Format if available]). + Receives (dest). + Should return dest, which can be a new object. + """ + AFTER_BUILD = enum.auto() + + """Keyed on (CREATE_DEFAULT, class[, Format if available]). + Receives no arguments. + Should return a new instance of class. + """ + CREATE_DEFAULT = enum.auto() + + +def _assignable(convertersByName): + return {k: v for k, v in convertersByName.items() if not isinstance(v, ComputedInt)} + + +def _isNonStrSequence(value): + return isinstance(value, collections.abc.Sequence) and not isinstance(value, str) + + +def _split_format(cls, source): + if _isNonStrSequence(source): + assert len(source) > 0, f"{cls} needs at least format from {source}" + fmt, remainder = source[0], source[1:] + elif isinstance(source, collections.abc.Mapping): + assert "Format" in source, f"{cls} needs at least Format from {source}" + remainder = source.copy() + fmt = remainder.pop("Format") + else: + raise ValueError(f"Not sure how to populate {cls} from {source}") + + assert isinstance( + fmt, collections.abc.Hashable + ), f"{cls} Format is not hashable: {fmt!r}" + assert fmt in cls.convertersByName, f"{cls} invalid Format: {fmt!r}" + + return fmt, remainder + + +class TableBuilder: + """ + Helps to populate things derived from BaseTable from maps, tuples, etc. + + A table of lifecycle callbacks may be provided to add logic beyond what is possible + based on otData info for the target class. See BuildCallbacks. + """ + + def __init__(self, callbackTable=None): + if callbackTable is None: + callbackTable = {} + self._callbackTable = callbackTable + + def _convert(self, dest, field, converter, value): + enumClass = getattr(converter, "enumClass", None) + + if enumClass: + if isinstance(value, enumClass): + pass + elif isinstance(value, str): + try: + value = getattr(enumClass, value.upper()) + except AttributeError: + raise ValueError(f"{value} is not a valid {enumClass}") + else: + value = enumClass(value) + + elif isinstance(converter, IntValue): + value = otRound(value) + elif isinstance(converter, FloatValue): + value = float(value) + + elif isinstance(converter, Struct): + if converter.repeat: + if _isNonStrSequence(value): + value = [self.build(converter.tableClass, v) for v in value] + else: + value = [self.build(converter.tableClass, value)] + setattr(dest, converter.repeat, len(value)) + else: + value = self.build(converter.tableClass, value) + elif callable(converter): + value = converter(value) + + setattr(dest, field, value) + + def build(self, cls, source): + assert issubclass(cls, BaseTable) + + if isinstance(source, cls): + return source + + callbackKey = (cls,) + fmt = None + if issubclass(cls, FormatSwitchingBaseTable): + fmt, source = _split_format(cls, source) + callbackKey = (cls, fmt) + + dest = self._callbackTable.get( + (BuildCallback.CREATE_DEFAULT,) + callbackKey, lambda: cls() + )() + assert isinstance(dest, cls) + + convByName = _assignable(cls.convertersByName) + skippedFields = set() + + # For format switchers we need to resolve converters based on format + if issubclass(cls, FormatSwitchingBaseTable): + dest.Format = fmt + convByName = _assignable(convByName[dest.Format]) + skippedFields.add("Format") + + # Convert sequence => mapping so before thunk only has to handle one format + if _isNonStrSequence(source): + # Sequence (typically list or tuple) assumed to match fields in declaration order + assert len(source) <= len( + convByName + ), f"Sequence of {len(source)} too long for {cls}; expected <= {len(convByName)} values" + source = dict(zip(convByName.keys(), source)) + + dest, source = self._callbackTable.get( + (BuildCallback.BEFORE_BUILD,) + callbackKey, lambda d, s: (d, s) + )(dest, source) + + if isinstance(source, collections.abc.Mapping): + for field, value in source.items(): + if field in skippedFields: + continue + converter = convByName.get(field, None) + if not converter: + raise ValueError( + f"Unrecognized field {field} for {cls}; expected one of {sorted(convByName.keys())}" + ) + self._convert(dest, field, converter, value) + else: + # let's try as a 1-tuple + dest = self.build(cls, (source,)) + + for field, conv in convByName.items(): + if not hasattr(dest, field) and isinstance(conv, OptionalValue): + setattr(dest, field, conv.DEFAULT) + + dest = self._callbackTable.get( + (BuildCallback.AFTER_BUILD,) + callbackKey, lambda d: d + )(dest) + + return dest + + +class TableUnbuilder: + def __init__(self, callbackTable=None): + if callbackTable is None: + callbackTable = {} + self._callbackTable = callbackTable + + def unbuild(self, table): + assert isinstance(table, BaseTable) + + source = {} + + callbackKey = (type(table),) + if isinstance(table, FormatSwitchingBaseTable): + source["Format"] = int(table.Format) + callbackKey += (table.Format,) + + for converter in table.getConverters(): + if isinstance(converter, ComputedInt): + continue + value = getattr(table, converter.name) + + enumClass = getattr(converter, "enumClass", None) + if enumClass: + source[converter.name] = value.name.lower() + elif isinstance(converter, Struct): + if converter.repeat: + source[converter.name] = [self.unbuild(v) for v in value] + else: + source[converter.name] = self.unbuild(value) + elif isinstance(converter, SimpleValue): + # "simple" values (e.g. int, float, str) need no further un-building + source[converter.name] = value + else: + raise NotImplementedError( + "Don't know how unbuild {value!r} with {converter!r}" + ) + + source = self._callbackTable.get(callbackKey, lambda s: s)(source) + + return source diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/unbuilder.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/unbuilder.py new file mode 100644 index 0000000000000000000000000000000000000000..ac243550b8908aef120b395e740b9974559d65b5 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/colorLib/unbuilder.py @@ -0,0 +1,81 @@ +from fontTools.ttLib.tables import otTables as ot +from .table_builder import TableUnbuilder + + +def unbuildColrV1(layerList, baseGlyphList): + layers = [] + if layerList: + layers = layerList.Paint + unbuilder = LayerListUnbuilder(layers) + return { + rec.BaseGlyph: unbuilder.unbuildPaint(rec.Paint) + for rec in baseGlyphList.BaseGlyphPaintRecord + } + + +def _flatten_layers(lst): + for paint in lst: + if paint["Format"] == ot.PaintFormat.PaintColrLayers: + yield from _flatten_layers(paint["Layers"]) + else: + yield paint + + +class LayerListUnbuilder: + def __init__(self, layers): + self.layers = layers + + callbacks = { + ( + ot.Paint, + ot.PaintFormat.PaintColrLayers, + ): self._unbuildPaintColrLayers, + } + self.tableUnbuilder = TableUnbuilder(callbacks) + + def unbuildPaint(self, paint): + assert isinstance(paint, ot.Paint) + return self.tableUnbuilder.unbuild(paint) + + def _unbuildPaintColrLayers(self, source): + assert source["Format"] == ot.PaintFormat.PaintColrLayers + + layers = list( + _flatten_layers( + [ + self.unbuildPaint(childPaint) + for childPaint in self.layers[ + source["FirstLayerIndex"] : source["FirstLayerIndex"] + + source["NumLayers"] + ] + ] + ) + ) + + if len(layers) == 1: + return layers[0] + + return {"Format": source["Format"], "Layers": layers} + + +if __name__ == "__main__": + from pprint import pprint + import sys + from fontTools.ttLib import TTFont + + try: + fontfile = sys.argv[1] + except IndexError: + sys.exit("usage: fonttools colorLib.unbuilder FONTFILE") + + font = TTFont(fontfile) + colr = font["COLR"] + if colr.version < 1: + sys.exit(f"error: No COLR table version=1 found in {fontfile}") + + colorGlyphs = unbuildColrV1( + colr.table.LayerList, + colr.table.BaseGlyphList, + ) + + pprint(colorGlyphs) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/config/__init__.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/config/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..41ab8f75819f1487394530c2e1db54156f3feccb --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/config/__init__.py @@ -0,0 +1,75 @@ +""" +Define all configuration options that can affect the working of fontTools +modules. E.g. optimization levels of varLib IUP, otlLib GPOS compression level, +etc. If this file gets too big, split it into smaller files per-module. + +An instance of the Config class can be attached to a TTFont object, so that +the various modules can access their configuration options from it. +""" + +from textwrap import dedent + +from fontTools.misc.configTools import * + + +class Config(AbstractConfig): + options = Options() + + +OPTIONS = Config.options + + +Config.register_option( + name="fontTools.otlLib.optimize.gpos:COMPRESSION_LEVEL", + help=dedent( + """\ + GPOS Lookup type 2 (PairPos) compression level: + 0 = do not attempt to compact PairPos lookups; + 1 to 8 = create at most 1 to 8 new subtables for each existing + subtable, provided that it would yield a 50%% file size saving; + 9 = create as many new subtables as needed to yield a file size saving. + Default: 0. + + This compaction aims to save file size, by splitting large class + kerning subtables (Format 2) that contain many zero values into + smaller and denser subtables. It's a trade-off between the overhead + of several subtables versus the sparseness of one big subtable. + + See the pull request: https://github.com/fonttools/fonttools/pull/2326 + """ + ), + default=0, + parse=int, + validate=lambda v: v in range(10), +) + +Config.register_option( + name="fontTools.ttLib.tables.otBase:USE_HARFBUZZ_REPACKER", + help=dedent( + """\ + FontTools tries to use the HarfBuzz Repacker to serialize GPOS/GSUB tables + if the uharfbuzz python bindings are importable, otherwise falls back to its + slower, less efficient serializer. Set to False to always use the latter. + Set to True to explicitly request the HarfBuzz Repacker (will raise an + error if uharfbuzz cannot be imported). + """ + ), + default=None, + parse=Option.parse_optional_bool, + validate=Option.validate_optional_bool, +) + +Config.register_option( + name="fontTools.otlLib.builder:WRITE_GPOS7", + help=dedent( + """\ + macOS before 13.2 didn’t support GPOS LookupType 7 (non-chaining + ContextPos lookups), so FontTools.otlLib.builder disables a file size + optimisation that would use LookupType 7 instead of 8 when there is no + chaining (no prefix or suffix). Set to True to enable the optimization. + """ + ), + default=False, + parse=Option.parse_optional_bool, + validate=Option.validate_optional_bool, +) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/config/__pycache__/__init__.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/config/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0fde5934b02d127fad8289de9b74befcaa90742b Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/config/__pycache__/__init__.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/__init__.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..156cb232a7aa80eee1526c7598f72043de10473f --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/__init__.py @@ -0,0 +1 @@ +"""Empty __init__.py file to signal Python this directory is a package.""" diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/basePen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/basePen.py new file mode 100644 index 0000000000000000000000000000000000000000..ba38f7009088b21b84db7297fe5e20970347473d --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/basePen.py @@ -0,0 +1,475 @@ +"""fontTools.pens.basePen.py -- Tools and base classes to build pen objects. + +The Pen Protocol + +A Pen is a kind of object that standardizes the way how to "draw" outlines: +it is a middle man between an outline and a drawing. In other words: +it is an abstraction for drawing outlines, making sure that outline objects +don't need to know the details about how and where they're being drawn, and +that drawings don't need to know the details of how outlines are stored. + +The most basic pattern is this:: + + outline.draw(pen) # 'outline' draws itself onto 'pen' + +Pens can be used to render outlines to the screen, but also to construct +new outlines. Eg. an outline object can be both a drawable object (it has a +draw() method) as well as a pen itself: you *build* an outline using pen +methods. + +The AbstractPen class defines the Pen protocol. It implements almost +nothing (only no-op closePath() and endPath() methods), but is useful +for documentation purposes. Subclassing it basically tells the reader: +"this class implements the Pen protocol.". An examples of an AbstractPen +subclass is :py:class:`fontTools.pens.transformPen.TransformPen`. + +The BasePen class is a base implementation useful for pens that actually +draw (for example a pen renders outlines using a native graphics engine). +BasePen contains a lot of base functionality, making it very easy to build +a pen that fully conforms to the pen protocol. Note that if you subclass +BasePen, you *don't* override moveTo(), lineTo(), etc., but _moveTo(), +_lineTo(), etc. See the BasePen doc string for details. Examples of +BasePen subclasses are fontTools.pens.boundsPen.BoundsPen and +fontTools.pens.cocoaPen.CocoaPen. + +Coordinates are usually expressed as (x, y) tuples, but generally any +sequence of length 2 will do. +""" + +from typing import Tuple, Dict + +from fontTools.misc.loggingTools import LogMixin +from fontTools.misc.transform import DecomposedTransform, Identity + +__all__ = [ + "AbstractPen", + "NullPen", + "BasePen", + "PenError", + "decomposeSuperBezierSegment", + "decomposeQuadraticSegment", +] + + +class PenError(Exception): + """Represents an error during penning.""" + + +class OpenContourError(PenError): + pass + + +class AbstractPen: + def moveTo(self, pt: Tuple[float, float]) -> None: + """Begin a new sub path, set the current point to 'pt'. You must + end each sub path with a call to pen.closePath() or pen.endPath(). + """ + raise NotImplementedError + + def lineTo(self, pt: Tuple[float, float]) -> None: + """Draw a straight line from the current point to 'pt'.""" + raise NotImplementedError + + def curveTo(self, *points: Tuple[float, float]) -> None: + """Draw a cubic bezier with an arbitrary number of control points. + + The last point specified is on-curve, all others are off-curve + (control) points. If the number of control points is > 2, the + segment is split into multiple bezier segments. This works + like this: + + Let n be the number of control points (which is the number of + arguments to this call minus 1). If n==2, a plain vanilla cubic + bezier is drawn. If n==1, we fall back to a quadratic segment and + if n==0 we draw a straight line. It gets interesting when n>2: + n-1 PostScript-style cubic segments will be drawn as if it were + one curve. See decomposeSuperBezierSegment(). + + The conversion algorithm used for n>2 is inspired by NURB + splines, and is conceptually equivalent to the TrueType "implied + points" principle. See also decomposeQuadraticSegment(). + """ + raise NotImplementedError + + def qCurveTo(self, *points: Tuple[float, float]) -> None: + """Draw a whole string of quadratic curve segments. + + The last point specified is on-curve, all others are off-curve + points. + + This method implements TrueType-style curves, breaking up curves + using 'implied points': between each two consequtive off-curve points, + there is one implied point exactly in the middle between them. See + also decomposeQuadraticSegment(). + + The last argument (normally the on-curve point) may be None. + This is to support contours that have NO on-curve points (a rarely + seen feature of TrueType outlines). + """ + raise NotImplementedError + + def closePath(self) -> None: + """Close the current sub path. You must call either pen.closePath() + or pen.endPath() after each sub path. + """ + pass + + def endPath(self) -> None: + """End the current sub path, but don't close it. You must call + either pen.closePath() or pen.endPath() after each sub path. + """ + pass + + def addComponent( + self, + glyphName: str, + transformation: Tuple[float, float, float, float, float, float], + ) -> None: + """Add a sub glyph. The 'transformation' argument must be a 6-tuple + containing an affine transformation, or a Transform object from the + fontTools.misc.transform module. More precisely: it should be a + sequence containing 6 numbers. + """ + raise NotImplementedError + + def addVarComponent( + self, + glyphName: str, + transformation: DecomposedTransform, + location: Dict[str, float], + ) -> None: + """Add a VarComponent sub glyph. The 'transformation' argument + must be a DecomposedTransform from the fontTools.misc.transform module, + and the 'location' argument must be a dictionary mapping axis tags + to their locations. + """ + # GlyphSet decomposes for us + raise AttributeError + + +class NullPen(AbstractPen): + """A pen that does nothing.""" + + def moveTo(self, pt): + pass + + def lineTo(self, pt): + pass + + def curveTo(self, *points): + pass + + def qCurveTo(self, *points): + pass + + def closePath(self): + pass + + def endPath(self): + pass + + def addComponent(self, glyphName, transformation): + pass + + def addVarComponent(self, glyphName, transformation, location): + pass + + +class LoggingPen(LogMixin, AbstractPen): + """A pen with a ``log`` property (see fontTools.misc.loggingTools.LogMixin)""" + + pass + + +class MissingComponentError(KeyError): + """Indicates a component pointing to a non-existent glyph in the glyphset.""" + + +class DecomposingPen(LoggingPen): + """Implements a 'addComponent' method that decomposes components + (i.e. draws them onto self as simple contours). + It can also be used as a mixin class (e.g. see ContourRecordingPen). + + You must override moveTo, lineTo, curveTo and qCurveTo. You may + additionally override closePath, endPath and addComponent. + + By default a warning message is logged when a base glyph is missing; + set the class variable ``skipMissingComponents`` to False if you want + all instances of a sub-class to raise a :class:`MissingComponentError` + exception by default. + """ + + skipMissingComponents = True + # alias error for convenience + MissingComponentError = MissingComponentError + + def __init__( + self, + glyphSet, + *args, + skipMissingComponents=None, + reverseFlipped=False, + **kwargs, + ): + """Takes a 'glyphSet' argument (dict), in which the glyphs that are referenced + as components are looked up by their name. + + If the optional 'reverseFlipped' argument is True, components whose transformation + matrix has a negative determinant will be decomposed with a reversed path direction + to compensate for the flip. + + The optional 'skipMissingComponents' argument can be set to True/False to + override the homonymous class attribute for a given pen instance. + """ + super(DecomposingPen, self).__init__(*args, **kwargs) + self.glyphSet = glyphSet + self.skipMissingComponents = ( + self.__class__.skipMissingComponents + if skipMissingComponents is None + else skipMissingComponents + ) + self.reverseFlipped = reverseFlipped + + def addComponent(self, glyphName, transformation): + """Transform the points of the base glyph and draw it onto self.""" + from fontTools.pens.transformPen import TransformPen + + try: + glyph = self.glyphSet[glyphName] + except KeyError: + if not self.skipMissingComponents: + raise MissingComponentError(glyphName) + self.log.warning("glyph '%s' is missing from glyphSet; skipped" % glyphName) + else: + pen = self + if transformation != Identity: + pen = TransformPen(pen, transformation) + if self.reverseFlipped: + # if the transformation has a negative determinant, it will + # reverse the contour direction of the component + a, b, c, d = transformation[:4] + det = a * d - b * c + if det < 0: + from fontTools.pens.reverseContourPen import ReverseContourPen + + pen = ReverseContourPen(pen) + glyph.draw(pen) + + def addVarComponent(self, glyphName, transformation, location): + # GlyphSet decomposes for us + raise AttributeError + + +class BasePen(DecomposingPen): + """Base class for drawing pens. You must override _moveTo, _lineTo and + _curveToOne. You may additionally override _closePath, _endPath, + addComponent, addVarComponent, and/or _qCurveToOne. You should not + override any other methods. + """ + + def __init__(self, glyphSet=None): + super(BasePen, self).__init__(glyphSet) + self.__currentPoint = None + + # must override + + def _moveTo(self, pt): + raise NotImplementedError + + def _lineTo(self, pt): + raise NotImplementedError + + def _curveToOne(self, pt1, pt2, pt3): + raise NotImplementedError + + # may override + + def _closePath(self): + pass + + def _endPath(self): + pass + + def _qCurveToOne(self, pt1, pt2): + """This method implements the basic quadratic curve type. The + default implementation delegates the work to the cubic curve + function. Optionally override with a native implementation. + """ + pt0x, pt0y = self.__currentPoint + pt1x, pt1y = pt1 + pt2x, pt2y = pt2 + mid1x = pt0x + 0.66666666666666667 * (pt1x - pt0x) + mid1y = pt0y + 0.66666666666666667 * (pt1y - pt0y) + mid2x = pt2x + 0.66666666666666667 * (pt1x - pt2x) + mid2y = pt2y + 0.66666666666666667 * (pt1y - pt2y) + self._curveToOne((mid1x, mid1y), (mid2x, mid2y), pt2) + + # don't override + + def _getCurrentPoint(self): + """Return the current point. This is not part of the public + interface, yet is useful for subclasses. + """ + return self.__currentPoint + + def closePath(self): + self._closePath() + self.__currentPoint = None + + def endPath(self): + self._endPath() + self.__currentPoint = None + + def moveTo(self, pt): + self._moveTo(pt) + self.__currentPoint = pt + + def lineTo(self, pt): + self._lineTo(pt) + self.__currentPoint = pt + + def curveTo(self, *points): + n = len(points) - 1 # 'n' is the number of control points + assert n >= 0 + if n == 2: + # The common case, we have exactly two BCP's, so this is a standard + # cubic bezier. Even though decomposeSuperBezierSegment() handles + # this case just fine, we special-case it anyway since it's so + # common. + self._curveToOne(*points) + self.__currentPoint = points[-1] + elif n > 2: + # n is the number of control points; split curve into n-1 cubic + # bezier segments. The algorithm used here is inspired by NURB + # splines and the TrueType "implied point" principle, and ensures + # the smoothest possible connection between two curve segments, + # with no disruption in the curvature. It is practical since it + # allows one to construct multiple bezier segments with a much + # smaller amount of points. + _curveToOne = self._curveToOne + for pt1, pt2, pt3 in decomposeSuperBezierSegment(points): + _curveToOne(pt1, pt2, pt3) + self.__currentPoint = pt3 + elif n == 1: + self.qCurveTo(*points) + elif n == 0: + self.lineTo(points[0]) + else: + raise AssertionError("can't get there from here") + + def qCurveTo(self, *points): + n = len(points) - 1 # 'n' is the number of control points + assert n >= 0 + if points[-1] is None: + # Special case for TrueType quadratics: it is possible to + # define a contour with NO on-curve points. BasePen supports + # this by allowing the final argument (the expected on-curve + # point) to be None. We simulate the feature by making the implied + # on-curve point between the last and the first off-curve points + # explicit. + x, y = points[-2] # last off-curve point + nx, ny = points[0] # first off-curve point + impliedStartPoint = (0.5 * (x + nx), 0.5 * (y + ny)) + self.__currentPoint = impliedStartPoint + self._moveTo(impliedStartPoint) + points = points[:-1] + (impliedStartPoint,) + if n > 0: + # Split the string of points into discrete quadratic curve + # segments. Between any two consecutive off-curve points + # there's an implied on-curve point exactly in the middle. + # This is where the segment splits. + _qCurveToOne = self._qCurveToOne + for pt1, pt2 in decomposeQuadraticSegment(points): + _qCurveToOne(pt1, pt2) + self.__currentPoint = pt2 + else: + self.lineTo(points[0]) + + +def decomposeSuperBezierSegment(points): + """Split the SuperBezier described by 'points' into a list of regular + bezier segments. The 'points' argument must be a sequence with length + 3 or greater, containing (x, y) coordinates. The last point is the + destination on-curve point, the rest of the points are off-curve points. + The start point should not be supplied. + + This function returns a list of (pt1, pt2, pt3) tuples, which each + specify a regular curveto-style bezier segment. + """ + n = len(points) - 1 + assert n > 1 + bezierSegments = [] + pt1, pt2, pt3 = points[0], None, None + for i in range(2, n + 1): + # calculate points in between control points. + nDivisions = min(i, 3, n - i + 2) + for j in range(1, nDivisions): + factor = j / nDivisions + temp1 = points[i - 1] + temp2 = points[i - 2] + temp = ( + temp2[0] + factor * (temp1[0] - temp2[0]), + temp2[1] + factor * (temp1[1] - temp2[1]), + ) + if pt2 is None: + pt2 = temp + else: + pt3 = (0.5 * (pt2[0] + temp[0]), 0.5 * (pt2[1] + temp[1])) + bezierSegments.append((pt1, pt2, pt3)) + pt1, pt2, pt3 = temp, None, None + bezierSegments.append((pt1, points[-2], points[-1])) + return bezierSegments + + +def decomposeQuadraticSegment(points): + """Split the quadratic curve segment described by 'points' into a list + of "atomic" quadratic segments. The 'points' argument must be a sequence + with length 2 or greater, containing (x, y) coordinates. The last point + is the destination on-curve point, the rest of the points are off-curve + points. The start point should not be supplied. + + This function returns a list of (pt1, pt2) tuples, which each specify a + plain quadratic bezier segment. + """ + n = len(points) - 1 + assert n > 0 + quadSegments = [] + for i in range(n - 1): + x, y = points[i] + nx, ny = points[i + 1] + impliedPt = (0.5 * (x + nx), 0.5 * (y + ny)) + quadSegments.append((points[i], impliedPt)) + quadSegments.append((points[-2], points[-1])) + return quadSegments + + +class _TestPen(BasePen): + """Test class that prints PostScript to stdout.""" + + def _moveTo(self, pt): + print("%s %s moveto" % (pt[0], pt[1])) + + def _lineTo(self, pt): + print("%s %s lineto" % (pt[0], pt[1])) + + def _curveToOne(self, bcp1, bcp2, pt): + print( + "%s %s %s %s %s %s curveto" + % (bcp1[0], bcp1[1], bcp2[0], bcp2[1], pt[0], pt[1]) + ) + + def _closePath(self): + print("closepath") + + +if __name__ == "__main__": + pen = _TestPen(None) + pen.moveTo((0, 0)) + pen.lineTo((0, 100)) + pen.curveTo((50, 75), (60, 50), (50, 25), (0, 0)) + pen.closePath() + + pen = _TestPen(None) + # testing the "no on-curve point" scenario + pen.qCurveTo((0, 0), (0, 100), (100, 100), (100, 0), None) + pen.closePath() diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/cu2quPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/cu2quPen.py new file mode 100644 index 0000000000000000000000000000000000000000..5730b325cf056f2e6633f7e6294853af21b1182e --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/cu2quPen.py @@ -0,0 +1,325 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import operator +from fontTools.cu2qu import curve_to_quadratic, curves_to_quadratic +from fontTools.pens.basePen import decomposeSuperBezierSegment +from fontTools.pens.filterPen import FilterPen +from fontTools.pens.reverseContourPen import ReverseContourPen +from fontTools.pens.pointPen import BasePointToSegmentPen +from fontTools.pens.pointPen import ReverseContourPointPen + + +class Cu2QuPen(FilterPen): + """A filter pen to convert cubic bezier curves to quadratic b-splines + using the FontTools SegmentPen protocol. + + Args: + + other_pen: another SegmentPen used to draw the transformed outline. + max_err: maximum approximation error in font units. For optimal results, + if you know the UPEM of the font, we recommend setting this to a + value equal, or close to UPEM / 1000. + reverse_direction: flip the contours' direction but keep starting point. + stats: a dictionary counting the point numbers of quadratic segments. + all_quadratic: if True (default), only quadratic b-splines are generated. + if False, quadratic curves or cubic curves are generated depending + on which one is more economical. + """ + + def __init__( + self, + other_pen, + max_err, + reverse_direction=False, + stats=None, + all_quadratic=True, + ): + if reverse_direction: + other_pen = ReverseContourPen(other_pen) + super().__init__(other_pen) + self.max_err = max_err + self.stats = stats + self.all_quadratic = all_quadratic + + def _convert_curve(self, pt1, pt2, pt3): + curve = (self.current_pt, pt1, pt2, pt3) + result = curve_to_quadratic(curve, self.max_err, self.all_quadratic) + if self.stats is not None: + n = str(len(result) - 2) + self.stats[n] = self.stats.get(n, 0) + 1 + if self.all_quadratic: + self.qCurveTo(*result[1:]) + else: + if len(result) == 3: + self.qCurveTo(*result[1:]) + else: + assert len(result) == 4 + super().curveTo(*result[1:]) + + def curveTo(self, *points): + n = len(points) + if n == 3: + # this is the most common case, so we special-case it + self._convert_curve(*points) + elif n > 3: + for segment in decomposeSuperBezierSegment(points): + self._convert_curve(*segment) + else: + self.qCurveTo(*points) + + +class Cu2QuPointPen(BasePointToSegmentPen): + """A filter pen to convert cubic bezier curves to quadratic b-splines + using the FontTools PointPen protocol. + + Args: + other_point_pen: another PointPen used to draw the transformed outline. + max_err: maximum approximation error in font units. For optimal results, + if you know the UPEM of the font, we recommend setting this to a + value equal, or close to UPEM / 1000. + reverse_direction: reverse the winding direction of all contours. + stats: a dictionary counting the point numbers of quadratic segments. + all_quadratic: if True (default), only quadratic b-splines are generated. + if False, quadratic curves or cubic curves are generated depending + on which one is more economical. + """ + + __points_required = { + "move": (1, operator.eq), + "line": (1, operator.eq), + "qcurve": (2, operator.ge), + "curve": (3, operator.eq), + } + + def __init__( + self, + other_point_pen, + max_err, + reverse_direction=False, + stats=None, + all_quadratic=True, + ): + BasePointToSegmentPen.__init__(self) + if reverse_direction: + self.pen = ReverseContourPointPen(other_point_pen) + else: + self.pen = other_point_pen + self.max_err = max_err + self.stats = stats + self.all_quadratic = all_quadratic + + def _flushContour(self, segments): + assert len(segments) >= 1 + closed = segments[0][0] != "move" + new_segments = [] + prev_points = segments[-1][1] + prev_on_curve = prev_points[-1][0] + for segment_type, points in segments: + if segment_type == "curve": + for sub_points in self._split_super_bezier_segments(points): + on_curve, smooth, name, kwargs = sub_points[-1] + bcp1, bcp2 = sub_points[0][0], sub_points[1][0] + cubic = [prev_on_curve, bcp1, bcp2, on_curve] + quad = curve_to_quadratic(cubic, self.max_err, self.all_quadratic) + if self.stats is not None: + n = str(len(quad) - 2) + self.stats[n] = self.stats.get(n, 0) + 1 + new_points = [(pt, False, None, {}) for pt in quad[1:-1]] + new_points.append((on_curve, smooth, name, kwargs)) + if self.all_quadratic or len(new_points) == 2: + new_segments.append(["qcurve", new_points]) + else: + new_segments.append(["curve", new_points]) + prev_on_curve = sub_points[-1][0] + else: + new_segments.append([segment_type, points]) + prev_on_curve = points[-1][0] + if closed: + # the BasePointToSegmentPen.endPath method that calls _flushContour + # rotates the point list of closed contours so that they end with + # the first on-curve point. We restore the original starting point. + new_segments = new_segments[-1:] + new_segments[:-1] + self._drawPoints(new_segments) + + def _split_super_bezier_segments(self, points): + sub_segments = [] + # n is the number of control points + n = len(points) - 1 + if n == 2: + # a simple bezier curve segment + sub_segments.append(points) + elif n > 2: + # a "super" bezier; decompose it + on_curve, smooth, name, kwargs = points[-1] + num_sub_segments = n - 1 + for i, sub_points in enumerate( + decomposeSuperBezierSegment([pt for pt, _, _, _ in points]) + ): + new_segment = [] + for point in sub_points[:-1]: + new_segment.append((point, False, None, {})) + if i == (num_sub_segments - 1): + # the last on-curve keeps its original attributes + new_segment.append((on_curve, smooth, name, kwargs)) + else: + # on-curves of sub-segments are always "smooth" + new_segment.append((sub_points[-1], True, None, {})) + sub_segments.append(new_segment) + else: + raise AssertionError("expected 2 control points, found: %d" % n) + return sub_segments + + def _drawPoints(self, segments): + pen = self.pen + pen.beginPath() + last_offcurves = [] + points_required = self.__points_required + for i, (segment_type, points) in enumerate(segments): + if segment_type in points_required: + n, op = points_required[segment_type] + assert op(len(points), n), ( + f"illegal {segment_type!r} segment point count: " + f"expected {n}, got {len(points)}" + ) + offcurves = points[:-1] + if i == 0: + # any off-curve points preceding the first on-curve + # will be appended at the end of the contour + last_offcurves = offcurves + else: + for pt, smooth, name, kwargs in offcurves: + pen.addPoint(pt, None, smooth, name, **kwargs) + pt, smooth, name, kwargs = points[-1] + if pt is None: + assert segment_type == "qcurve" + # special quadratic contour with no on-curve points: + # we need to skip the "None" point. See also the Pen + # protocol's qCurveTo() method and fontTools.pens.basePen + pass + else: + pen.addPoint(pt, segment_type, smooth, name, **kwargs) + else: + raise AssertionError("unexpected segment type: %r" % segment_type) + for pt, smooth, name, kwargs in last_offcurves: + pen.addPoint(pt, None, smooth, name, **kwargs) + pen.endPath() + + def addComponent(self, baseGlyphName, transformation): + assert self.currentPath is None + self.pen.addComponent(baseGlyphName, transformation) + + +class Cu2QuMultiPen: + """A filter multi-pen to convert cubic bezier curves to quadratic b-splines + in a interpolation-compatible manner, using the FontTools SegmentPen protocol. + + Args: + + other_pens: list of SegmentPens used to draw the transformed outlines. + max_err: maximum approximation error in font units. For optimal results, + if you know the UPEM of the font, we recommend setting this to a + value equal, or close to UPEM / 1000. + reverse_direction: flip the contours' direction but keep starting point. + + This pen does not follow the normal SegmentPen protocol. Instead, its + moveTo/lineTo/qCurveTo/curveTo methods take a list of tuples that are + arguments that would normally be passed to a SegmentPen, one item for + each of the pens in other_pens. + """ + + # TODO Simplify like 3e8ebcdce592fe8a59ca4c3a294cc9724351e1ce + # Remove start_pts and _add_moveTO + + def __init__(self, other_pens, max_err, reverse_direction=False): + if reverse_direction: + other_pens = [ + ReverseContourPen(pen, outputImpliedClosingLine=True) + for pen in other_pens + ] + self.pens = other_pens + self.max_err = max_err + self.start_pts = None + self.current_pts = None + + def _check_contour_is_open(self): + if self.current_pts is None: + raise AssertionError("moveTo is required") + + def _check_contour_is_closed(self): + if self.current_pts is not None: + raise AssertionError("closePath or endPath is required") + + def _add_moveTo(self): + if self.start_pts is not None: + for pt, pen in zip(self.start_pts, self.pens): + pen.moveTo(*pt) + self.start_pts = None + + def moveTo(self, pts): + self._check_contour_is_closed() + self.start_pts = self.current_pts = pts + self._add_moveTo() + + def lineTo(self, pts): + self._check_contour_is_open() + self._add_moveTo() + for pt, pen in zip(pts, self.pens): + pen.lineTo(*pt) + self.current_pts = pts + + def qCurveTo(self, pointsList): + self._check_contour_is_open() + if len(pointsList[0]) == 1: + self.lineTo([(points[0],) for points in pointsList]) + return + self._add_moveTo() + current_pts = [] + for points, pen in zip(pointsList, self.pens): + pen.qCurveTo(*points) + current_pts.append((points[-1],)) + self.current_pts = current_pts + + def _curves_to_quadratic(self, pointsList): + curves = [] + for current_pt, points in zip(self.current_pts, pointsList): + curves.append(current_pt + points) + quadratics = curves_to_quadratic(curves, [self.max_err] * len(curves)) + pointsList = [] + for quadratic in quadratics: + pointsList.append(quadratic[1:]) + self.qCurveTo(pointsList) + + def curveTo(self, pointsList): + self._check_contour_is_open() + self._curves_to_quadratic(pointsList) + + def closePath(self): + self._check_contour_is_open() + if self.start_pts is None: + for pen in self.pens: + pen.closePath() + self.current_pts = self.start_pts = None + + def endPath(self): + self._check_contour_is_open() + if self.start_pts is None: + for pen in self.pens: + pen.endPath() + self.current_pts = self.start_pts = None + + def addComponent(self, glyphName, transformations): + self._check_contour_is_closed() + for trans, pen in zip(transformations, self.pens): + pen.addComponent(glyphName, trans) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/filterPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/filterPen.py new file mode 100644 index 0000000000000000000000000000000000000000..f104e67dd3594da959512bbd54cf208decdb06a5 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/filterPen.py @@ -0,0 +1,241 @@ +from __future__ import annotations + +from fontTools.pens.basePen import AbstractPen, DecomposingPen +from fontTools.pens.pointPen import AbstractPointPen, DecomposingPointPen +from fontTools.pens.recordingPen import RecordingPen + + +class _PassThruComponentsMixin(object): + def addComponent(self, glyphName, transformation, **kwargs): + self._outPen.addComponent(glyphName, transformation, **kwargs) + + +class FilterPen(_PassThruComponentsMixin, AbstractPen): + """Base class for pens that apply some transformation to the coordinates + they receive and pass them to another pen. + + You can override any of its methods. The default implementation does + nothing, but passes the commands unmodified to the other pen. + + >>> from fontTools.pens.recordingPen import RecordingPen + >>> rec = RecordingPen() + >>> pen = FilterPen(rec) + >>> v = iter(rec.value) + + >>> pen.moveTo((0, 0)) + >>> next(v) + ('moveTo', ((0, 0),)) + + >>> pen.lineTo((1, 1)) + >>> next(v) + ('lineTo', ((1, 1),)) + + >>> pen.curveTo((2, 2), (3, 3), (4, 4)) + >>> next(v) + ('curveTo', ((2, 2), (3, 3), (4, 4))) + + >>> pen.qCurveTo((5, 5), (6, 6), (7, 7), (8, 8)) + >>> next(v) + ('qCurveTo', ((5, 5), (6, 6), (7, 7), (8, 8))) + + >>> pen.closePath() + >>> next(v) + ('closePath', ()) + + >>> pen.moveTo((9, 9)) + >>> next(v) + ('moveTo', ((9, 9),)) + + >>> pen.endPath() + >>> next(v) + ('endPath', ()) + + >>> pen.addComponent('foo', (1, 0, 0, 1, 0, 0)) + >>> next(v) + ('addComponent', ('foo', (1, 0, 0, 1, 0, 0))) + """ + + def __init__(self, outPen): + self._outPen = outPen + self.current_pt = None + + def moveTo(self, pt): + self._outPen.moveTo(pt) + self.current_pt = pt + + def lineTo(self, pt): + self._outPen.lineTo(pt) + self.current_pt = pt + + def curveTo(self, *points): + self._outPen.curveTo(*points) + self.current_pt = points[-1] + + def qCurveTo(self, *points): + self._outPen.qCurveTo(*points) + self.current_pt = points[-1] + + def closePath(self): + self._outPen.closePath() + self.current_pt = None + + def endPath(self): + self._outPen.endPath() + self.current_pt = None + + +class ContourFilterPen(_PassThruComponentsMixin, RecordingPen): + """A "buffered" filter pen that accumulates contour data, passes + it through a ``filterContour`` method when the contour is closed or ended, + and finally draws the result with the output pen. + + Components are passed through unchanged. + """ + + def __init__(self, outPen): + super(ContourFilterPen, self).__init__() + self._outPen = outPen + + def closePath(self): + super(ContourFilterPen, self).closePath() + self._flushContour() + + def endPath(self): + super(ContourFilterPen, self).endPath() + self._flushContour() + + def _flushContour(self): + result = self.filterContour(self.value) + if result is not None: + self.value = result + self.replay(self._outPen) + self.value = [] + + def filterContour(self, contour): + """Subclasses must override this to perform the filtering. + + The contour is a list of pen (operator, operands) tuples. + Operators are strings corresponding to the AbstractPen methods: + "moveTo", "lineTo", "curveTo", "qCurveTo", "closePath" and + "endPath". The operands are the positional arguments that are + passed to each method. + + If the method doesn't return a value (i.e. returns None), it's + assumed that the argument was modified in-place. + Otherwise, the return value is drawn with the output pen. + """ + return # or return contour + + +class FilterPointPen(_PassThruComponentsMixin, AbstractPointPen): + """Baseclass for point pens that apply some transformation to the + coordinates they receive and pass them to another point pen. + + You can override any of its methods. The default implementation does + nothing, but passes the commands unmodified to the other pen. + + >>> from fontTools.pens.recordingPen import RecordingPointPen + >>> rec = RecordingPointPen() + >>> pen = FilterPointPen(rec) + >>> v = iter(rec.value) + >>> pen.beginPath(identifier="abc") + >>> next(v) + ('beginPath', (), {'identifier': 'abc'}) + >>> pen.addPoint((1, 2), "line", False) + >>> next(v) + ('addPoint', ((1, 2), 'line', False, None), {}) + >>> pen.addComponent("a", (2, 0, 0, 2, 10, -10), identifier="0001") + >>> next(v) + ('addComponent', ('a', (2, 0, 0, 2, 10, -10)), {'identifier': '0001'}) + >>> pen.endPath() + >>> next(v) + ('endPath', (), {}) + """ + + def __init__(self, outPen): + self._outPen = outPen + + def beginPath(self, **kwargs): + self._outPen.beginPath(**kwargs) + + def endPath(self): + self._outPen.endPath() + + def addPoint(self, pt, segmentType=None, smooth=False, name=None, **kwargs): + self._outPen.addPoint(pt, segmentType, smooth, name, **kwargs) + + +class _DecomposingFilterPenMixin: + """Mixin class that decomposes components as regular contours. + + Shared by both DecomposingFilterPen and DecomposingFilterPointPen. + + Takes two required parameters, another (segment or point) pen 'outPen' to draw + with, and a 'glyphSet' dict of drawable glyph objects to draw components from. + + The 'skipMissingComponents' and 'reverseFlipped' optional arguments work the + same as in the DecomposingPen/DecomposingPointPen. Both are False by default. + + In addition, the decomposing filter pens also take the following two options: + + 'include' is an optional set of component base glyph names to consider for + decomposition; the default include=None means decompose all components no matter + the base glyph name). + + 'decomposeNested' (bool) controls whether to recurse decomposition into nested + components of components (this only matters when 'include' was also provided); + if False, only decompose top-level components included in the set, but not + also their children. + """ + + # raises MissingComponentError if base glyph is not found in glyphSet + skipMissingComponents = False + + def __init__( + self, + outPen, + glyphSet, + skipMissingComponents=None, + reverseFlipped=False, + include: set[str] | None = None, + decomposeNested: bool = True, + ): + super().__init__( + outPen=outPen, + glyphSet=glyphSet, + skipMissingComponents=skipMissingComponents, + reverseFlipped=reverseFlipped, + ) + self.include = include + self.decomposeNested = decomposeNested + + def addComponent(self, baseGlyphName, transformation, **kwargs): + # only decompose the component if it's included in the set + if self.include is None or baseGlyphName in self.include: + # if we're decomposing nested components, temporarily set include to None + include_bak = self.include + if self.decomposeNested and self.include: + self.include = None + try: + super().addComponent(baseGlyphName, transformation, **kwargs) + finally: + if self.include != include_bak: + self.include = include_bak + else: + _PassThruComponentsMixin.addComponent( + self, baseGlyphName, transformation, **kwargs + ) + + +class DecomposingFilterPen(_DecomposingFilterPenMixin, DecomposingPen, FilterPen): + """Filter pen that draws components as regular contours.""" + + pass + + +class DecomposingFilterPointPen( + _DecomposingFilterPenMixin, DecomposingPointPen, FilterPointPen +): + """Filter point pen that draws components as regular contours.""" + + pass diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/hashPointPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/hashPointPen.py new file mode 100644 index 0000000000000000000000000000000000000000..f15dcabbfd51c7706480ccf35e398c81686cc0f5 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/hashPointPen.py @@ -0,0 +1,89 @@ +# Modified from https://github.com/adobe-type-tools/psautohint/blob/08b346865710ed3c172f1eb581d6ef243b203f99/python/psautohint/ufoFont.py#L800-L838 +import hashlib + +from fontTools.pens.basePen import MissingComponentError +from fontTools.pens.pointPen import AbstractPointPen + + +class HashPointPen(AbstractPointPen): + """ + This pen can be used to check if a glyph's contents (outlines plus + components) have changed. + + Components are added as the original outline plus each composite's + transformation. + + Example: You have some TrueType hinting code for a glyph which you want to + compile. The hinting code specifies a hash value computed with HashPointPen + that was valid for the glyph's outlines at the time the hinting code was + written. Now you can calculate the hash for the glyph's current outlines to + check if the outlines have changed, which would probably make the hinting + code invalid. + + > glyph = ufo[name] + > hash_pen = HashPointPen(glyph.width, ufo) + > glyph.drawPoints(hash_pen) + > ttdata = glyph.lib.get("public.truetype.instructions", None) + > stored_hash = ttdata.get("id", None) # The hash is stored in the "id" key + > if stored_hash is None or stored_hash != hash_pen.hash: + > logger.error(f"Glyph hash mismatch, glyph '{name}' will have no instructions in font.") + > else: + > # The hash values are identical, the outline has not changed. + > # Compile the hinting code ... + > pass + + If you want to compare a glyph from a source format which supports floating point + coordinates and transformations against a glyph from a format which has restrictions + on the precision of floats, e.g. UFO vs. TTF, you must use an appropriate rounding + function to make the values comparable. For TTF fonts with composites, this + construct can be used to make the transform values conform to F2Dot14: + + > ttf_hash_pen = HashPointPen(ttf_glyph_width, ttFont.getGlyphSet()) + > ttf_round_pen = RoundingPointPen(ttf_hash_pen, transformRoundFunc=partial(floatToFixedToFloat, precisionBits=14)) + > ufo_hash_pen = HashPointPen(ufo_glyph.width, ufo) + > ttf_glyph.drawPoints(ttf_round_pen, ttFont["glyf"]) + > ufo_round_pen = RoundingPointPen(ufo_hash_pen, transformRoundFunc=partial(floatToFixedToFloat, precisionBits=14)) + > ufo_glyph.drawPoints(ufo_round_pen) + > assert ttf_hash_pen.hash == ufo_hash_pen.hash + """ + + def __init__(self, glyphWidth=0, glyphSet=None): + self.glyphset = glyphSet + self.data = ["w%s" % round(glyphWidth, 9)] + + @property + def hash(self): + data = "".join(self.data) + if len(data) >= 128: + data = hashlib.sha512(data.encode("ascii")).hexdigest() + return data + + def beginPath(self, identifier=None, **kwargs): + pass + + def endPath(self): + self.data.append("|") + + def addPoint( + self, + pt, + segmentType=None, + smooth=False, + name=None, + identifier=None, + **kwargs, + ): + if segmentType is None: + pt_type = "o" # offcurve + else: + pt_type = segmentType[0] + self.data.append(f"{pt_type}{pt[0]:g}{pt[1]:+g}") + + def addComponent(self, baseGlyphName, transformation, identifier=None, **kwargs): + tr = "".join([f"{t:+}" for t in transformation]) + self.data.append("[") + try: + self.glyphset[baseGlyphName].drawPoints(self) + except KeyError: + raise MissingComponentError(baseGlyphName) + self.data.append(f"({tr})]") diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/qtPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/qtPen.py new file mode 100644 index 0000000000000000000000000000000000000000..eb13d03d2f611de4ce0b29ce3995f85e8f9e491a --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/qtPen.py @@ -0,0 +1,29 @@ +from fontTools.pens.basePen import BasePen + + +__all__ = ["QtPen"] + + +class QtPen(BasePen): + def __init__(self, glyphSet, path=None): + BasePen.__init__(self, glyphSet) + if path is None: + from PyQt5.QtGui import QPainterPath + + path = QPainterPath() + self.path = path + + def _moveTo(self, p): + self.path.moveTo(*p) + + def _lineTo(self, p): + self.path.lineTo(*p) + + def _curveToOne(self, p1, p2, p3): + self.path.cubicTo(*p1, *p2, *p3) + + def _qCurveToOne(self, p1, p2): + self.path.quadTo(*p1, *p2) + + def _closePath(self): + self.path.closeSubpath() diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/qu2cuPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/qu2cuPen.py new file mode 100644 index 0000000000000000000000000000000000000000..7e400f98c45cb7fdbbba00df009b7819adffec4c --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/qu2cuPen.py @@ -0,0 +1,105 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# Copyright 2023 Behdad Esfahbod. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from fontTools.qu2cu import quadratic_to_curves +from fontTools.pens.filterPen import ContourFilterPen +from fontTools.pens.reverseContourPen import ReverseContourPen +import math + + +class Qu2CuPen(ContourFilterPen): + """A filter pen to convert quadratic bezier splines to cubic curves + using the FontTools SegmentPen protocol. + + Args: + + other_pen: another SegmentPen used to draw the transformed outline. + max_err: maximum approximation error in font units. For optimal results, + if you know the UPEM of the font, we recommend setting this to a + value equal, or close to UPEM / 1000. + reverse_direction: flip the contours' direction but keep starting point. + stats: a dictionary counting the point numbers of cubic segments. + """ + + def __init__( + self, + other_pen, + max_err, + all_cubic=False, + reverse_direction=False, + stats=None, + ): + if reverse_direction: + other_pen = ReverseContourPen(other_pen) + super().__init__(other_pen) + self.all_cubic = all_cubic + self.max_err = max_err + self.stats = stats + + def _quadratics_to_curve(self, q): + curves = quadratic_to_curves(q, self.max_err, all_cubic=self.all_cubic) + if self.stats is not None: + for curve in curves: + n = str(len(curve) - 2) + self.stats[n] = self.stats.get(n, 0) + 1 + for curve in curves: + if len(curve) == 4: + yield ("curveTo", curve[1:]) + else: + yield ("qCurveTo", curve[1:]) + + def filterContour(self, contour): + quadratics = [] + currentPt = None + newContour = [] + for op, args in contour: + if op == "qCurveTo" and ( + self.all_cubic or (len(args) > 2 and args[-1] is not None) + ): + if args[-1] is None: + raise NotImplementedError( + "oncurve-less contours with all_cubic not implemented" + ) + quadratics.append((currentPt,) + args) + else: + if quadratics: + newContour.extend(self._quadratics_to_curve(quadratics)) + quadratics = [] + newContour.append((op, args)) + currentPt = args[-1] if args else None + if quadratics: + newContour.extend(self._quadratics_to_curve(quadratics)) + + if not self.all_cubic: + # Add back implicit oncurve points + contour = newContour + newContour = [] + for op, args in contour: + if op == "qCurveTo" and newContour and newContour[-1][0] == "qCurveTo": + pt0 = newContour[-1][1][-2] + pt1 = newContour[-1][1][-1] + pt2 = args[0] + if ( + pt1 is not None + and math.isclose(pt2[0] - pt1[0], pt1[0] - pt0[0]) + and math.isclose(pt2[1] - pt1[1], pt1[1] - pt0[1]) + ): + newArgs = newContour[-1][1][:-1] + args + newContour[-1] = (op, newArgs) + continue + + newContour.append((op, args)) + + return newContour diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/quartzPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/quartzPen.py new file mode 100644 index 0000000000000000000000000000000000000000..2b8a927dc4fcc49707f958e445cea80319619e6e --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/quartzPen.py @@ -0,0 +1,43 @@ +from fontTools.pens.basePen import BasePen + +from Quartz.CoreGraphics import CGPathCreateMutable, CGPathMoveToPoint +from Quartz.CoreGraphics import CGPathAddLineToPoint, CGPathAddCurveToPoint +from Quartz.CoreGraphics import CGPathAddQuadCurveToPoint, CGPathCloseSubpath + + +__all__ = ["QuartzPen"] + + +class QuartzPen(BasePen): + """A pen that creates a CGPath + + Parameters + - path: an optional CGPath to add to + - xform: an optional CGAffineTransform to apply to the path + """ + + def __init__(self, glyphSet, path=None, xform=None): + BasePen.__init__(self, glyphSet) + if path is None: + path = CGPathCreateMutable() + self.path = path + self.xform = xform + + def _moveTo(self, pt): + x, y = pt + CGPathMoveToPoint(self.path, self.xform, x, y) + + def _lineTo(self, pt): + x, y = pt + CGPathAddLineToPoint(self.path, self.xform, x, y) + + def _curveToOne(self, p1, p2, p3): + (x1, y1), (x2, y2), (x3, y3) = p1, p2, p3 + CGPathAddCurveToPoint(self.path, self.xform, x1, y1, x2, y2, x3, y3) + + def _qCurveToOne(self, p1, p2): + (x1, y1), (x2, y2) = p1, p2 + CGPathAddQuadCurveToPoint(self.path, self.xform, x1, y1, x2, y2) + + def _closePath(self): + CGPathCloseSubpath(self.path) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/statisticsPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/statisticsPen.py new file mode 100644 index 0000000000000000000000000000000000000000..b91d93b6eb61ad550460858e811659479204bf07 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/statisticsPen.py @@ -0,0 +1,307 @@ +"""Pen calculating area, center of mass, variance and standard-deviation, +covariance and correlation, and slant, of glyph shapes.""" + +from math import sqrt, degrees, atan +from fontTools.pens.basePen import BasePen, OpenContourError +from fontTools.pens.momentsPen import MomentsPen + +__all__ = ["StatisticsPen", "StatisticsControlPen"] + + +class StatisticsBase: + def __init__(self): + self._zero() + + def _zero(self): + self.area = 0 + self.meanX = 0 + self.meanY = 0 + self.varianceX = 0 + self.varianceY = 0 + self.stddevX = 0 + self.stddevY = 0 + self.covariance = 0 + self.correlation = 0 + self.slant = 0 + + def _update(self): + # XXX The variance formulas should never produce a negative value, + # but due to reasons I don't understand, both of our pens do. + # So we take the absolute value here. + self.varianceX = abs(self.varianceX) + self.varianceY = abs(self.varianceY) + + self.stddevX = stddevX = sqrt(self.varianceX) + self.stddevY = stddevY = sqrt(self.varianceY) + + # Correlation(X,Y) = Covariance(X,Y) / ( stddev(X) * stddev(Y) ) + # https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient + if stddevX * stddevY == 0: + correlation = float("NaN") + else: + # XXX The above formula should never produce a value outside + # the range [-1, 1], but due to reasons I don't understand, + # (probably the same issue as above), it does. So we clamp. + correlation = self.covariance / (stddevX * stddevY) + correlation = max(-1, min(1, correlation)) + self.correlation = correlation if abs(correlation) > 1e-3 else 0 + + slant = ( + self.covariance / self.varianceY if self.varianceY != 0 else float("NaN") + ) + self.slant = slant if abs(slant) > 1e-3 else 0 + + +class StatisticsPen(StatisticsBase, MomentsPen): + """Pen calculating area, center of mass, variance and + standard-deviation, covariance and correlation, and slant, + of glyph shapes. + + Note that if the glyph shape is self-intersecting, the values + are not correct (but well-defined). Moreover, area will be + negative if contour directions are clockwise.""" + + def __init__(self, glyphset=None): + MomentsPen.__init__(self, glyphset=glyphset) + StatisticsBase.__init__(self) + + def _closePath(self): + MomentsPen._closePath(self) + self._update() + + def _update(self): + area = self.area + if not area: + self._zero() + return + + # Center of mass + # https://en.wikipedia.org/wiki/Center_of_mass#A_continuous_volume + self.meanX = meanX = self.momentX / area + self.meanY = meanY = self.momentY / area + + # Var(X) = E[X^2] - E[X]^2 + self.varianceX = self.momentXX / area - meanX * meanX + self.varianceY = self.momentYY / area - meanY * meanY + + # Covariance(X,Y) = (E[X.Y] - E[X]E[Y]) + self.covariance = self.momentXY / area - meanX * meanY + + StatisticsBase._update(self) + + +class StatisticsControlPen(StatisticsBase, BasePen): + """Pen calculating area, center of mass, variance and + standard-deviation, covariance and correlation, and slant, + of glyph shapes, using the control polygon only. + + Note that if the glyph shape is self-intersecting, the values + are not correct (but well-defined). Moreover, area will be + negative if contour directions are clockwise.""" + + def __init__(self, glyphset=None): + BasePen.__init__(self, glyphset) + StatisticsBase.__init__(self) + self._nodes = [] + + def _moveTo(self, pt): + self._nodes.append(complex(*pt)) + + def _lineTo(self, pt): + self._nodes.append(complex(*pt)) + + def _qCurveToOne(self, pt1, pt2): + for pt in (pt1, pt2): + self._nodes.append(complex(*pt)) + + def _curveToOne(self, pt1, pt2, pt3): + for pt in (pt1, pt2, pt3): + self._nodes.append(complex(*pt)) + + def _closePath(self): + self._update() + + def _endPath(self): + p0 = self._getCurrentPoint() + if p0 != self._startPoint: + raise OpenContourError("Glyph statistics not defined on open contours.") + + def _update(self): + nodes = self._nodes + n = len(nodes) + + # Triangle formula + self.area = ( + sum( + (p0.real * p1.imag - p1.real * p0.imag) + for p0, p1 in zip(nodes, nodes[1:] + nodes[:1]) + ) + / 2 + ) + + # Center of mass + # https://en.wikipedia.org/wiki/Center_of_mass#A_system_of_particles + sumNodes = sum(nodes) + self.meanX = meanX = sumNodes.real / n + self.meanY = meanY = sumNodes.imag / n + + if n > 1: + # Var(X) = (sum[X^2] - sum[X]^2 / n) / (n - 1) + # https://www.statisticshowto.com/probability-and-statistics/descriptive-statistics/sample-variance/ + self.varianceX = varianceX = ( + sum(p.real * p.real for p in nodes) + - (sumNodes.real * sumNodes.real) / n + ) / (n - 1) + self.varianceY = varianceY = ( + sum(p.imag * p.imag for p in nodes) + - (sumNodes.imag * sumNodes.imag) / n + ) / (n - 1) + + # Covariance(X,Y) = (sum[X.Y] - sum[X].sum[Y] / n) / (n - 1) + self.covariance = covariance = ( + sum(p.real * p.imag for p in nodes) + - (sumNodes.real * sumNodes.imag) / n + ) / (n - 1) + else: + self.varianceX = varianceX = 0 + self.varianceY = varianceY = 0 + self.covariance = covariance = 0 + + StatisticsBase._update(self) + + +def _test(glyphset, upem, glyphs, quiet=False, *, control=False): + from fontTools.pens.transformPen import TransformPen + from fontTools.misc.transform import Scale + + wght_sum = 0 + wght_sum_perceptual = 0 + wdth_sum = 0 + slnt_sum = 0 + slnt_sum_perceptual = 0 + for glyph_name in glyphs: + glyph = glyphset[glyph_name] + if control: + pen = StatisticsControlPen(glyphset=glyphset) + else: + pen = StatisticsPen(glyphset=glyphset) + transformer = TransformPen(pen, Scale(1.0 / upem)) + glyph.draw(transformer) + + area = abs(pen.area) + width = glyph.width + wght_sum += area + wght_sum_perceptual += pen.area * width + wdth_sum += width + slnt_sum += pen.slant + slnt_sum_perceptual += pen.slant * width + + if quiet: + continue + + print() + print("glyph:", glyph_name) + + for item in [ + "area", + "momentX", + "momentY", + "momentXX", + "momentYY", + "momentXY", + "meanX", + "meanY", + "varianceX", + "varianceY", + "stddevX", + "stddevY", + "covariance", + "correlation", + "slant", + ]: + print("%s: %g" % (item, getattr(pen, item))) + + if not quiet: + print() + print("font:") + + print("weight: %g" % (wght_sum * upem / wdth_sum)) + print("weight (perceptual): %g" % (wght_sum_perceptual / wdth_sum)) + print("width: %g" % (wdth_sum / upem / len(glyphs))) + slant = slnt_sum / len(glyphs) + print("slant: %g" % slant) + print("slant angle: %g" % -degrees(atan(slant))) + slant_perceptual = slnt_sum_perceptual / wdth_sum + print("slant (perceptual): %g" % slant_perceptual) + print("slant (perceptual) angle: %g" % -degrees(atan(slant_perceptual))) + + +def main(args): + """Report font glyph shape geometricsl statistics""" + + if args is None: + import sys + + args = sys.argv[1:] + + import argparse + + parser = argparse.ArgumentParser( + "fonttools pens.statisticsPen", + description="Report font glyph shape geometricsl statistics", + ) + parser.add_argument("font", metavar="font.ttf", help="Font file.") + parser.add_argument("glyphs", metavar="glyph-name", help="Glyph names.", nargs="*") + parser.add_argument( + "-y", + metavar="", + help="Face index into a collection to open. Zero based.", + ) + parser.add_argument( + "-c", + "--control", + action="store_true", + help="Use the control-box pen instead of the Green therem.", + ) + parser.add_argument( + "-q", "--quiet", action="store_true", help="Only report font-wide statistics." + ) + parser.add_argument( + "--variations", + metavar="AXIS=LOC", + default="", + help="List of space separated locations. A location consist in " + "the name of a variation axis, followed by '=' and a number. E.g.: " + "wght=700 wdth=80. The default is the location of the base master.", + ) + + options = parser.parse_args(args) + + glyphs = options.glyphs + fontNumber = int(options.y) if options.y is not None else 0 + + location = {} + for tag_v in options.variations.split(): + fields = tag_v.split("=") + tag = fields[0].strip() + v = int(fields[1]) + location[tag] = v + + from fontTools.ttLib import TTFont + + font = TTFont(options.font, fontNumber=fontNumber) + if not glyphs: + glyphs = font.getGlyphOrder() + _test( + font.getGlyphSet(location=location), + font["head"].unitsPerEm, + glyphs, + quiet=options.quiet, + control=options.control, + ) + + +if __name__ == "__main__": + import sys + + main(sys.argv[1:]) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/svgPathPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/svgPathPen.py new file mode 100644 index 0000000000000000000000000000000000000000..29d128da36c9d2f752617dbc143325c27e20f621 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/svgPathPen.py @@ -0,0 +1,310 @@ +from typing import Callable +from fontTools.pens.basePen import BasePen + + +def pointToString(pt, ntos=str): + return " ".join(ntos(i) for i in pt) + + +class SVGPathPen(BasePen): + """Pen to draw SVG path d commands. + + Args: + glyphSet: a dictionary of drawable glyph objects keyed by name + used to resolve component references in composite glyphs. + ntos: a callable that takes a number and returns a string, to + customize how numbers are formatted (default: str). + + :Example: + .. code-block:: + + >>> pen = SVGPathPen(None) + >>> pen.moveTo((0, 0)) + >>> pen.lineTo((1, 1)) + >>> pen.curveTo((2, 2), (3, 3), (4, 4)) + >>> pen.closePath() + >>> pen.getCommands() + 'M0 0 1 1C2 2 3 3 4 4Z' + + Note: + Fonts have a coordinate system where Y grows up, whereas in SVG, + Y grows down. As such, rendering path data from this pen in + SVG typically results in upside-down glyphs. You can fix this + by wrapping the data from this pen in an SVG group element with + transform, or wrap this pen in a transform pen. For example: + .. code-block:: python + + spen = svgPathPen.SVGPathPen(glyphset) + pen= TransformPen(spen , (1, 0, 0, -1, 0, 0)) + glyphset[glyphname].draw(pen) + print(tpen.getCommands()) + """ + + def __init__(self, glyphSet, ntos: Callable[[float], str] = str): + BasePen.__init__(self, glyphSet) + self._commands = [] + self._lastCommand = None + self._lastX = None + self._lastY = None + self._ntos = ntos + + def _handleAnchor(self): + """ + >>> pen = SVGPathPen(None) + >>> pen.moveTo((0, 0)) + >>> pen.moveTo((10, 10)) + >>> pen._commands + ['M10 10'] + """ + if self._lastCommand == "M": + self._commands.pop(-1) + + def _moveTo(self, pt): + """ + >>> pen = SVGPathPen(None) + >>> pen.moveTo((0, 0)) + >>> pen._commands + ['M0 0'] + + >>> pen = SVGPathPen(None) + >>> pen.moveTo((10, 0)) + >>> pen._commands + ['M10 0'] + + >>> pen = SVGPathPen(None) + >>> pen.moveTo((0, 10)) + >>> pen._commands + ['M0 10'] + """ + self._handleAnchor() + t = "M%s" % (pointToString(pt, self._ntos)) + self._commands.append(t) + self._lastCommand = "M" + self._lastX, self._lastY = pt + + def _lineTo(self, pt): + """ + # duplicate point + >>> pen = SVGPathPen(None) + >>> pen.moveTo((10, 10)) + >>> pen.lineTo((10, 10)) + >>> pen._commands + ['M10 10'] + + # vertical line + >>> pen = SVGPathPen(None) + >>> pen.moveTo((10, 10)) + >>> pen.lineTo((10, 0)) + >>> pen._commands + ['M10 10', 'V0'] + + # horizontal line + >>> pen = SVGPathPen(None) + >>> pen.moveTo((10, 10)) + >>> pen.lineTo((0, 10)) + >>> pen._commands + ['M10 10', 'H0'] + + # basic + >>> pen = SVGPathPen(None) + >>> pen.lineTo((70, 80)) + >>> pen._commands + ['L70 80'] + + # basic following a moveto + >>> pen = SVGPathPen(None) + >>> pen.moveTo((0, 0)) + >>> pen.lineTo((10, 10)) + >>> pen._commands + ['M0 0', ' 10 10'] + """ + x, y = pt + # duplicate point + if x == self._lastX and y == self._lastY: + return + # vertical line + elif x == self._lastX: + cmd = "V" + pts = self._ntos(y) + # horizontal line + elif y == self._lastY: + cmd = "H" + pts = self._ntos(x) + # previous was a moveto + elif self._lastCommand == "M": + cmd = None + pts = " " + pointToString(pt, self._ntos) + # basic + else: + cmd = "L" + pts = pointToString(pt, self._ntos) + # write the string + t = "" + if cmd: + t += cmd + self._lastCommand = cmd + t += pts + self._commands.append(t) + # store for future reference + self._lastX, self._lastY = pt + + def _curveToOne(self, pt1, pt2, pt3): + """ + >>> pen = SVGPathPen(None) + >>> pen.curveTo((10, 20), (30, 40), (50, 60)) + >>> pen._commands + ['C10 20 30 40 50 60'] + """ + t = "C" + t += pointToString(pt1, self._ntos) + " " + t += pointToString(pt2, self._ntos) + " " + t += pointToString(pt3, self._ntos) + self._commands.append(t) + self._lastCommand = "C" + self._lastX, self._lastY = pt3 + + def _qCurveToOne(self, pt1, pt2): + """ + >>> pen = SVGPathPen(None) + >>> pen.qCurveTo((10, 20), (30, 40)) + >>> pen._commands + ['Q10 20 30 40'] + >>> from fontTools.misc.roundTools import otRound + >>> pen = SVGPathPen(None, ntos=lambda v: str(otRound(v))) + >>> pen.qCurveTo((3, 3), (7, 5), (11, 4)) + >>> pen._commands + ['Q3 3 5 4', 'Q7 5 11 4'] + """ + assert pt2 is not None + t = "Q" + t += pointToString(pt1, self._ntos) + " " + t += pointToString(pt2, self._ntos) + self._commands.append(t) + self._lastCommand = "Q" + self._lastX, self._lastY = pt2 + + def _closePath(self): + """ + >>> pen = SVGPathPen(None) + >>> pen.closePath() + >>> pen._commands + ['Z'] + """ + self._commands.append("Z") + self._lastCommand = "Z" + self._lastX = self._lastY = None + + def _endPath(self): + """ + >>> pen = SVGPathPen(None) + >>> pen.endPath() + >>> pen._commands + [] + """ + self._lastCommand = None + self._lastX = self._lastY = None + + def getCommands(self): + return "".join(self._commands) + + +def main(args=None): + """Generate per-character SVG from font and text""" + + if args is None: + import sys + + args = sys.argv[1:] + + from fontTools.ttLib import TTFont + import argparse + + parser = argparse.ArgumentParser( + "fonttools pens.svgPathPen", description="Generate SVG from text" + ) + parser.add_argument("font", metavar="font.ttf", help="Font file.") + parser.add_argument("text", metavar="text", nargs="?", help="Text string.") + parser.add_argument( + "-y", + metavar="", + help="Face index into a collection to open. Zero based.", + ) + parser.add_argument( + "--glyphs", + metavar="whitespace-separated list of glyph names", + type=str, + help="Glyphs to show. Exclusive with text option", + ) + parser.add_argument( + "--variations", + metavar="AXIS=LOC", + default="", + help="List of space separated locations. A location consist in " + "the name of a variation axis, followed by '=' and a number. E.g.: " + "wght=700 wdth=80. The default is the location of the base master.", + ) + + options = parser.parse_args(args) + + fontNumber = int(options.y) if options.y is not None else 0 + + font = TTFont(options.font, fontNumber=fontNumber) + text = options.text + glyphs = options.glyphs + + location = {} + for tag_v in options.variations.split(): + fields = tag_v.split("=") + tag = fields[0].strip() + v = float(fields[1]) + location[tag] = v + + hhea = font["hhea"] + ascent, descent = hhea.ascent, hhea.descent + + glyphset = font.getGlyphSet(location=location) + cmap = font["cmap"].getBestCmap() + + if glyphs is not None and text is not None: + raise ValueError("Options --glyphs and --text are exclusive") + + if glyphs is None: + glyphs = " ".join(cmap[ord(u)] for u in text) + + glyphs = glyphs.split() + + s = "" + width = 0 + for g in glyphs: + glyph = glyphset[g] + + pen = SVGPathPen(glyphset) + glyph.draw(pen) + commands = pen.getCommands() + + s += '\n' % ( + width, + ascent, + commands, + ) + + width += glyph.width + + print('') + print( + '' + % (width, ascent - descent) + ) + print(s, end="") + print("") + + +if __name__ == "__main__": + import sys + + if len(sys.argv) == 1: + import doctest + + sys.exit(doctest.testmod().failed) + + sys.exit(main()) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/ttGlyphPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/ttGlyphPen.py new file mode 100644 index 0000000000000000000000000000000000000000..de2ccaeeb45c18c80caae049f3bd26b4ff22e99e --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/ttGlyphPen.py @@ -0,0 +1,335 @@ +from array import array +from typing import Any, Callable, Dict, Optional, Tuple +from fontTools.misc.fixedTools import MAX_F2DOT14, floatToFixedToFloat +from fontTools.misc.loggingTools import LogMixin +from fontTools.pens.pointPen import AbstractPointPen +from fontTools.misc.roundTools import otRound +from fontTools.pens.basePen import LoggingPen, PenError +from fontTools.pens.transformPen import TransformPen, TransformPointPen +from fontTools.ttLib.tables import ttProgram +from fontTools.ttLib.tables._g_l_y_f import flagOnCurve, flagCubic +from fontTools.ttLib.tables._g_l_y_f import Glyph +from fontTools.ttLib.tables._g_l_y_f import GlyphComponent +from fontTools.ttLib.tables._g_l_y_f import GlyphCoordinates +from fontTools.ttLib.tables._g_l_y_f import dropImpliedOnCurvePoints +import math + + +__all__ = ["TTGlyphPen", "TTGlyphPointPen"] + + +class _TTGlyphBasePen: + def __init__( + self, + glyphSet: Optional[Dict[str, Any]], + handleOverflowingTransforms: bool = True, + ) -> None: + """ + Construct a new pen. + + Args: + glyphSet (Dict[str, Any]): A glyphset object, used to resolve components. + handleOverflowingTransforms (bool): See below. + + If ``handleOverflowingTransforms`` is True, the components' transform values + are checked that they don't overflow the limits of a F2Dot14 number: + -2.0 <= v < +2.0. If any transform value exceeds these, the composite + glyph is decomposed. + + An exception to this rule is done for values that are very close to +2.0 + (both for consistency with the -2.0 case, and for the relative frequency + these occur in real fonts). When almost +2.0 values occur (and all other + values are within the range -2.0 <= x <= +2.0), they are clamped to the + maximum positive value that can still be encoded as an F2Dot14: i.e. + 1.99993896484375. + + If False, no check is done and all components are translated unmodified + into the glyf table, followed by an inevitable ``struct.error`` once an + attempt is made to compile them. + + If both contours and components are present in a glyph, the components + are decomposed. + """ + self.glyphSet = glyphSet + self.handleOverflowingTransforms = handleOverflowingTransforms + self.init() + + def _decompose( + self, + glyphName: str, + transformation: Tuple[float, float, float, float, float, float], + ): + tpen = self.transformPen(self, transformation) + getattr(self.glyphSet[glyphName], self.drawMethod)(tpen) + + def _isClosed(self): + """ + Check if the current path is closed. + """ + raise NotImplementedError + + def init(self) -> None: + self.points = [] + self.endPts = [] + self.types = [] + self.components = [] + + def addComponent( + self, + baseGlyphName: str, + transformation: Tuple[float, float, float, float, float, float], + identifier: Optional[str] = None, + **kwargs: Any, + ) -> None: + """ + Add a sub glyph. + """ + self.components.append((baseGlyphName, transformation)) + + def _buildComponents(self, componentFlags): + if self.handleOverflowingTransforms: + # we can't encode transform values > 2 or < -2 in F2Dot14, + # so we must decompose the glyph if any transform exceeds these + overflowing = any( + s > 2 or s < -2 + for (glyphName, transformation) in self.components + for s in transformation[:4] + ) + components = [] + for glyphName, transformation in self.components: + if glyphName not in self.glyphSet: + self.log.warning(f"skipped non-existing component '{glyphName}'") + continue + if self.points or (self.handleOverflowingTransforms and overflowing): + # can't have both coordinates and components, so decompose + self._decompose(glyphName, transformation) + continue + + component = GlyphComponent() + component.glyphName = glyphName + component.x, component.y = (otRound(v) for v in transformation[4:]) + # quantize floats to F2Dot14 so we get same values as when decompiled + # from a binary glyf table + transformation = tuple( + floatToFixedToFloat(v, 14) for v in transformation[:4] + ) + if transformation != (1, 0, 0, 1): + if self.handleOverflowingTransforms and any( + MAX_F2DOT14 < s <= 2 for s in transformation + ): + # clamp values ~= +2.0 so we can keep the component + transformation = tuple( + MAX_F2DOT14 if MAX_F2DOT14 < s <= 2 else s + for s in transformation + ) + component.transform = (transformation[:2], transformation[2:]) + component.flags = componentFlags + components.append(component) + return components + + def glyph( + self, + componentFlags: int = 0x04, + dropImpliedOnCurves: bool = False, + *, + round: Callable[[float], int] = otRound, + ) -> Glyph: + """ + Returns a :py:class:`~._g_l_y_f.Glyph` object representing the glyph. + + Args: + componentFlags: Flags to use for component glyphs. (default: 0x04) + + dropImpliedOnCurves: Whether to remove implied-oncurve points. (default: False) + """ + if not self._isClosed(): + raise PenError("Didn't close last contour.") + components = self._buildComponents(componentFlags) + + glyph = Glyph() + glyph.coordinates = GlyphCoordinates(self.points) + glyph.endPtsOfContours = self.endPts + glyph.flags = array("B", self.types) + self.init() + + if components: + # If both components and contours were present, they have by now + # been decomposed by _buildComponents. + glyph.components = components + glyph.numberOfContours = -1 + else: + glyph.numberOfContours = len(glyph.endPtsOfContours) + glyph.program = ttProgram.Program() + glyph.program.fromBytecode(b"") + if dropImpliedOnCurves: + dropImpliedOnCurvePoints(glyph) + glyph.coordinates.toInt(round=round) + + return glyph + + +class TTGlyphPen(_TTGlyphBasePen, LoggingPen): + """ + Pen used for drawing to a TrueType glyph. + + This pen can be used to construct or modify glyphs in a TrueType format + font. After using the pen to draw, use the ``.glyph()`` method to retrieve + a :py:class:`~._g_l_y_f.Glyph` object representing the glyph. + """ + + drawMethod = "draw" + transformPen = TransformPen + + def __init__( + self, + glyphSet: Optional[Dict[str, Any]] = None, + handleOverflowingTransforms: bool = True, + outputImpliedClosingLine: bool = False, + ) -> None: + super().__init__(glyphSet, handleOverflowingTransforms) + self.outputImpliedClosingLine = outputImpliedClosingLine + + def _addPoint(self, pt: Tuple[float, float], tp: int) -> None: + self.points.append(pt) + self.types.append(tp) + + def _popPoint(self) -> None: + self.points.pop() + self.types.pop() + + def _isClosed(self) -> bool: + return (not self.points) or ( + self.endPts and self.endPts[-1] == len(self.points) - 1 + ) + + def lineTo(self, pt: Tuple[float, float]) -> None: + self._addPoint(pt, flagOnCurve) + + def moveTo(self, pt: Tuple[float, float]) -> None: + if not self._isClosed(): + raise PenError('"move"-type point must begin a new contour.') + self._addPoint(pt, flagOnCurve) + + def curveTo(self, *points) -> None: + assert len(points) % 2 == 1 + for pt in points[:-1]: + self._addPoint(pt, flagCubic) + + # last point is None if there are no on-curve points + if points[-1] is not None: + self._addPoint(points[-1], 1) + + def qCurveTo(self, *points) -> None: + assert len(points) >= 1 + for pt in points[:-1]: + self._addPoint(pt, 0) + + # last point is None if there are no on-curve points + if points[-1] is not None: + self._addPoint(points[-1], 1) + + def closePath(self) -> None: + endPt = len(self.points) - 1 + + # ignore anchors (one-point paths) + if endPt == 0 or (self.endPts and endPt == self.endPts[-1] + 1): + self._popPoint() + return + + if not self.outputImpliedClosingLine: + # if first and last point on this path are the same, remove last + startPt = 0 + if self.endPts: + startPt = self.endPts[-1] + 1 + if self.points[startPt] == self.points[endPt]: + self._popPoint() + endPt -= 1 + + self.endPts.append(endPt) + + def endPath(self) -> None: + # TrueType contours are always "closed" + self.closePath() + + +class TTGlyphPointPen(_TTGlyphBasePen, LogMixin, AbstractPointPen): + """ + Point pen used for drawing to a TrueType glyph. + + This pen can be used to construct or modify glyphs in a TrueType format + font. After using the pen to draw, use the ``.glyph()`` method to retrieve + a :py:class:`~._g_l_y_f.Glyph` object representing the glyph. + """ + + drawMethod = "drawPoints" + transformPen = TransformPointPen + + def init(self) -> None: + super().init() + self._currentContourStartIndex = None + + def _isClosed(self) -> bool: + return self._currentContourStartIndex is None + + def beginPath(self, identifier: Optional[str] = None, **kwargs: Any) -> None: + """ + Start a new sub path. + """ + if not self._isClosed(): + raise PenError("Didn't close previous contour.") + self._currentContourStartIndex = len(self.points) + + def endPath(self) -> None: + """ + End the current sub path. + """ + # TrueType contours are always "closed" + if self._isClosed(): + raise PenError("Contour is already closed.") + if self._currentContourStartIndex == len(self.points): + # ignore empty contours + self._currentContourStartIndex = None + return + + contourStart = self.endPts[-1] + 1 if self.endPts else 0 + self.endPts.append(len(self.points) - 1) + self._currentContourStartIndex = None + + # Resolve types for any cubic segments + flags = self.types + for i in range(contourStart, len(flags)): + if flags[i] == "curve": + j = i - 1 + if j < contourStart: + j = len(flags) - 1 + while flags[j] == 0: + flags[j] = flagCubic + j -= 1 + flags[i] = flagOnCurve + + def addPoint( + self, + pt: Tuple[float, float], + segmentType: Optional[str] = None, + smooth: bool = False, + name: Optional[str] = None, + identifier: Optional[str] = None, + **kwargs: Any, + ) -> None: + """ + Add a point to the current sub path. + """ + if self._isClosed(): + raise PenError("Can't add a point to a closed contour.") + if segmentType is None: + self.types.append(0) + elif segmentType in ("line", "move"): + self.types.append(flagOnCurve) + elif segmentType == "qcurve": + self.types.append(flagOnCurve) + elif segmentType == "curve": + self.types.append("curve") + else: + raise AssertionError(segmentType) + + self.points.append(pt) diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/wxPen.py b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/wxPen.py new file mode 100644 index 0000000000000000000000000000000000000000..c790641a23c0950d492df2082b7a9b6a9d53cb53 --- /dev/null +++ b/mantis_evalkit/lib/python3.10/site-packages/fontTools/pens/wxPen.py @@ -0,0 +1,29 @@ +from fontTools.pens.basePen import BasePen + + +__all__ = ["WxPen"] + + +class WxPen(BasePen): + def __init__(self, glyphSet, path=None): + BasePen.__init__(self, glyphSet) + if path is None: + import wx + + path = wx.GraphicsRenderer.GetDefaultRenderer().CreatePath() + self.path = path + + def _moveTo(self, p): + self.path.MoveToPoint(*p) + + def _lineTo(self, p): + self.path.AddLineToPoint(*p) + + def _curveToOne(self, p1, p2, p3): + self.path.AddCurveToPoint(*p1 + p2 + p3) + + def _qCurveToOne(self, p1, p2): + self.path.AddQuadCurveToPoint(*p1 + p2) + + def _closePath(self): + self.path.CloseSubpath() diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_B_D_T_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_B_D_T_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..313f1ba7f3ad7d0602477f8ccddd87caa43e5a73 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_B_D_T_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_B_L_C_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_B_L_C_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41782ae12679a90824486a4336eae67204515892 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_B_L_C_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_F_F_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_F_F_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da94944032fcb154248e6431c616b5af10179c09 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/C_F_F_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/D_S_I_G_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/D_S_I_G_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dedc152a884c92050db7b4ad73c94123e5b14461 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/D_S_I_G_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/D__e_b_g.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/D__e_b_g.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0c28f59b90d773007e407fcb227f39c68409ab4 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/D__e_b_g.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/DefaultTable.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/DefaultTable.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d25b5ab0c07620c7b7ccf1d54741bad8b228dbb9 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/DefaultTable.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/E_B_D_T_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/E_B_D_T_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ef7de7f2dd3e0afe380050a188636a9e0c4c58f Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/E_B_D_T_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/F_F_T_M_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/F_F_T_M_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9c20866064937f84007d655d89cd8140a25c5245 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/F_F_T_M_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G_M_A_P_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G_M_A_P_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af14b8b14e4bdf99dcea0721049d32868b54841b Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G_M_A_P_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G_P_K_G_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G_P_K_G_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83c0d82bc1977217626e71d89f373ed2ab3e9ad3 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G_P_K_G_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G__l_a_t.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G__l_a_t.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d81b400de527595b880971320196d13018ad15f4 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/G__l_a_t.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/H_V_A_R_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/H_V_A_R_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..151fbb64804c91491f4cd4dc16a0cbff5adf2a2b Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/H_V_A_R_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/M_E_T_A_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/M_E_T_A_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b1b16fc99263cb4dcc98dcdf8a3362f03a20a901 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/M_E_T_A_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_I_N_G_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_I_N_G_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21f7303d89e3f65bc58a44927d1f9ff6cf8069e7 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_I_N_G_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_T_A_T_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_T_A_T_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e5d79e49ecd603296bd5b5d32c86467b49d1f9c Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_T_A_T_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_V_G_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_V_G_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a32809a5431e37159e8a7635ab7b87974c31cb3a Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S_V_G_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S__i_l_f.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S__i_l_f.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7441847efbcc682d30523eb960313cd2571f6a4 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/S__i_l_f.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_B_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_B_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ab95c6e79eb49ea0da7015e0044207a85f47a40 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_B_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_D_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_D_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d2220268d3d0d3d5d1be3775f3f754421d238d6 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_D_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_V_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_V_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5818ba3dca1477744fc2a23b798889ef58608a94 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I_V_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__0.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__0.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1fde8715f70323246b24df41579b8a3383293c7 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__0.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__1.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__1.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed0445ded878b2346ddc50912178ca7c6f73746c Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__1.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__2.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__2.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..886a74577860c9a618070041fe1620353c0ced81 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/T_S_I__2.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/V_A_R_C_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/V_A_R_C_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dea0216b8be16633a6ff0b8d1ec49123ebd65e31 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/V_A_R_C_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/V_D_M_X_.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/V_D_M_X_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f86229a3fb36fb58918aa3de9665c98ce32acf73 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/V_D_M_X_.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/__init__.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..419858c20f4324e502b8933704717451fa12dc21 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/__init__.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_a_v_a_r.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_a_v_a_r.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3dc63090cbf9b8ad5c40d22bda8cb39f5f8a92b Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_a_v_a_r.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_b_s_l_n.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_b_s_l_n.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aba320f7b28e31fc4ef75a24f5d55e5b773d0c49 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_b_s_l_n.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_c_i_d_g.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_c_i_d_g.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..146cd2168b66161fffa702c144b882a52fb72b31 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_c_i_d_g.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_f_v_a_r.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_f_v_a_r.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c48dfa5028cd8c3f036f86da6100be10c5766551 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_f_v_a_r.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_d_m_x.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_d_m_x.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60745c32c22cb90bf9f53f32066a590c99cf3fdd Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_d_m_x.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_e_a_d.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_e_a_d.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..302766a79a1f415aab5a2ca45d00d9192df16777 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_e_a_d.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_m_t_x.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_m_t_x.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5600dbf09aecc48b5e52262ae94ed31440cee8a Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_h_m_t_x.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_l_o_c_a.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_l_o_c_a.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ab0780a9a84c481cabac28d1cf4d90bce94dd00 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_l_o_c_a.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_m_a_x_p.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_m_a_x_p.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c079774abd003644dfd89f9b92a3f992893e066b Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_m_a_x_p.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_n_a_m_e.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_n_a_m_e.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..820cece3ad28659553c17d7c2403a0a080919c2e Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_n_a_m_e.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_o_p_b_d.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_o_p_b_d.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e71cb5253c2e1e905dae2f900a27d63864572de Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_o_p_b_d.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_p_o_s_t.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_p_o_s_t.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dfe98515819ceb7a4b98eb0344b3869068d6f4d9 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_p_o_s_t.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_p_r_e_p.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_p_r_e_p.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e58b88479a7ca24ff9403be02ad768e20998dd3b Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_p_r_e_p.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_s_b_i_x.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_s_b_i_x.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9e5cebde70d610562b7454bd0c6ce0befa87f30 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_s_b_i_x.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_t_r_a_k.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_t_r_a_k.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83a327a868419fb4affd8765500fce9dab7fc0ad Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_t_r_a_k.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_v_m_t_x.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_v_m_t_x.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b89b941b46450261e8a83f777c93e83672719031 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/_v_m_t_x.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/asciiTable.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/asciiTable.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4fb3834db9c005d5dfa3ea060ae8e0b375d5b7cd Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/asciiTable.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/grUtils.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/grUtils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0be99c3f8f87657a49b81a3ef681e0b078f030d Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/grUtils.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/otBase.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/otBase.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3968f001b37ee7d49904215da6a3586d34e4cf96 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/otBase.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/otTraverse.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/otTraverse.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a062404cbb91b417caf66b7d6cd9c84cafb9b7d6 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/otTraverse.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/sbixGlyph.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/sbixGlyph.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f51e0bf237f1c20eb53861de693ed9fe85bb8fd Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/sbixGlyph.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/sbixStrike.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/sbixStrike.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4dbf2420fa0d59e745638f79a05607f7043d4126 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/sbixStrike.cpython-310.pyc differ diff --git a/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/ttProgram.cpython-310.pyc b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/ttProgram.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b09086b5e56fde1946f2ced62ea151c75457244 Binary files /dev/null and b/mantis_evalkit/lib/python3.10/site-packages/fontTools/ttLib/tables/__pycache__/ttProgram.cpython-310.pyc differ