id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
175,262
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,263
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,264
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,265
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,266
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,267
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,268
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,269
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,270
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,271
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,272
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,273
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,274
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,275
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,276
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,277
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,278
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,279
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,280
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,281
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,282
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,283
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,284
import os import copy import enum from operator import ior import logging from fontTools.colorLib.builder import MAX_PAINT_COLR_LAYER_COUNT, LayerReuseCache from fontTools.misc import classifyTools from fontTools.misc.roundTools import otRound from fontTools.misc.treeTools import build_n_ary_tree from fontTools.ttLib.t...
null
175,285
from fontTools.pens.basePen import AbstractPen, BasePen from fontTools.pens.pointPen import SegmentToPointPen from fontTools.pens.recordingPen import RecordingPen from fontTools.pens.statisticsPen import StatisticsPen from fontTools.pens.momentsPen import OpenContourError from collections import OrderedDict import iter...
Rotate list by k items forward. Ie. item at position 0 will be at position k in returned list. Negative k is allowed.
175,286
from fontTools.pens.basePen import AbstractPen, BasePen from fontTools.pens.pointPen import SegmentToPointPen from fontTools.pens.recordingPen import RecordingPen from fontTools.pens.statisticsPen import StatisticsPen from fontTools.pens.momentsPen import OpenContourError from collections import OrderedDict import iter...
null
175,287
from fontTools.pens.basePen import AbstractPen, BasePen from fontTools.pens.pointPen import SegmentToPointPen from fontTools.pens.recordingPen import RecordingPen from fontTools.pens.statisticsPen import StatisticsPen from fontTools.pens.momentsPen import OpenContourError from collections import OrderedDict import iter...
null
175,288
from fontTools.pens.basePen import AbstractPen, BasePen from fontTools.pens.pointPen import SegmentToPointPen from fontTools.pens.recordingPen import RecordingPen from fontTools.pens.statisticsPen import StatisticsPen from fontTools.pens.momentsPen import OpenContourError from collections import OrderedDict import iter...
null
175,289
from fontTools.pens.basePen import AbstractPen, BasePen from fontTools.pens.pointPen import SegmentToPointPen from fontTools.pens.recordingPen import RecordingPen from fontTools.pens.statisticsPen import StatisticsPen from fontTools.pens.momentsPen import OpenContourError from collections import OrderedDict import iter...
null
175,290
from fontTools.misc.roundTools import noRound from .errors import VariationModelError def subList(truth, lst): assert len(truth) == len(lst) return [l for l, t in zip(lst, truth) if t]
null
175,291
from fontTools.misc.dictTools import hashdict from fontTools.misc.intTools import popCount from fontTools.ttLib import newTable from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.ttVisitor import TTVisitor from fontTools.otlLib.builder import buildLookup, buildSingleSubstSubtable from collections im...
Add conditional substitutions to a Variable Font. The `conditionalSubstitutions` argument is a list of (Region, Substitutions) tuples. A Region is a list of Boxes. A Box is a dict mapping axisTags to (minValue, maxValue) tuples. Irrelevant axes may be omitted and they are interpretted as extending to end of axis in eac...
175,292
from typing import ( Sequence, Tuple, Union, ) from numbers import Integral, Real _PointSegment = Sequence[_Point] _DeltaSegment = Sequence[_Delta] _DeltaOrNoneSegment = Sequence[_DeltaOrNone] _Endpoints = Sequence[Integral] def iup_contour_optimize( deltas: _DeltaSegment, coords: _PointSegment, toleran...
For the outline given in `coords`, with contour endpoints given in sorted increasing order in `ends`, optimize a set of delta values `deltas` within error `tolerance`. Returns delta vector that has most number of None items instead of the input delta.
175,293
from contextlib import contextmanager from copy import deepcopy from enum import IntEnum import re def getVariationNameIDs(varfont): used = [] if "fvar" in varfont: fvar = varfont["fvar"] for axis in fvar.axes: used.append(axis.axisNameID) for instance in fvar.instances: ...
null
175,294
from contextlib import contextmanager from copy import deepcopy from enum import IntEnum import re ELIDABLE_AXIS_VALUE_NAME = 2 def checkAxisValuesExist(stat, axisValues, axisCoords): seen = set() designAxes = stat.DesignAxisRecord.Axis for axisValueTable in axisValues: axisValueFormat = axisValueTa...
Update instatiated variable font's name table using STAT AxisValues. Raises ValueError if the STAT table is missing or an Axis Value table is missing for requested axis locations. First, collect all STAT AxisValues that match the new default axis locations (excluding "elided" ones); concatenate the strings in design ax...
175,295
from fontTools.varLib.models import supportScalar, normalizeValue from fontTools.misc.fixedTools import MAX_F2DOT14 from functools import lru_cache def _solve(tent, axisLimit, negative=False): axisMin, axisDef, axisMax = axisLimit lower, peak, upper = tent # Mirror the problem such that axisDef <= peak ...
Given a tuple (lower,peak,upper) "tent" and new axis limits (axisMin,axisDefault,axisMax), solves how to represent the tent under the new axis configuration. All values are in normalized -1,0,+1 coordinate system. Tent values can be outside this range. Return value is a list of tuples. Each tuple is of the form (scalar...
175,296
from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import normalizeValue from copy import deepcopy import logging log = logging.getLogger("fontTools.varLib.instancer") def _instantiateFeatureVariations(table, fvarAxes, axisLimits): pinnedAxes = set(axisLimits.pinnedLocation()) axisOr...
null
175,297
from fontTools.ttLib import TTFont from fontTools.varLib import models, VarLibError, load_designspace, load_masters from fontTools.varLib.merger import InstancerMerger import os.path import logging from copy import deepcopy from pprint import pformat log = logging.getLogger("fontTools.varLib.interpolate_layout") def l...
Interpolate GPOS from a designspace file and location. If master_finder is set, it should be a callable that takes master filename as found in designspace file and map it to master font binary as to be opened (eg. .ttf or .otf). If mapped is False (default), then location is mapped using the map element of the axes in ...
175,298
from fontTools.misc.fixedTools import floatToFixedToFloat, floatToFixed from fontTools.misc.roundTools import otRound from fontTools.pens.boundsPen import BoundsPen from fontTools.ttLib import TTFont, newTable from fontTools.ttLib.tables import ttProgram from fontTools.ttLib.tables._g_l_y_f import ( GlyphCoordinate...
Generate a static instance from a variable TTFont and a dictionary defining the desired location along the variable font's axes. The location values must be specified as user-space coordinates, e.g.: {'wght': 400, 'wdth': 100} By default, a new TTFont object is returned. If ``inplace`` is True, the input varfont is mod...
175,299
from collections import namedtuple from fontTools.cffLib import ( maxStackLimit, TopDictIndex, buildOrder, topDictOperators, topDictOperators2, privateDictOperators, privateDictOperators2, FDArrayIndex, FontDict, VarStoreData, ) from io import BytesIO from fontTools.cffLib.specia...
null
175,300
from collections import namedtuple from fontTools.cffLib import ( maxStackLimit, TopDictIndex, buildOrder, topDictOperators, topDictOperators2, privateDictOperators, privateDictOperators2, FDArrayIndex, FontDict, VarStoreData, ) from io import BytesIO from fontTools.cffLib.specia...
null
175,301
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,302
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,303
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,304
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,305
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,306
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
Remove unused VarRegions.
175,307
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,308
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
null
175,309
from fontTools.misc.roundTools import noRound, otRound from fontTools.ttLib.tables import otTables as ot from fontTools.varLib.models import supportScalar from fontTools.varLib.builder import ( buildVarRegionList, buildVarStore, buildVarRegion, buildVarData, ) from functools import partial from collecti...
Optimize storage. Returns mapping from old VarIdxes to new ones.
175,310
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot def buildVarRegion(support, axisTags): ot.VarData.calculateNumShorts = VarData_calculateNumShorts ot.VarData.optimize = VarData_optimize def buildVarRegionList(supports, axisTags): self = ot.VarRegionList() self.RegionAxisCount = len...
null
175,311
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot def VarData_calculateNumShorts(self, optimize=False): count = self.VarRegionCount items = self.Item bit_lengths = [0] * count for item in items: # The "+ (i < -1)" magic is to handle two's-compliment. # That is...
Deprecated name for VarData_calculateNumShorts() which defaults to optimize=True. Use varData.calculateNumShorts() or varData.optimize().
175,312
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot def VarData_calculateNumShorts(self, optimize=False): count = self.VarRegionCount items = self.Item bit_lengths = [0] * count for item in items: # The "+ (i < -1)" magic is to handle two's-compliment. # That is...
null
175,313
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot ot.VarData.calculateNumShorts = VarData_calculateNumShorts ot.VarData.optimize = VarData_optimize def buildVarData(varRegionIndices, items, optimize=True): self = ot.VarData() self.VarRegionIndex = list(varRegionIndices) regionCo...
null
175,314
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot ot.VarData.calculateNumShorts = VarData_calculateNumShorts ot.VarData.optimize = VarData_optimize def buildVarStore(varRegionList, varDataList): self = ot.VarStore() self.Format = 1 self.VarRegionList = varRegionList self.Var...
null
175,315
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot ot.VarData.calculateNumShorts = VarData_calculateNumShorts ot.VarData.optimize = VarData_optimize def buildVarIdxMap(varIdxes, glyphOrder): self = ot.VarIdxMap() self.mapping = {g: v for g, v in zip(glyphOrder, varIdxes)} return ...
null
175,316
from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot ot.VarData.calculateNumShorts = VarData_calculateNumShorts ot.VarData.optimize = VarData_optimize def buildDeltaSetIndexMap(varIdxes): self = ot.DeltaSetIndexMap() self.mapping = list(varIdxes) self.Format = 1 if len(varIdxes) > ...
null
175,317
from fontTools.varLib.models import VariationModel, supportScalar from fontTools.designspaceLib import DesignSpaceDocument from matplotlib import pyplot from mpl_toolkits.mplot3d import axes3d from itertools import cycle import math import logging import sys def plotLocations(locations, fig, names=None, **kwargs): ...
null
175,318
from fontTools.varLib.models import VariationModel, supportScalar from fontTools.designspaceLib import DesignSpaceDocument from matplotlib import pyplot from mpl_toolkits.mplot3d import axes3d from itertools import cycle import math import logging import sys def _plotModelFromMasters2D(model, masterValues, fig, **kwarg...
Plot a variation model and set of master values corresponding to the locations to the model into a pyplot figure. Variation model must have axisOrder of size 1 or 2.
175,319
from fontTools.merge.unicode import is_Default_Ignorable from fontTools.pens.recordingPen import DecomposingRecordingPen import logging The provided code snippet includes necessary dependencies for implementing the `computeMegaGlyphOrder` function. Write a Python function `def computeMegaGlyphOrder(merger, glyphOrders...
Modifies passed-in glyphOrders to reflect new glyph names. Stores merger.glyphOrder.
175,320
from fontTools.merge.unicode import is_Default_Ignorable from fontTools.pens.recordingPen import DecomposingRecordingPen import logging class DecomposingRecordingPen(DecomposingPen, RecordingPen): """Same as RecordingPen, except that it doesn't keep components as references, but draws them decomposed as regula...
null
175,321
from fontTools.merge.unicode import is_Default_Ignorable from fontTools.pens.recordingPen import DecomposingRecordingPen import logging The provided code snippet includes necessary dependencies for implementing the `renameCFFCharStrings` function. Write a Python function `def renameCFFCharStrings(merger, glyphOrder, c...
Rename topDictIndex charStrings based on glyphOrder.
175,322
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def first(lst): return next(iter(lst)) def equal(lst): lst = list(lst) t = iter(lst) first = next(t) assert all(item == first fo...
null
175,323
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def recalculate(lst): return NotImplemented
null
175,324
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def timestampNow(): # https://reproducible-builds.org/specs/source-date-epoch/ source_date_epoch = os.environ.get("SOURCE_DATE_EPOCH") i...
null
175,325
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... def reduce(function: Callable[[_T, _T], _T], sequence: ...
null
175,326
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... def reduce(function: Callable[[_T, _T], _T], sequence: ...
null
175,327
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def avg_int(lst): lst = list(lst) return sum(lst) // len(lst)
null
175,328
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging The provided code snippet includes necessary dependencies for implementing the `onlyExisting` function. Write a Python function `def onlyExisting(fu...
Returns a filter func that when called with a list, only calls func on the non-NotImplemented items of the list, and only so if there's at least one item remaining. Otherwise returns NotImplemented.
175,329
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def sumLists(lst): l = [] for item in lst: l.extend(item) return l
null
175,330
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def sumDicts(lst): d = {} for item in lst: d.update(item) return d
null
175,331
from fontTools.misc.timeTools import timestampNow from fontTools.ttLib.tables.DefaultTable import DefaultTable from functools import reduce import operator import logging def mergeBits(bitmap): def wrapper(lst): lst = list(lst) returnValue = 0 for bitNumber in range(bitmap["size"]): ...
null
175,332
from fontTools import ttLib, cffLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.cmap import computeMegaCmap from fontTools.merge.util import * import logging os2FsTypeMergeBitMap = { "size": 16, "*": lambda bit: 0, ...
null
175,333
from fontTools import ttLib, cffLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.cmap import computeMegaCmap from fontTools.merge.util import * import logging class DefaultTable(object): def __init__(self, tag=None): ...
null
175,334
from fontTools import ttLib, cffLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.cmap import computeMegaCmap from fontTools.merge.util import * import logging class DefaultTable(object): dependencies = [] def __ini...
null
175,335
from fontTools import ttLib, cffLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.cmap import computeMegaCmap from fontTools.merge.util import * import logging log = logging.getLogger("fontTools.merge") def merge(self, m, tab...
null
175,336
from fontTools import ttLib, cffLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.cmap import computeMegaCmap from fontTools.merge.util import * import logging ttLib.getTableClass("maxp").mergeMap = { "*": max, "tableT...
null
175,337
from fontTools import ttLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.ttLib.tables import otTables from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.util import * import logging def mergeScripts(lst): assert lst if len(lst) == 1: return lst[...
null
175,338
from fontTools import ttLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.ttLib.tables import otTables from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.util import * import logging log = logging.getLogger("fontTools.merge") otTables.ScriptList.mergeMap = { ...
null
175,339
from fontTools import ttLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.ttLib.tables import otTables from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.util import * import logging def mapLookups(self, lookupMap): pass otTables.ContextSubst, otTabl...
null
175,340
from fontTools import ttLib from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.ttLib.tables import otTables from fontTools.merge.base import add_method, mergeObjects from fontTools.merge.util import * import logging def mapLookups(self, lookupMap): pass otTables.ContextSubst, otTabl...
null
175,341
from fontTools.ttLib.tables.DefaultTable import DefaultTable import logging class DefaultTable(object): dependencies = [] def __init__(self, tag=None): if tag is None: tag = getClassTag(self.__class__) self.tableTag = Tag(tag) def decompile(self, data, ttFont): self.d...
Returns a decorator function that adds a new method to one or more classes.
175,342
from fontTools.ttLib.tables.DefaultTable import DefaultTable import logging log = logging.getLogger("fontTools.merge") def mergeObjects(lst): lst = [item for item in lst if item is not NotImplemented] if not lst: return NotImplemented lst = [item for item in lst if item is not None] if not lst: ...
null
175,343
import re def readlines(path): with open(path, "r", encoding="ascii") as f: data = f.read() return data.splitlines()
null
175,344
import re def writelines(path, lines, sep="\r"): with open(path, "w", encoding="ascii", newline=sep) as f: f.write("\n".join(lines) + "\n")
null
175,345
from fontTools.ttLib import TTFont, TTLibError from fontTools.misc.macCreatorType import getMacCreatorAndType from fontTools.unicode import setUnicodeData from fontTools.misc.textTools import Tag, tostr from fontTools.misc.timeTools import timestampSinceEpoch from fontTools.misc.loggingTools import Timer from fontTools...
null
175,346
from fontTools.ttLib import TTFont, TTLibError from fontTools.misc.macCreatorType import getMacCreatorAndType from fontTools.unicode import setUnicodeData from fontTools.misc.textTools import Tag, tostr from fontTools.misc.timeTools import timestampSinceEpoch from fontTools.misc.loggingTools import Timer from fontTools...
null
175,347
import os import argparse import logging from fontTools.misc.cliTools import makeOutputFileName from fontTools.ttLib import TTFont from fontTools.pens.qu2cuPen import Qu2CuPen from fontTools.pens.ttGlyphPen import TTGlyphPen import fontTools logger = logging.getLogger("fontTools.qu2cu") class Qu2CuPen(ContourFilterPen...
null
175,348
from fontTools.misc.bezierTools import splitCubicAtTC from collections import namedtuple import math from typing import ( List, Tuple, Union, ) def add_implicit_on_curves(p): q = list(p) count = 0 num_offcurves = len(p) - 2 for i in range(1, num_offcurves): off1 = p[i] off2 =...
Converts a connecting list of quadratic splines to a list of quadratic and cubic curves. A quadratic spline is specified as a list of points. Either each point is a 2-tuple of X,Y coordinates, or each point is a complex number with real/imaginary components representing X,Y coordinates. The first and last points are on...
175,349
from .qu2cu import * from fontTools.cu2qu import curve_to_quadratic import random import timeit MAX_ERR = 0.5 NUM_CURVES = 5 def generate_curves(n): ) ) ) ) ) ) def setup_quadratic_to_curves(): curves = generate_cu...
null
175,350
from .qu2cu import * from fontTools.cu2qu import curve_to_quadratic import random import timeit ) ) ) ) ) ) def run_benchmark(module, function, setup_suffix="", repeat=25, number=1): setup_func = "setup_" + functio...
null
175,351
def maxCtxSubtable(maxCtx, tag, lookupType, st): """Calculate usMaxContext based on a single lookup table (and an existing max value). """ # single positioning, single / multiple substitution if (tag == "GPOS" and lookupType == 1) or ( tag == "GSUB" and lookupType in (1, 2, 3) ): ...
Calculate the usMaxContext value for an entire font.
175,352
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds a multiple substitution (GSUB2) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.MultipleSubstBuilder` instead. Example:: # sub uni06C0 by uni06D5.fina hamza.above # sub uni06C2 by uni06C1.fina hamza.above; subtable = b...
175,353
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds an alternate substitution (GSUB3) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.AlternateSubstBuilder` instead. Args: mapping: A dictionary mapping input glyph names to a list of output glyph names. Returns: An ``otT...
175,354
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds a ligature substitution (GSUB4) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.LigatureSubstBuilder` instead. Example:: # sub f f i by f_f_i; # sub f i by f_i; subtable = buildLigatureSubstSubtable({ ("f", "f", "i"): ...
175,355
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds an Anchor table. This determines the appropriate anchor format based on the passed parameters. Args: x (int): X coordinate. y (int): Y coordinate. point (int): Index of glyph contour point, if provided. deviceX (``otTables.Device``): X coordinate device table, if provided. deviceY (``otTables.Device``): Y coordi...
175,356
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds a cursive positioning (GPOS3) subtable. Cursive positioning lookups are made up of a coverage table of glyphs, and a set of ``EntryExitRecord`` records containing the anchors for each glyph. This function builds the cursive positioning subtable. Example:: subtable = buildCursivePosSubtable({ "AlifIni": (None, bu...
175,357
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds a Device record as part of a ValueRecord or Anchor. Device tables specify size-specific adjustments to value records and anchors to reflect changes based on the resolution of the output. For example, one could specify that an anchor's Y position should be increased by 1 pixel when displayed at 8 pixels per em. T...
175,358
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Build a list of MarkBasePos (GPOS4) subtables. This routine turns a set of marks and bases into a list of mark-to-base positioning subtables. Currently the list will contain a single subtable containing all marks and bases, although at a later date it may return the optimal list of subtables subsetting the marks and ba...
175,359
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Build a list of MarkLigPos (GPOS5) subtables. This routine turns a set of marks and ligatures into a list of mark-to-ligature positioning subtables. Currently the list will contain a single subtable containing all marks and ligatures, although at a later date it may return the optimal list of subtables subsetting the m...
175,360
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
null
175,361
from collections import namedtuple, OrderedDict import os from fontTools.misc.fixedTools import fixedToFloat from fontTools import ttLib from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables.otBase import ( ValueRecord, valueRecordFormatDict, OTTableWriter, CountReference, ) from...
Builds a list of glyph-based pair adjustment (GPOS2 format 1) subtables. This organises a list of pair positioning adjustments into subtables based on common value record formats. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.PairPos...