re-run black v23.10 on all .py files
This commit is contained in:
parent
d210cc5ac1
commit
335a1e56ec
@ -119,7 +119,6 @@ class error(Exception):
|
|||||||
|
|
||||||
|
|
||||||
class AFM(object):
|
class AFM(object):
|
||||||
|
|
||||||
_attrs = None
|
_attrs = None
|
||||||
|
|
||||||
_keywords = [
|
_keywords = [
|
||||||
|
@ -1000,7 +1000,6 @@ class TopDictIndex(Index):
|
|||||||
|
|
||||||
|
|
||||||
class FDArrayIndex(Index):
|
class FDArrayIndex(Index):
|
||||||
|
|
||||||
compilerClass = FDArrayIndexCompiler
|
compilerClass = FDArrayIndexCompiler
|
||||||
|
|
||||||
def toXML(self, xmlWriter):
|
def toXML(self, xmlWriter):
|
||||||
@ -2483,7 +2482,6 @@ def encodeNumber(num):
|
|||||||
|
|
||||||
|
|
||||||
class TopDictCompiler(DictCompiler):
|
class TopDictCompiler(DictCompiler):
|
||||||
|
|
||||||
opcodes = buildOpcodeDict(topDictOperators)
|
opcodes = buildOpcodeDict(topDictOperators)
|
||||||
|
|
||||||
def getChildren(self, strings):
|
def getChildren(self, strings):
|
||||||
@ -2590,7 +2588,6 @@ class FontDictCompiler(DictCompiler):
|
|||||||
|
|
||||||
|
|
||||||
class PrivateDictCompiler(DictCompiler):
|
class PrivateDictCompiler(DictCompiler):
|
||||||
|
|
||||||
maxBlendStack = maxStackLimit
|
maxBlendStack = maxStackLimit
|
||||||
opcodes = buildOpcodeDict(privateDictOperators)
|
opcodes = buildOpcodeDict(privateDictOperators)
|
||||||
|
|
||||||
|
@ -513,7 +513,6 @@ def specializeCommands(
|
|||||||
preserveTopology=False,
|
preserveTopology=False,
|
||||||
maxstack=48,
|
maxstack=48,
|
||||||
):
|
):
|
||||||
|
|
||||||
# We perform several rounds of optimizations. They are carefully ordered and are:
|
# We perform several rounds of optimizations. They are carefully ordered and are:
|
||||||
#
|
#
|
||||||
# 0. Generalize commands.
|
# 0. Generalize commands.
|
||||||
|
@ -22,7 +22,6 @@ class missingdict(dict):
|
|||||||
|
|
||||||
|
|
||||||
def cumSum(f, op=add, start=0, decreasing=False):
|
def cumSum(f, op=add, start=0, decreasing=False):
|
||||||
|
|
||||||
keys = sorted(f.keys())
|
keys = sorted(f.keys())
|
||||||
minx, maxx = keys[0], keys[-1]
|
minx, maxx = keys[0], keys[-1]
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ def cumSum(f, op=add, start=0, decreasing=False):
|
|||||||
|
|
||||||
|
|
||||||
def byteCost(widths, default, nominal):
|
def byteCost(widths, default, nominal):
|
||||||
|
|
||||||
if not hasattr(widths, "items"):
|
if not hasattr(widths, "items"):
|
||||||
d = defaultdict(int)
|
d = defaultdict(int)
|
||||||
for w in widths:
|
for w in widths:
|
||||||
|
@ -45,7 +45,6 @@ class Parser(object):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self, featurefile, glyphNames=(), followIncludes=True, includeDir=None, **kwargs
|
self, featurefile, glyphNames=(), followIncludes=True, includeDir=None, **kwargs
|
||||||
):
|
):
|
||||||
|
|
||||||
if "glyphMap" in kwargs:
|
if "glyphMap" in kwargs:
|
||||||
from fontTools.misc.loggingTools import deprecateArgument
|
from fontTools.misc.loggingTools import deprecateArgument
|
||||||
|
|
||||||
@ -1754,7 +1753,8 @@ class Parser(object):
|
|||||||
|
|
||||||
def parse_featureNames_(self, tag):
|
def parse_featureNames_(self, tag):
|
||||||
"""Parses a ``featureNames`` statement found in stylistic set features.
|
"""Parses a ``featureNames`` statement found in stylistic set features.
|
||||||
See section `8.c <https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html#8.c>`_."""
|
See section `8.c <https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html#8.c>`_.
|
||||||
|
"""
|
||||||
assert self.cur_token_ == "featureNames", self.cur_token_
|
assert self.cur_token_ == "featureNames", self.cur_token_
|
||||||
block = self.ast.NestedBlock(
|
block = self.ast.NestedBlock(
|
||||||
tag, self.cur_token_, location=self.cur_token_location_
|
tag, self.cur_token_, location=self.cur_token_location_
|
||||||
|
@ -51,7 +51,6 @@ class Merger(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, options=None):
|
def __init__(self, options=None):
|
||||||
|
|
||||||
if not options:
|
if not options:
|
||||||
options = Options()
|
options = Options()
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ class Options(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
||||||
self.verbose = False
|
self.verbose = False
|
||||||
self.timing = False
|
self.timing = False
|
||||||
self.drop_tables = []
|
self.drop_tables = []
|
||||||
|
@ -9,7 +9,6 @@ class Classifier(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, sort=True):
|
def __init__(self, sort=True):
|
||||||
|
|
||||||
self._things = set() # set of all things known so far
|
self._things = set() # set of all things known so far
|
||||||
self._sets = [] # list of class sets produced so far
|
self._sets = [] # list of class sets produced so far
|
||||||
self._mapping = {} # map from things to their class set
|
self._mapping = {} # map from things to their class set
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
__all__ = ["hashdict"]
|
__all__ = ["hashdict"]
|
||||||
|
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/1151658/python-hashable-dicts
|
# https://stackoverflow.com/questions/1151658/python-hashable-dicts
|
||||||
class hashdict(dict):
|
class hashdict(dict):
|
||||||
"""
|
"""
|
||||||
|
@ -1092,7 +1092,6 @@ class T1OutlineExtractor(T2OutlineExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class T2CharString(object):
|
class T2CharString(object):
|
||||||
|
|
||||||
operandEncoding = t2OperandEncoding
|
operandEncoding = t2OperandEncoding
|
||||||
operators, opcodes = buildOperatorDict(t2Operators)
|
operators, opcodes = buildOperatorDict(t2Operators)
|
||||||
decompilerClass = SimpleT2Decompiler
|
decompilerClass = SimpleT2Decompiler
|
||||||
@ -1313,7 +1312,6 @@ class T2CharString(object):
|
|||||||
|
|
||||||
|
|
||||||
class T1CharString(T2CharString):
|
class T1CharString(T2CharString):
|
||||||
|
|
||||||
operandEncoding = t1OperandEncoding
|
operandEncoding = t1OperandEncoding
|
||||||
operators, opcodes = buildOperatorDict(t1Operators)
|
operators, opcodes = buildOperatorDict(t1Operators)
|
||||||
|
|
||||||
@ -1347,7 +1345,6 @@ class T1CharString(T2CharString):
|
|||||||
|
|
||||||
|
|
||||||
class DictDecompiler(object):
|
class DictDecompiler(object):
|
||||||
|
|
||||||
operandEncoding = cffDictOperandEncoding
|
operandEncoding = cffDictOperandEncoding
|
||||||
|
|
||||||
def __init__(self, strings, parent=None):
|
def __init__(self, strings, parent=None):
|
||||||
|
@ -100,7 +100,6 @@ class PSTokenizer(object):
|
|||||||
commentmatch=commentRE.match,
|
commentmatch=commentRE.match,
|
||||||
endmatch=endofthingRE.match,
|
endmatch=endofthingRE.match,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.skipwhite()
|
self.skipwhite()
|
||||||
if self.pos >= self.len:
|
if self.pos >= self.len:
|
||||||
return None, None
|
return None, None
|
||||||
|
@ -2,7 +2,6 @@ _accessstrings = {0: "", 1: "readonly", 2: "executeonly", 3: "noaccess"}
|
|||||||
|
|
||||||
|
|
||||||
class ps_object(object):
|
class ps_object(object):
|
||||||
|
|
||||||
literal = 1
|
literal = 1
|
||||||
access = 0
|
access = 0
|
||||||
value = None
|
value = None
|
||||||
@ -16,7 +15,6 @@ class ps_object(object):
|
|||||||
|
|
||||||
|
|
||||||
class ps_operator(ps_object):
|
class ps_operator(ps_object):
|
||||||
|
|
||||||
literal = 0
|
literal = 0
|
||||||
|
|
||||||
def __init__(self, name, function):
|
def __init__(self, name, function):
|
||||||
|
@ -61,7 +61,6 @@ class _BezierFuncsLazy(dict):
|
|||||||
|
|
||||||
|
|
||||||
class GreenPen(BasePen):
|
class GreenPen(BasePen):
|
||||||
|
|
||||||
_BezierFuncs = {}
|
_BezierFuncs = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -115,7 +114,6 @@ MomentXYPen = partial(GreenPen, func=x * y)
|
|||||||
|
|
||||||
|
|
||||||
def printGreenPen(penName, funcs, file=sys.stdout, docstring=None):
|
def printGreenPen(penName, funcs, file=sys.stdout, docstring=None):
|
||||||
|
|
||||||
if docstring is not None:
|
if docstring is not None:
|
||||||
print('"""%s"""' % docstring)
|
print('"""%s"""' % docstring)
|
||||||
|
|
||||||
@ -167,7 +165,6 @@ class %s(BasePen):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for n in (1, 2, 3):
|
for n in (1, 2, 3):
|
||||||
|
|
||||||
subs = {P[i][j]: [X, Y][j][i] for i in range(n + 1) for j in range(2)}
|
subs = {P[i][j]: [X, Y][j][i] for i in range(n + 1) for j in range(2)}
|
||||||
greens = [green(f, BezierCurve[n]) for name, f in funcs]
|
greens = [green(f, BezierCurve[n]) for name, f in funcs]
|
||||||
greens = [sp.gcd_terms(f.collect(sum(P, ()))) for f in greens] # Optimize
|
greens = [sp.gcd_terms(f.collect(sum(P, ()))) for f in greens] # Optimize
|
||||||
|
@ -4,7 +4,6 @@ import enum
|
|||||||
|
|
||||||
|
|
||||||
class Visitor(object):
|
class Visitor(object):
|
||||||
|
|
||||||
defaultStop = False
|
defaultStop = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -58,7 +57,6 @@ class Visitor(object):
|
|||||||
typ = type(thing)
|
typ = type(thing)
|
||||||
|
|
||||||
for celf in celf.mro():
|
for celf in celf.mro():
|
||||||
|
|
||||||
_visitors = getattr(celf, "_visitors", None)
|
_visitors = getattr(celf, "_visitors", None)
|
||||||
if _visitors is None:
|
if _visitors is None:
|
||||||
break
|
break
|
||||||
|
@ -135,6 +135,7 @@ Pairs = Dict[
|
|||||||
Tuple[otBase.ValueRecord, otBase.ValueRecord],
|
Tuple[otBase.ValueRecord, otBase.ValueRecord],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Adapted from https://github.com/fonttools/fonttools/blob/f64f0b42f2d1163b2d85194e0979def539f5dca3/Lib/fontTools/ttLib/tables/otTables.py#L935-L958
|
# Adapted from https://github.com/fonttools/fonttools/blob/f64f0b42f2d1163b2d85194e0979def539f5dca3/Lib/fontTools/ttLib/tables/otTables.py#L935-L958
|
||||||
def _getClassRanges(glyphIDs: Iterable[int]):
|
def _getClassRanges(glyphIDs: Iterable[int]):
|
||||||
glyphIDs = sorted(glyphIDs)
|
glyphIDs = sorted(glyphIDs)
|
||||||
@ -274,7 +275,7 @@ class Cluster:
|
|||||||
)
|
)
|
||||||
merged_range_count = 0
|
merged_range_count = 0
|
||||||
last = None
|
last = None
|
||||||
for (start, end) in ranges:
|
for start, end in ranges:
|
||||||
if last is not None and start != last + 1:
|
if last is not None and start != last + 1:
|
||||||
merged_range_count += 1
|
merged_range_count += 1
|
||||||
last = end
|
last = end
|
||||||
|
@ -199,7 +199,7 @@ class Cu2QuPointPen(BasePointToSegmentPen):
|
|||||||
# will be appended at the end of the contour
|
# will be appended at the end of the contour
|
||||||
last_offcurves = offcurves
|
last_offcurves = offcurves
|
||||||
else:
|
else:
|
||||||
for (pt, smooth, name, kwargs) in offcurves:
|
for pt, smooth, name, kwargs in offcurves:
|
||||||
pen.addPoint(pt, None, smooth, name, **kwargs)
|
pen.addPoint(pt, None, smooth, name, **kwargs)
|
||||||
pt, smooth, name, kwargs = points[-1]
|
pt, smooth, name, kwargs = points[-1]
|
||||||
if pt is None:
|
if pt is None:
|
||||||
@ -212,7 +212,7 @@ class Cu2QuPointPen(BasePointToSegmentPen):
|
|||||||
pen.addPoint(pt, segment_type, smooth, name, **kwargs)
|
pen.addPoint(pt, segment_type, smooth, name, **kwargs)
|
||||||
else:
|
else:
|
||||||
raise AssertionError("unexpected segment type: %r" % segment_type)
|
raise AssertionError("unexpected segment type: %r" % segment_type)
|
||||||
for (pt, smooth, name, kwargs) in last_offcurves:
|
for pt, smooth, name, kwargs in last_offcurves:
|
||||||
pen.addPoint(pt, None, smooth, name, **kwargs)
|
pen.addPoint(pt, None, smooth, name, **kwargs)
|
||||||
pen.endPath()
|
pen.endPath()
|
||||||
|
|
||||||
|
@ -204,7 +204,6 @@ def subset_glyphs(self, s) -> bool:
|
|||||||
|
|
||||||
new_docs: List[SVGDocument] = []
|
new_docs: List[SVGDocument] = []
|
||||||
for doc in self.docList:
|
for doc in self.docList:
|
||||||
|
|
||||||
glyphs = {
|
glyphs = {
|
||||||
glyph_order[i] for i in range(doc.startGlyphID, doc.endGlyphID + 1)
|
glyph_order[i] for i in range(doc.startGlyphID, doc.endGlyphID + 1)
|
||||||
}.intersection(s.glyphs)
|
}.intersection(s.glyphs)
|
||||||
|
@ -125,7 +125,6 @@ def parse_path(pathdef, pen, current_pos=(0, 0), arc_class=EllipticalArc):
|
|||||||
have_arcTo = hasattr(pen, "arcTo")
|
have_arcTo = hasattr(pen, "arcTo")
|
||||||
|
|
||||||
while elements:
|
while elements:
|
||||||
|
|
||||||
if elements[-1] in COMMANDS:
|
if elements[-1] in COMMANDS:
|
||||||
# New command.
|
# New command.
|
||||||
last_command = command # Used by S and T
|
last_command = command # Used by S and T
|
||||||
|
@ -139,7 +139,6 @@ def visit(visitor, obj, attr, glyphs):
|
|||||||
|
|
||||||
@ScalerVisitor.register_attr(ttLib.getTableClass("gvar"), "variations")
|
@ScalerVisitor.register_attr(ttLib.getTableClass("gvar"), "variations")
|
||||||
def visit(visitor, obj, attr, variations):
|
def visit(visitor, obj, attr, variations):
|
||||||
|
|
||||||
# VarComposites are a pain to handle :-(
|
# VarComposites are a pain to handle :-(
|
||||||
glyfTable = visitor.font["glyf"]
|
glyfTable = visitor.font["glyf"]
|
||||||
|
|
||||||
|
@ -524,13 +524,11 @@ class DirectoryEntry(object):
|
|||||||
|
|
||||||
|
|
||||||
class SFNTDirectoryEntry(DirectoryEntry):
|
class SFNTDirectoryEntry(DirectoryEntry):
|
||||||
|
|
||||||
format = sfntDirectoryEntryFormat
|
format = sfntDirectoryEntryFormat
|
||||||
formatSize = sfntDirectoryEntrySize
|
formatSize = sfntDirectoryEntrySize
|
||||||
|
|
||||||
|
|
||||||
class WOFFDirectoryEntry(DirectoryEntry):
|
class WOFFDirectoryEntry(DirectoryEntry):
|
||||||
|
|
||||||
format = woffDirectoryEntryFormat
|
format = woffDirectoryEntryFormat
|
||||||
formatSize = woffDirectoryEntrySize
|
formatSize = woffDirectoryEntrySize
|
||||||
|
|
||||||
@ -571,7 +569,6 @@ class WOFFDirectoryEntry(DirectoryEntry):
|
|||||||
|
|
||||||
|
|
||||||
class WOFFFlavorData:
|
class WOFFFlavorData:
|
||||||
|
|
||||||
Flavor = "woff"
|
Flavor = "woff"
|
||||||
|
|
||||||
def __init__(self, reader=None):
|
def __init__(self, reader=None):
|
||||||
|
@ -21,7 +21,6 @@ import struct
|
|||||||
|
|
||||||
|
|
||||||
class table_C_B_D_T_(E_B_D_T_.table_E_B_D_T_):
|
class table_C_B_D_T_(E_B_D_T_.table_E_B_D_T_):
|
||||||
|
|
||||||
# Change the data locator table being referenced.
|
# Change the data locator table being referenced.
|
||||||
locatorName = "CBLC"
|
locatorName = "CBLC"
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ def _removeUnsupportedForColor(dataFunctions):
|
|||||||
|
|
||||||
|
|
||||||
class ColorBitmapGlyph(BitmapGlyph):
|
class ColorBitmapGlyph(BitmapGlyph):
|
||||||
|
|
||||||
fileExtension = ".png"
|
fileExtension = ".png"
|
||||||
xmlDataFunctions = _removeUnsupportedForColor(BitmapGlyph.xmlDataFunctions)
|
xmlDataFunctions = _removeUnsupportedForColor(BitmapGlyph.xmlDataFunctions)
|
||||||
|
|
||||||
|
@ -6,5 +6,4 @@ from . import E_B_L_C_
|
|||||||
|
|
||||||
|
|
||||||
class table_C_B_L_C_(E_B_L_C_.table_E_B_L_C_):
|
class table_C_B_L_C_(E_B_L_C_.table_E_B_L_C_):
|
||||||
|
|
||||||
dependencies = ["CBDT"]
|
dependencies = ["CBDT"]
|
||||||
|
@ -151,7 +151,7 @@ class LayerRecord(object):
|
|||||||
writer.newline()
|
writer.newline()
|
||||||
|
|
||||||
def fromXML(self, eltname, attrs, content, ttFont):
|
def fromXML(self, eltname, attrs, content, ttFont):
|
||||||
for (name, value) in attrs.items():
|
for name, value in attrs.items():
|
||||||
if name == "name":
|
if name == "name":
|
||||||
setattr(self, name, value)
|
setattr(self, name, value)
|
||||||
else:
|
else:
|
||||||
|
@ -11,7 +11,6 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
class table_C_P_A_L_(DefaultTable.DefaultTable):
|
class table_C_P_A_L_(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
NO_NAME_ID = 0xFFFF
|
NO_NAME_ID = 0xFFFF
|
||||||
DEFAULT_PALETTE_TYPE = 0
|
DEFAULT_PALETTE_TYPE = 0
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ from fontTools.ttLib import getClassTag
|
|||||||
|
|
||||||
|
|
||||||
class DefaultTable(object):
|
class DefaultTable(object):
|
||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
def __init__(self, tag=None):
|
def __init__(self, tag=None):
|
||||||
|
@ -38,7 +38,6 @@ ebdtComponentFormat = """
|
|||||||
|
|
||||||
|
|
||||||
class table_E_B_D_T_(DefaultTable.DefaultTable):
|
class table_E_B_D_T_(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
# Keep a reference to the name of the data locator table.
|
# Keep a reference to the name of the data locator table.
|
||||||
locatorName = "EBLC"
|
locatorName = "EBLC"
|
||||||
|
|
||||||
@ -84,7 +83,6 @@ class table_E_B_D_T_(DefaultTable.DefaultTable):
|
|||||||
bitmapGlyphDict[curName] = curGlyph
|
bitmapGlyphDict[curName] = curGlyph
|
||||||
|
|
||||||
def compile(self, ttFont):
|
def compile(self, ttFont):
|
||||||
|
|
||||||
dataList = []
|
dataList = []
|
||||||
dataList.append(sstruct.pack(ebdtTableVersionFormat, self))
|
dataList.append(sstruct.pack(ebdtTableVersionFormat, self))
|
||||||
dataSize = len(dataList[0])
|
dataSize = len(dataList[0])
|
||||||
@ -428,7 +426,6 @@ _bitmapGlyphSubclassPrefix = "ebdt_bitmap_format_"
|
|||||||
|
|
||||||
|
|
||||||
class BitmapGlyph(object):
|
class BitmapGlyph(object):
|
||||||
|
|
||||||
# For the external file format. This can be changed in subclasses. This way
|
# For the external file format. This can be changed in subclasses. This way
|
||||||
# when the extfile option is turned on files have the form: glyphName.ext
|
# when the extfile option is turned on files have the form: glyphName.ext
|
||||||
# The default is just a flat binary file with no meaning.
|
# The default is just a flat binary file with no meaning.
|
||||||
@ -555,6 +552,7 @@ def _createBitmapPlusMetricsMixin(metricsClass):
|
|||||||
BitmapPlusBigMetricsMixin = _createBitmapPlusMetricsMixin(BigGlyphMetrics)
|
BitmapPlusBigMetricsMixin = _createBitmapPlusMetricsMixin(BigGlyphMetrics)
|
||||||
BitmapPlusSmallMetricsMixin = _createBitmapPlusMetricsMixin(SmallGlyphMetrics)
|
BitmapPlusSmallMetricsMixin = _createBitmapPlusMetricsMixin(SmallGlyphMetrics)
|
||||||
|
|
||||||
|
|
||||||
# Data that is bit aligned can be tricky to deal with. These classes implement
|
# Data that is bit aligned can be tricky to deal with. These classes implement
|
||||||
# helper functionality for dealing with the data and getting a particular row
|
# helper functionality for dealing with the data and getting a particular row
|
||||||
# of bitwise data. Also helps implement fancy data export/import in XML.
|
# of bitwise data. Also helps implement fancy data export/import in XML.
|
||||||
|
@ -66,7 +66,6 @@ codeOffsetPairSize = struct.calcsize(codeOffsetPairFormat)
|
|||||||
|
|
||||||
|
|
||||||
class table_E_B_L_C_(DefaultTable.DefaultTable):
|
class table_E_B_L_C_(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = ["EBDT"]
|
dependencies = ["EBDT"]
|
||||||
|
|
||||||
# This method can be overridden in subclasses to support new formats
|
# This method can be overridden in subclasses to support new formats
|
||||||
@ -76,7 +75,6 @@ class table_E_B_L_C_(DefaultTable.DefaultTable):
|
|||||||
return eblc_sub_table_classes[indexFormat]
|
return eblc_sub_table_classes[indexFormat]
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
|
||||||
# Save the original data because offsets are from the start of the table.
|
# Save the original data because offsets are from the start of the table.
|
||||||
origData = data
|
origData = data
|
||||||
i = 0
|
i = 0
|
||||||
@ -138,7 +136,6 @@ class table_E_B_L_C_(DefaultTable.DefaultTable):
|
|||||||
curStrike.indexSubTables.append(indexSubTable)
|
curStrike.indexSubTables.append(indexSubTable)
|
||||||
|
|
||||||
def compile(self, ttFont):
|
def compile(self, ttFont):
|
||||||
|
|
||||||
dataList = []
|
dataList = []
|
||||||
self.numSizes = len(self.strikes)
|
self.numSizes = len(self.strikes)
|
||||||
dataList.append(sstruct.pack(eblcHeaderFormat, self))
|
dataList.append(sstruct.pack(eblcHeaderFormat, self))
|
||||||
@ -297,7 +294,6 @@ class Strike(object):
|
|||||||
|
|
||||||
|
|
||||||
class BitmapSizeTable(object):
|
class BitmapSizeTable(object):
|
||||||
|
|
||||||
# Returns all the simple metric names that bitmap size table
|
# Returns all the simple metric names that bitmap size table
|
||||||
# cares about in terms of XML creation.
|
# cares about in terms of XML creation.
|
||||||
def _getXMLMetricNames(self):
|
def _getXMLMetricNames(self):
|
||||||
@ -476,14 +472,12 @@ class EblcIndexSubTable(object):
|
|||||||
# are very similar. The only difference between them is the size per offset
|
# are very similar. The only difference between them is the size per offset
|
||||||
# value. Code put in here should handle both cases generally.
|
# value. Code put in here should handle both cases generally.
|
||||||
def _createOffsetArrayIndexSubTableMixin(formatStringForDataType):
|
def _createOffsetArrayIndexSubTableMixin(formatStringForDataType):
|
||||||
|
|
||||||
# Prep the data size for the offset array data format.
|
# Prep the data size for the offset array data format.
|
||||||
dataFormat = ">" + formatStringForDataType
|
dataFormat = ">" + formatStringForDataType
|
||||||
offsetDataSize = struct.calcsize(dataFormat)
|
offsetDataSize = struct.calcsize(dataFormat)
|
||||||
|
|
||||||
class OffsetArrayIndexSubTableMixin(object):
|
class OffsetArrayIndexSubTableMixin(object):
|
||||||
def decompile(self):
|
def decompile(self):
|
||||||
|
|
||||||
numGlyphs = self.lastGlyphIndex - self.firstGlyphIndex + 1
|
numGlyphs = self.lastGlyphIndex - self.firstGlyphIndex + 1
|
||||||
indexingOffsets = [
|
indexingOffsets = [
|
||||||
glyphIndex * offsetDataSize for glyphIndex in range(numGlyphs + 2)
|
glyphIndex * offsetDataSize for glyphIndex in range(numGlyphs + 2)
|
||||||
@ -625,7 +619,6 @@ class eblc_index_sub_table_3(
|
|||||||
|
|
||||||
class eblc_index_sub_table_4(EblcIndexSubTable):
|
class eblc_index_sub_table_4(EblcIndexSubTable):
|
||||||
def decompile(self):
|
def decompile(self):
|
||||||
|
|
||||||
(numGlyphs,) = struct.unpack(">L", self.data[:4])
|
(numGlyphs,) = struct.unpack(">L", self.data[:4])
|
||||||
data = self.data[4:]
|
data = self.data[4:]
|
||||||
indexingOffsets = [
|
indexingOffsets = [
|
||||||
|
@ -81,7 +81,6 @@ class GMAPRecord(object):
|
|||||||
|
|
||||||
|
|
||||||
class table_G_M_A_P_(DefaultTable.DefaultTable):
|
class table_G_M_A_P_(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -68,7 +68,6 @@ def getLabelString(labelID):
|
|||||||
|
|
||||||
|
|
||||||
class table_M_E_T_A_(DefaultTable.DefaultTable):
|
class table_M_E_T_A_(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -20,7 +20,6 @@ SINGFormat = """
|
|||||||
|
|
||||||
|
|
||||||
class table_S_I_N_G_(DefaultTable.DefaultTable):
|
class table_S_I_N_G_(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -16,7 +16,6 @@ def fixlongs(glyphID, textLength, textOffset):
|
|||||||
|
|
||||||
|
|
||||||
class table_T_S_I__0(DefaultTable.DefaultTable):
|
class table_T_S_I__0(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = ["TSI1"]
|
dependencies = ["TSI1"]
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -10,7 +10,6 @@ from fontTools.misc.textTools import strjoin, tobytes, tostr
|
|||||||
|
|
||||||
|
|
||||||
class table_T_S_I__1(LogMixin, DefaultTable.DefaultTable):
|
class table_T_S_I__1(LogMixin, DefaultTable.DefaultTable):
|
||||||
|
|
||||||
extras = {0xFFFA: "ppgm", 0xFFFB: "cvt", 0xFFFC: "reserved", 0xFFFD: "fpgm"}
|
extras = {0xFFFA: "ppgm", 0xFFFB: "cvt", 0xFFFC: "reserved", 0xFFFD: "fpgm"}
|
||||||
|
|
||||||
indextable = "TSI0"
|
indextable = "TSI0"
|
||||||
|
@ -11,5 +11,4 @@ superclass = ttLib.getTableClass("TSI0")
|
|||||||
|
|
||||||
|
|
||||||
class table_T_S_I__2(superclass):
|
class table_T_S_I__2(superclass):
|
||||||
|
|
||||||
dependencies = ["TSI3"]
|
dependencies = ["TSI3"]
|
||||||
|
@ -9,7 +9,6 @@ superclass = ttLib.getTableClass("TSI1")
|
|||||||
|
|
||||||
|
|
||||||
class table_T_S_I__3(superclass):
|
class table_T_S_I__3(superclass):
|
||||||
|
|
||||||
extras = {
|
extras = {
|
||||||
0xFFFA: "reserved0",
|
0xFFFA: "reserved0",
|
||||||
0xFFFB: "reserved1",
|
0xFFFB: "reserved1",
|
||||||
|
@ -1291,7 +1291,6 @@ class cmap_format_12_or_13(CmapSubtable):
|
|||||||
|
|
||||||
|
|
||||||
class cmap_format_12(cmap_format_12_or_13):
|
class cmap_format_12(cmap_format_12_or_13):
|
||||||
|
|
||||||
_format_step = 1
|
_format_step = 1
|
||||||
|
|
||||||
def __init__(self, format=12):
|
def __init__(self, format=12):
|
||||||
@ -1305,7 +1304,6 @@ class cmap_format_12(cmap_format_12_or_13):
|
|||||||
|
|
||||||
|
|
||||||
class cmap_format_13(cmap_format_12_or_13):
|
class cmap_format_13(cmap_format_12_or_13):
|
||||||
|
|
||||||
_format_step = 0
|
_format_step = 0
|
||||||
|
|
||||||
def __init__(self, format=13):
|
def __init__(self, format=13):
|
||||||
|
@ -37,7 +37,6 @@ headFormat = """
|
|||||||
|
|
||||||
|
|
||||||
class table__h_e_a_d(DefaultTable.DefaultTable):
|
class table__h_e_a_d(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = ["maxp", "loca", "CFF ", "CFF2"]
|
dependencies = ["maxp", "loca", "CFF ", "CFF2"]
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -31,7 +31,6 @@ hheaFormat = """
|
|||||||
|
|
||||||
|
|
||||||
class table__h_h_e_a(DefaultTable.DefaultTable):
|
class table__h_h_e_a(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
# Note: Keep in sync with table__v_h_e_a
|
# Note: Keep in sync with table__v_h_e_a
|
||||||
|
|
||||||
dependencies = ["hmtx", "glyf", "CFF ", "CFF2"]
|
dependencies = ["hmtx", "glyf", "CFF ", "CFF2"]
|
||||||
|
@ -12,7 +12,6 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class table__h_m_t_x(DefaultTable.DefaultTable):
|
class table__h_m_t_x(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
headerTag = "hhea"
|
headerTag = "hhea"
|
||||||
advanceName = "width"
|
advanceName = "width"
|
||||||
sideBearingName = "lsb"
|
sideBearingName = "lsb"
|
||||||
|
@ -101,7 +101,6 @@ class table__k_e_r_n(DefaultTable.DefaultTable):
|
|||||||
|
|
||||||
|
|
||||||
class KernTable_format_0(object):
|
class KernTable_format_0(object):
|
||||||
|
|
||||||
# 'version' is kept for backward compatibility
|
# 'version' is kept for backward compatibility
|
||||||
version = format = 0
|
version = format = 0
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class table__l_o_c_a(DefaultTable.DefaultTable):
|
class table__l_o_c_a(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = ["glyf"]
|
dependencies = ["glyf"]
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -27,7 +27,6 @@ maxpFormat_1_0_add = """
|
|||||||
|
|
||||||
|
|
||||||
class table__m_a_x_p(DefaultTable.DefaultTable):
|
class table__m_a_x_p(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
dependencies = ["glyf"]
|
dependencies = ["glyf"]
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
|
@ -31,7 +31,6 @@ vheaFormat = """
|
|||||||
|
|
||||||
|
|
||||||
class table__v_h_e_a(DefaultTable.DefaultTable):
|
class table__v_h_e_a(DefaultTable.DefaultTable):
|
||||||
|
|
||||||
# Note: Keep in sync with table__h_h_e_a
|
# Note: Keep in sync with table__h_h_e_a
|
||||||
|
|
||||||
dependencies = ["vmtx", "glyf", "CFF ", "CFF2"]
|
dependencies = ["vmtx", "glyf", "CFF ", "CFF2"]
|
||||||
|
@ -4,7 +4,6 @@ superclass = ttLib.getTableClass("hmtx")
|
|||||||
|
|
||||||
|
|
||||||
class table__v_m_t_x(superclass):
|
class table__v_m_t_x(superclass):
|
||||||
|
|
||||||
headerTag = "vhea"
|
headerTag = "vhea"
|
||||||
advanceName = "height"
|
advanceName = "height"
|
||||||
sideBearingName = "tsb"
|
sideBearingName = "tsb"
|
||||||
|
@ -538,7 +538,6 @@ class FeatureParamsCharacterVariants(FeatureParams):
|
|||||||
|
|
||||||
|
|
||||||
class Coverage(FormatSwitchingBaseTable):
|
class Coverage(FormatSwitchingBaseTable):
|
||||||
|
|
||||||
# manual implementation to get rid of glyphID dependencies
|
# manual implementation to get rid of glyphID dependencies
|
||||||
|
|
||||||
def populateDefaults(self, propagator=None):
|
def populateDefaults(self, propagator=None):
|
||||||
|
@ -87,7 +87,6 @@ class TTCollection(object):
|
|||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def saveXML(self, fileOrPath, newlinestr="\n", writeVersion=True, **kwargs):
|
def saveXML(self, fileOrPath, newlinestr="\n", writeVersion=True, **kwargs):
|
||||||
|
|
||||||
from fontTools.misc import xmlWriter
|
from fontTools.misc import xmlWriter
|
||||||
|
|
||||||
writer = xmlWriter.XMLWriter(fileOrPath, newlinestr=newlinestr)
|
writer = xmlWriter.XMLWriter(fileOrPath, newlinestr=newlinestr)
|
||||||
|
@ -287,7 +287,6 @@ class TTFont(object):
|
|||||||
disassembleInstructions=True,
|
disassembleInstructions=True,
|
||||||
bitmapGlyphDataFormat="raw",
|
bitmapGlyphDataFormat="raw",
|
||||||
):
|
):
|
||||||
|
|
||||||
if quiet is not None:
|
if quiet is not None:
|
||||||
deprecateArgument("quiet", "configure logging instead")
|
deprecateArgument("quiet", "configure logging instead")
|
||||||
|
|
||||||
|
@ -170,7 +170,6 @@ class _TTGlyphGlyf(_TTGlyph):
|
|||||||
glyph, offset = self._getGlyphAndOffset()
|
glyph, offset = self._getGlyphAndOffset()
|
||||||
|
|
||||||
with self.glyphSet.pushDepth() as depth:
|
with self.glyphSet.pushDepth() as depth:
|
||||||
|
|
||||||
if depth:
|
if depth:
|
||||||
offset = 0 # Offset should only apply at top-level
|
offset = 0 # Offset should only apply at top-level
|
||||||
|
|
||||||
@ -187,7 +186,6 @@ class _TTGlyphGlyf(_TTGlyph):
|
|||||||
glyph, offset = self._getGlyphAndOffset()
|
glyph, offset = self._getGlyphAndOffset()
|
||||||
|
|
||||||
with self.glyphSet.pushDepth() as depth:
|
with self.glyphSet.pushDepth() as depth:
|
||||||
|
|
||||||
if depth:
|
if depth:
|
||||||
offset = 0 # Offset should only apply at top-level
|
offset = 0 # Offset should only apply at top-level
|
||||||
|
|
||||||
@ -198,14 +196,12 @@ class _TTGlyphGlyf(_TTGlyph):
|
|||||||
glyph.drawPoints(pen, self.glyphSet.glyfTable, offset)
|
glyph.drawPoints(pen, self.glyphSet.glyfTable, offset)
|
||||||
|
|
||||||
def _drawVarComposite(self, glyph, pen, isPointPen):
|
def _drawVarComposite(self, glyph, pen, isPointPen):
|
||||||
|
|
||||||
from fontTools.ttLib.tables._g_l_y_f import (
|
from fontTools.ttLib.tables._g_l_y_f import (
|
||||||
VarComponentFlags,
|
VarComponentFlags,
|
||||||
VAR_COMPONENT_TRANSFORM_MAPPING,
|
VAR_COMPONENT_TRANSFORM_MAPPING,
|
||||||
)
|
)
|
||||||
|
|
||||||
for comp in glyph.components:
|
for comp in glyph.components:
|
||||||
|
|
||||||
with self.glyphSet.pushLocation(
|
with self.glyphSet.pushLocation(
|
||||||
comp.location, comp.flags & VarComponentFlags.RESET_UNSPECIFIED_AXES
|
comp.location, comp.flags & VarComponentFlags.RESET_UNSPECIFIED_AXES
|
||||||
):
|
):
|
||||||
|
@ -42,7 +42,6 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
class WOFF2Reader(SFNTReader):
|
class WOFF2Reader(SFNTReader):
|
||||||
|
|
||||||
flavor = "woff2"
|
flavor = "woff2"
|
||||||
|
|
||||||
def __init__(self, file, checkChecksums=0, fontNumber=-1):
|
def __init__(self, file, checkChecksums=0, fontNumber=-1):
|
||||||
@ -177,7 +176,6 @@ class WOFF2Reader(SFNTReader):
|
|||||||
|
|
||||||
|
|
||||||
class WOFF2Writer(SFNTWriter):
|
class WOFF2Writer(SFNTWriter):
|
||||||
|
|
||||||
flavor = "woff2"
|
flavor = "woff2"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -1291,7 +1289,6 @@ class WOFF2HmtxTable(getTableClass("hmtx")):
|
|||||||
|
|
||||||
|
|
||||||
class WOFF2FlavorData(WOFFFlavorData):
|
class WOFF2FlavorData(WOFFFlavorData):
|
||||||
|
|
||||||
Flavor = "woff2"
|
Flavor = "woff2"
|
||||||
|
|
||||||
def __init__(self, reader=None, data=None, transformedTables=None):
|
def __init__(self, reader=None, data=None, transformedTables=None):
|
||||||
|
@ -124,7 +124,6 @@ opentypeheaderRE = re.compile("""sfntVersion=['"]OTTO["']""")
|
|||||||
|
|
||||||
|
|
||||||
class Options(object):
|
class Options(object):
|
||||||
|
|
||||||
listTables = False
|
listTables = False
|
||||||
outputDir = None
|
outputDir = None
|
||||||
outputFile = None
|
outputFile = None
|
||||||
|
@ -248,7 +248,6 @@ class VariationModel(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, locations, axisOrder=None, extrapolate=False):
|
def __init__(self, locations, axisOrder=None, extrapolate=False):
|
||||||
|
|
||||||
if len(set(tuple(sorted(l.items())) for l in locations)) != len(locations):
|
if len(set(tuple(sorted(l.items())) for l in locations)) != len(locations):
|
||||||
raise VariationModelError("Locations must be unique.")
|
raise VariationModelError("Locations must be unique.")
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ tables.sort()
|
|||||||
|
|
||||||
|
|
||||||
with open(os.path.join(tablesDir, "__init__.py"), "w") as file:
|
with open(os.path.join(tablesDir, "__init__.py"), "w") as file:
|
||||||
|
|
||||||
file.write(
|
file.write(
|
||||||
'''
|
'''
|
||||||
# DON'T EDIT! This file is generated by MetaTools/buildTableList.py.
|
# DON'T EDIT! This file is generated by MetaTools/buildTableList.py.
|
||||||
|
@ -85,7 +85,7 @@ def AddGlyphVariations(font, thin, regular, black):
|
|||||||
continue
|
continue
|
||||||
thinDelta = []
|
thinDelta = []
|
||||||
blackDelta = []
|
blackDelta = []
|
||||||
for ((regX, regY), (blackX, blackY), (thinX, thinY)) in zip(
|
for (regX, regY), (blackX, blackY), (thinX, thinY) in zip(
|
||||||
regularCoord, blackCoord, thinCoord
|
regularCoord, blackCoord, thinCoord
|
||||||
):
|
):
|
||||||
thinDelta.append(((thinX - regX, thinY - regY)))
|
thinDelta.append(((thinX - regX, thinY - regY)))
|
||||||
|
@ -139,7 +139,6 @@ def visit(self, obj):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
from fontTools.ttLib import TTFont
|
from fontTools.ttLib import TTFont
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ from fontTools.misc.encodingTools import getEncoding
|
|||||||
|
|
||||||
class EncodingTest(unittest.TestCase):
|
class EncodingTest(unittest.TestCase):
|
||||||
def test_encoding_unicode(self):
|
def test_encoding_unicode(self):
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
getEncoding(3, 0, None), "utf_16_be"
|
getEncoding(3, 0, None), "utf_16_be"
|
||||||
) # MS Symbol is Unicode as well
|
) # MS Symbol is Unicode as well
|
||||||
|
@ -120,7 +120,7 @@ class T2CharStringTest(unittest.TestCase):
|
|||||||
(-456.8, "ff fe 37 33 33", -456.8000031),
|
(-456.8, "ff fe 37 33 33", -456.8000031),
|
||||||
]
|
]
|
||||||
|
|
||||||
for (value, expected_hex, expected_float) in testNums:
|
for value, expected_hex, expected_float in testNums:
|
||||||
encoded_result = encodeFixed(value)
|
encoded_result = encodeFixed(value)
|
||||||
|
|
||||||
# check to see if we got the expected bytes
|
# check to see if we got the expected bytes
|
||||||
|
@ -394,7 +394,6 @@ class IsCloseTests(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestRedirectStream:
|
class TestRedirectStream:
|
||||||
|
|
||||||
redirect_stream = None
|
redirect_stream = None
|
||||||
orig_stream = None
|
orig_stream = None
|
||||||
|
|
||||||
@ -444,13 +443,11 @@ class TestRedirectStream:
|
|||||||
|
|
||||||
|
|
||||||
class TestRedirectStdout(TestRedirectStream, unittest.TestCase):
|
class TestRedirectStdout(TestRedirectStream, unittest.TestCase):
|
||||||
|
|
||||||
redirect_stream = redirect_stdout
|
redirect_stream = redirect_stdout
|
||||||
orig_stream = "stdout"
|
orig_stream = "stdout"
|
||||||
|
|
||||||
|
|
||||||
class TestRedirectStderr(TestRedirectStream, unittest.TestCase):
|
class TestRedirectStderr(TestRedirectStream, unittest.TestCase):
|
||||||
|
|
||||||
redirect_stream = redirect_stderr
|
redirect_stream = redirect_stderr
|
||||||
orig_stream = "stderr"
|
orig_stream = "stderr"
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ def set_lookup_debug_env_var(monkeypatch):
|
|||||||
|
|
||||||
|
|
||||||
class MtiTest:
|
class MtiTest:
|
||||||
|
|
||||||
GLYPH_ORDER = [
|
GLYPH_ORDER = [
|
||||||
".notdef",
|
".notdef",
|
||||||
"a",
|
"a",
|
||||||
@ -425,7 +424,6 @@ class MtiTest:
|
|||||||
return font
|
return font
|
||||||
|
|
||||||
def check_mti_file(self, name, tableTag=None):
|
def check_mti_file(self, name, tableTag=None):
|
||||||
|
|
||||||
xml_expected_path = self.getpath(
|
xml_expected_path = self.getpath(
|
||||||
"%s.ttx" % name + ("." + tableTag if tableTag is not None else "")
|
"%s.ttx" % name + ("." + tableTag if tableTag is not None else "")
|
||||||
)
|
)
|
||||||
|
@ -339,7 +339,6 @@ pen.endPath()""".splitlines(),
|
|||||||
|
|
||||||
class TestCu2QuMultiPen(unittest.TestCase):
|
class TestCu2QuMultiPen(unittest.TestCase):
|
||||||
def test_multi_pen(self):
|
def test_multi_pen(self):
|
||||||
|
|
||||||
pens = [RecordingPen(), RecordingPen()]
|
pens = [RecordingPen(), RecordingPen()]
|
||||||
pen = Cu2QuMultiPen(pens, 0.1)
|
pen = Cu2QuMultiPen(pens, 0.1)
|
||||||
pen.moveTo([((0, 0),), ((0, 0),)])
|
pen.moveTo([((0, 0),), ((0, 0),)])
|
||||||
|
@ -615,11 +615,9 @@ class CubicGlyfTest:
|
|||||||
ppen.endPath()
|
ppen.endPath()
|
||||||
|
|
||||||
for pen in (spen, ppen):
|
for pen in (spen, ppen):
|
||||||
|
|
||||||
glyph = pen.glyph()
|
glyph = pen.glyph()
|
||||||
|
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
|
|
||||||
if i == 1:
|
if i == 1:
|
||||||
glyph.compile(None)
|
glyph.compile(None)
|
||||||
|
|
||||||
@ -797,7 +795,6 @@ class CubicGlyfTest:
|
|||||||
rpen.replay(ppen)
|
rpen.replay(ppen)
|
||||||
|
|
||||||
for pen in (spen, ppen):
|
for pen in (spen, ppen):
|
||||||
|
|
||||||
glyph = pen.glyph(dropImpliedOnCurves=dropImpliedOnCurves)
|
glyph = pen.glyph(dropImpliedOnCurves=dropImpliedOnCurves)
|
||||||
|
|
||||||
assert list(glyph.coordinates) == expected_coordinates
|
assert list(glyph.coordinates) == expected_coordinates
|
||||||
|
@ -75,7 +75,6 @@ class Qu2CuTest:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_simple(self, quadratics, expected, tolerance, cubic_only):
|
def test_simple(self, quadratics, expected, tolerance, cubic_only):
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
tuple((pytest.approx(p[0]), pytest.approx(p[1])) for p in curve)
|
tuple((pytest.approx(p[0]), pytest.approx(p[1])) for p in curve)
|
||||||
for curve in expected
|
for curve in expected
|
||||||
@ -85,7 +84,6 @@ class Qu2CuTest:
|
|||||||
assert c == expected
|
assert c == expected
|
||||||
|
|
||||||
def test_roundtrip(self):
|
def test_roundtrip(self):
|
||||||
|
|
||||||
DATADIR = os.path.join(os.path.dirname(__file__), "..", "cu2qu", "data")
|
DATADIR = os.path.join(os.path.dirname(__file__), "..", "cu2qu", "data")
|
||||||
with open(os.path.join(DATADIR, "curves.json"), "r") as fp:
|
with open(os.path.join(DATADIR, "curves.json"), "r") as fp:
|
||||||
curves = json.load(fp)
|
curves = json.load(fp)
|
||||||
|
@ -56,7 +56,6 @@ class ScaleUpemTest(unittest.TestCase):
|
|||||||
self.fail("TTX output is different from expected")
|
self.fail("TTX output is different from expected")
|
||||||
|
|
||||||
def test_scale_upem_ttf(self):
|
def test_scale_upem_ttf(self):
|
||||||
|
|
||||||
font = TTFont(self.get_path("I.ttf"))
|
font = TTFont(self.get_path("I.ttf"))
|
||||||
tables = [table_tag for table_tag in font.keys() if table_tag != "head"]
|
tables = [table_tag for table_tag in font.keys() if table_tag != "head"]
|
||||||
|
|
||||||
@ -66,7 +65,6 @@ class ScaleUpemTest(unittest.TestCase):
|
|||||||
self.expect_ttx(font, expected_ttx_path, tables)
|
self.expect_ttx(font, expected_ttx_path, tables)
|
||||||
|
|
||||||
def test_scale_upem_varComposite(self):
|
def test_scale_upem_varComposite(self):
|
||||||
|
|
||||||
font = TTFont(self.get_path("varc-ac00-ac01.ttf"))
|
font = TTFont(self.get_path("varc-ac00-ac01.ttf"))
|
||||||
tables = [table_tag for table_tag in font.keys() if table_tag != "head"]
|
tables = [table_tag for table_tag in font.keys() if table_tag != "head"]
|
||||||
|
|
||||||
@ -80,7 +78,6 @@ class ScaleUpemTest(unittest.TestCase):
|
|||||||
scale_upem(font, 500)
|
scale_upem(font, 500)
|
||||||
|
|
||||||
def test_scale_upem_otf(self):
|
def test_scale_upem_otf(self):
|
||||||
|
|
||||||
# Just test that it doesn't crash
|
# Just test that it doesn't crash
|
||||||
|
|
||||||
font = TTFont(self.get_path("TestVGID-Regular.otf"))
|
font = TTFont(self.get_path("TestVGID-Regular.otf"))
|
||||||
|
@ -101,7 +101,6 @@ class AxisVariationTableTest(unittest.TestCase):
|
|||||||
|
|
||||||
class Avar2Test(unittest.TestCase):
|
class Avar2Test(unittest.TestCase):
|
||||||
def test(self):
|
def test(self):
|
||||||
|
|
||||||
axisTags = ["wght", "wdth"]
|
axisTags = ["wght", "wdth"]
|
||||||
fvar = table__f_v_a_r()
|
fvar = table__f_v_a_r()
|
||||||
for tag in axisTags:
|
for tag in axisTags:
|
||||||
|
@ -62,7 +62,7 @@ CVAR_VARIATIONS = [
|
|||||||
class CVARTableTest(unittest.TestCase):
|
class CVARTableTest(unittest.TestCase):
|
||||||
def assertVariationsAlmostEqual(self, variations1, variations2):
|
def assertVariationsAlmostEqual(self, variations1, variations2):
|
||||||
self.assertEqual(len(variations1), len(variations2))
|
self.assertEqual(len(variations1), len(variations2))
|
||||||
for (v1, v2) in zip(variations1, variations2):
|
for v1, v2 in zip(variations1, variations2):
|
||||||
self.assertSetEqual(set(v1.axes), set(v2.axes))
|
self.assertSetEqual(set(v1.axes), set(v2.axes))
|
||||||
for axisTag, support1 in v1.axes.items():
|
for axisTag, support1 in v1.axes.items():
|
||||||
support2 = v2.axes[axisTag]
|
support2 = v2.axes[axisTag]
|
||||||
|
@ -137,7 +137,7 @@ class GVARTableTest(unittest.TestCase):
|
|||||||
for glyphName, variations1 in vars1.items():
|
for glyphName, variations1 in vars1.items():
|
||||||
variations2 = vars2[glyphName]
|
variations2 = vars2[glyphName]
|
||||||
self.assertEqual(len(variations1), len(variations2))
|
self.assertEqual(len(variations1), len(variations2))
|
||||||
for (v1, v2) in zip(variations1, variations2):
|
for v1, v2 in zip(variations1, variations2):
|
||||||
self.assertSetEqual(set(v1.axes), set(v2.axes))
|
self.assertSetEqual(set(v1.axes), set(v2.axes))
|
||||||
for axisTag, support1 in v1.axes.items():
|
for axisTag, support1 in v1.axes.items():
|
||||||
support2 = v2.axes[axisTag]
|
support2 = v2.axes[axisTag]
|
||||||
|
@ -7,7 +7,6 @@ from fontTools.ttLib import newTable
|
|||||||
|
|
||||||
|
|
||||||
class Test_l_t_a_g(unittest.TestCase):
|
class Test_l_t_a_g(unittest.TestCase):
|
||||||
|
|
||||||
DATA_ = (
|
DATA_ = (
|
||||||
struct.pack(b">LLLHHHHHH", 1, 0, 3, 24 + 0, 2, 24 + 2, 7, 24 + 2, 2)
|
struct.pack(b">LLLHHHHHH", 1, 0, 3, 24 + 0, 2, 24 + 2, 7, 24 + 2, 2)
|
||||||
+ b"enzh-Hant"
|
+ b"enzh-Hant"
|
||||||
|
@ -27,7 +27,6 @@ class TTVisitorTest(object):
|
|||||||
return os.path.join(path, "data", testfile)
|
return os.path.join(path, "data", testfile)
|
||||||
|
|
||||||
def test_ttvisitor(self):
|
def test_ttvisitor(self):
|
||||||
|
|
||||||
font = TTFont(self.getpath("TestVGID-Regular.otf"))
|
font = TTFont(self.getpath("TestVGID-Regular.otf"))
|
||||||
visitor = TestVisitor()
|
visitor = TestVisitor()
|
||||||
|
|
||||||
|
@ -4712,7 +4712,6 @@ class UFO3WriteDataTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestLayerInfoObject:
|
class TestLayerInfoObject:
|
||||||
|
|
||||||
color = guidelines = lib = None
|
color = guidelines = lib = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,6 @@ class TestInfoObject:
|
|||||||
|
|
||||||
|
|
||||||
class KerningUpConversionTestCase(unittest.TestCase):
|
class KerningUpConversionTestCase(unittest.TestCase):
|
||||||
|
|
||||||
expectedKerning = {
|
expectedKerning = {
|
||||||
("public.kern1.BGroup", "public.kern2.CGroup"): 7,
|
("public.kern1.BGroup", "public.kern2.CGroup"): 7,
|
||||||
("public.kern1.BGroup", "public.kern2.DGroup"): 8,
|
("public.kern1.BGroup", "public.kern2.DGroup"): 8,
|
||||||
@ -239,7 +238,6 @@ class KerningUpConversionTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class KerningDownConversionTestCase(unittest.TestCase):
|
class KerningDownConversionTestCase(unittest.TestCase):
|
||||||
|
|
||||||
expectedKerning = {
|
expectedKerning = {
|
||||||
("public.kern1.BGroup", "public.kern2.CGroup"): 7,
|
("public.kern1.BGroup", "public.kern2.CGroup"): 7,
|
||||||
("public.kern1.BGroup", "public.kern2.DGroup"): 8,
|
("public.kern1.BGroup", "public.kern2.DGroup"): 8,
|
||||||
|
@ -111,7 +111,6 @@ def test_overlayBox():
|
|||||||
|
|
||||||
|
|
||||||
def run(test, n, quiet):
|
def run(test, n, quiet):
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print("%s:" % test.__name__)
|
print("%s:" % test.__name__)
|
||||||
input, output = test(n)
|
input, output = test(n)
|
||||||
|
@ -4,7 +4,6 @@ import pytest
|
|||||||
|
|
||||||
|
|
||||||
class IupTest:
|
class IupTest:
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# Tests
|
# Tests
|
||||||
# -----
|
# -----
|
||||||
|
Loading…
x
Reference in New Issue
Block a user