Misc py23 cleanups (#2243)

* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
This commit is contained in:
Just van Rossum 2021-03-29 11:45:58 +02:00 committed by GitHub
parent a363bd75a1
commit 5fc65d7168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
245 changed files with 396 additions and 561 deletions

View File

@ -35,14 +35,14 @@ The TTX file format
The following tables are currently supported:: The following tables are currently supported::
BASE, CBDT, CBLC, CFF, CFF2, COLR, CPAL, DSIG, EBDT, EBLC, FFTM, BASE, CBDT, CBLC, CFF, CFF2, COLR, CPAL, DSIG, Debg, EBDT, EBLC,
Feat, GDEF, GMAP, GPKG, GPOS, GSUB, Glat, Gloc, HVAR, JSTF, LTSH, FFTM, Feat, GDEF, GMAP, GPKG, GPOS, GSUB, Glat, Gloc, HVAR, JSTF,
MATH, META, MVAR, OS/2, SING, STAT, SVG, Silf, Sill, TSI0, TSI1, LTSH, MATH, META, MVAR, OS/2, SING, STAT, SVG, Silf, Sill, TSI0,
TSI2, TSI3, TSI5, TSIB, TSIC, TSID, TSIJ, TSIP, TSIS, TSIV, TTFA, TSI1, TSI2, TSI3, TSI5, TSIB, TSIC, TSID, TSIJ, TSIP, TSIS, TSIV,
VDMX, VORG, VVAR, ankr, avar, bsln, cidg, cmap, cvar, cvt, feat, TTFA, VDMX, VORG, VVAR, ankr, avar, bsln, cidg, cmap, cvar, cvt,
fpgm, fvar, gasp, gcid, glyf, gvar, hdmx, head, hhea, hmtx, kern, feat, fpgm, fvar, gasp, gcid, glyf, gvar, hdmx, head, hhea, hmtx,
lcar, loca, ltag, maxp, meta, mort, morx, name, opbd, post, prep, kern, lcar, loca, ltag, maxp, meta, mort, morx, name, opbd, post,
prop, sbix, trak, vhea and vmtx prep, prop, sbix, trak, vhea and vmtx
.. end table list .. end table list

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
import logging import logging
from fontTools.misc.loggingTools import configLogger from fontTools.misc.loggingTools import configLogger

View File

@ -46,7 +46,6 @@ Here is an example of using `afmLib` to read, modify and write an AFM file:
""" """
from fontTools.misc.py23 import *
import re import re
# every single line starts with a "word" # every single line starts with a "word"

View File

@ -26,7 +26,7 @@ This is used by fontTools when it has to construct glyph names for a font which
doesn't include any (e.g. format 3.0 post tables). doesn't include any (e.g. format 3.0 post tables).
""" """
from fontTools.misc.py23 import * from fontTools.misc.py23 import tostr
import re import re
@ -5140,7 +5140,7 @@ def _glyphComponentToUnicode(component, isZapfDingbats):
# to the corresponding character in that list. # to the corresponding character in that list.
uchars = LEGACY_AGL2UV.get(component) uchars = LEGACY_AGL2UV.get(component)
if uchars: if uchars:
return "".join(map(unichr, uchars)) return "".join(map(chr, uchars))
# Otherwise, if the component is of the form "uni" (U+0075, # Otherwise, if the component is of the form "uni" (U+0075,
# U+006E, and U+0069) followed by a sequence of uppercase # U+006E, and U+0069) followed by a sequence of uppercase
@ -5210,7 +5210,7 @@ def _uniToUnicode(component):
if any(c >= 0xD800 and c <= 0xDFFF for c in chars): if any(c >= 0xD800 and c <= 0xDFFF for c in chars):
# The AGL specification explicitly excluded surrogate pairs. # The AGL specification explicitly excluded surrogate pairs.
return None return None
return ''.join([unichr(c) for c in chars]) return ''.join([chr(c) for c in chars])
_re_u = re.compile("^u([0-9A-F]{4,6})$") _re_u = re.compile("^u([0-9A-F]{4,6})$")
@ -5228,5 +5228,5 @@ def _uToUnicode(component):
return None return None
if ((value >= 0x0000 and value <= 0xD7FF) or if ((value >= 0x0000 and value <= 0xD7FF) or
(value >= 0xE000 and value <= 0x10FFFF)): (value >= 0xE000 and value <= 0x10FFFF)):
return unichr(value) return chr(value)
return None return None

View File

@ -11,7 +11,7 @@ the demands of variable fonts. This module parses both original CFF and CFF2.
""" """
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, bytesjoin, tobytes, tostr
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc import psCharStrings from fontTools.misc import psCharStrings
from fontTools.misc.arrayTools import unionRect, intRect from fontTools.misc.arrayTools import unionRect, intRect
@ -20,6 +20,7 @@ from fontTools.ttLib import TTFont
from fontTools.ttLib.tables.otBase import OTTableWriter from fontTools.ttLib.tables.otBase import OTTableWriter
from fontTools.ttLib.tables.otBase import OTTableReader from fontTools.ttLib.tables.otBase import OTTableReader
from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables import otTables as ot
from io import BytesIO
import struct import struct
import logging import logging
import re import re
@ -1245,7 +1246,7 @@ class ASCIIConverter(SimpleConverter):
return tobytes(value, encoding='ascii') return tobytes(value, encoding='ascii')
def xmlWrite(self, xmlWriter, name, value): def xmlWrite(self, xmlWriter, name, value):
xmlWriter.simpletag(name, value=tounicode(value, encoding="ascii")) xmlWriter.simpletag(name, value=tostr(value, encoding="ascii"))
xmlWriter.newline() xmlWriter.newline()
def xmlRead(self, name, attrs, content, parent): def xmlRead(self, name, attrs, content, parent):
@ -1261,7 +1262,7 @@ class Latin1Converter(SimpleConverter):
return tobytes(value, encoding='latin1') return tobytes(value, encoding='latin1')
def xmlWrite(self, xmlWriter, name, value): def xmlWrite(self, xmlWriter, name, value):
value = tounicode(value, encoding="latin1") value = tostr(value, encoding="latin1")
if name in ['Notice', 'Copyright']: if name in ['Notice', 'Copyright']:
value = re.sub(r"[\r\n]\s+", " ", value) value = re.sub(r"[\r\n]\s+", " ", value)
xmlWriter.simpletag(name, value=value) xmlWriter.simpletag(name, value=value)

View File

@ -13,7 +13,6 @@ and specific forms of the operation.
""" """
from fontTools.misc.py23 import *
from fontTools.cffLib import maxStackLimit from fontTools.cffLib import maxStackLimit

View File

@ -7,11 +7,10 @@ value do not need to specify their width in their charstring, saving bytes.
This module determines the optimum ``defaultWidthX`` and ``nominalWidthX`` This module determines the optimum ``defaultWidthX`` and ``nominalWidthX``
values for a font, when provided with a list of glyph widths.""" values for a font, when provided with a list of glyph widths."""
from fontTools.misc.py23 import * from fontTools.ttLib import TTFont
from fontTools.ttLib import TTFont, getTableClass
from collections import defaultdict from collections import defaultdict
from operator import add from operator import add
from functools import partial, reduce from functools import reduce
class missingdict(dict): class missingdict(dict):

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from fontTools.misc.py23 import * from fontTools.misc.py23 import tobytes, tostr
from fontTools.misc.loggingTools import LogMixin from fontTools.misc.loggingTools import LogMixin
import collections import collections
from io import BytesIO, StringIO
import os import os
import posixpath import posixpath
from fontTools.misc import etree as ET from fontTools.misc import etree as ET
@ -290,25 +291,25 @@ class InstanceDescriptor(SimpleDescriptor):
filename = posixpath_property("_filename") filename = posixpath_property("_filename")
def setStyleName(self, styleName, languageCode="en"): def setStyleName(self, styleName, languageCode="en"):
self.localisedStyleName[languageCode] = tounicode(styleName) self.localisedStyleName[languageCode] = tostr(styleName)
def getStyleName(self, languageCode="en"): def getStyleName(self, languageCode="en"):
return self.localisedStyleName.get(languageCode) return self.localisedStyleName.get(languageCode)
def setFamilyName(self, familyName, languageCode="en"): def setFamilyName(self, familyName, languageCode="en"):
self.localisedFamilyName[languageCode] = tounicode(familyName) self.localisedFamilyName[languageCode] = tostr(familyName)
def getFamilyName(self, languageCode="en"): def getFamilyName(self, languageCode="en"):
return self.localisedFamilyName.get(languageCode) return self.localisedFamilyName.get(languageCode)
def setStyleMapStyleName(self, styleMapStyleName, languageCode="en"): def setStyleMapStyleName(self, styleMapStyleName, languageCode="en"):
self.localisedStyleMapStyleName[languageCode] = tounicode(styleMapStyleName) self.localisedStyleMapStyleName[languageCode] = tostr(styleMapStyleName)
def getStyleMapStyleName(self, languageCode="en"): def getStyleMapStyleName(self, languageCode="en"):
return self.localisedStyleMapStyleName.get(languageCode) return self.localisedStyleMapStyleName.get(languageCode)
def setStyleMapFamilyName(self, styleMapFamilyName, languageCode="en"): def setStyleMapFamilyName(self, styleMapFamilyName, languageCode="en"):
self.localisedStyleMapFamilyName[languageCode] = tounicode(styleMapFamilyName) self.localisedStyleMapFamilyName[languageCode] = tostr(styleMapFamilyName)
def getStyleMapFamilyName(self, languageCode="en"): def getStyleMapFamilyName(self, languageCode="en"):
return self.localisedStyleMapFamilyName.get(languageCode) return self.localisedStyleMapFamilyName.get(languageCode)
@ -823,7 +824,7 @@ class BaseDocReader(LogMixin):
# '{http://www.w3.org/XML/1998/namespace}lang' # '{http://www.w3.org/XML/1998/namespace}lang'
for key, lang in labelNameElement.items(): for key, lang in labelNameElement.items():
if key == XML_LANG: if key == XML_LANG:
axisObject.labelNames[lang] = tounicode(labelNameElement.text) axisObject.labelNames[lang] = tostr(labelNameElement.text)
self.documentObject.axes.append(axisObject) self.documentObject.axes.append(axisObject)
self.axisDefaults[axisObject.name] = axisObject.default self.axisDefaults[axisObject.name] = axisObject.default
@ -1099,10 +1100,10 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
return self return self
def tostring(self, encoding=None): def tostring(self, encoding=None):
if encoding is unicode or ( if encoding is str or (
encoding is not None and encoding.lower() == "unicode" encoding is not None and encoding.lower() == "unicode"
): ):
f = UnicodeIO() f = StringIO()
xml_declaration = False xml_declaration = False
elif encoding is None or encoding == "utf-8": elif encoding is None or encoding == "utf-8":
f = BytesIO() f = BytesIO()

View File

@ -1,5 +1,3 @@
from fontTools.misc.py23 import *
MacRoman = [ MacRoman = [
'NUL', 'Eth', 'eth', 'Lslash', 'lslash', 'Scaron', 'scaron', 'Yacute', 'NUL', 'Eth', 'eth', 'Lslash', 'lslash', 'Scaron', 'scaron', 'Yacute',
'yacute', 'HT', 'LF', 'Thorn', 'thorn', 'CR', 'Zcaron', 'zcaron', 'DLE', 'DC1', 'yacute', 'HT', 'LF', 'Thorn', 'thorn', 'CR', 'Zcaron', 'zcaron', 'DLE', 'DC1',

View File

@ -1,5 +1,3 @@
from fontTools.misc.py23 import *
StandardEncoding = [ StandardEncoding = [
'.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef',
'.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef', '.notdef',

View File

@ -1,3 +1 @@
"""Empty __init__.py file to signal Python this directory is a package.""" """Empty __init__.py file to signal Python this directory is a package."""
from fontTools.misc.py23 import *

View File

@ -1,7 +1,6 @@
"""Extend the Python codecs module with a few encodings that are used in OpenType (name table) """Extend the Python codecs module with a few encodings that are used in OpenType (name table)
but missing from Python. See https://github.com/fonttools/fonttools/issues/236 for details.""" but missing from Python. See https://github.com/fonttools/fonttools/issues/236 for details."""
from fontTools.misc.py23 import *
import codecs import codecs
import encodings import encodings
@ -57,35 +56,35 @@ class ExtendCodec(codecs.Codec):
_extended_encodings = { _extended_encodings = {
"x_mac_japanese_ttx": ("shift_jis", { "x_mac_japanese_ttx": ("shift_jis", {
b"\xFC": unichr(0x007C), b"\xFC": chr(0x007C),
b"\x7E": unichr(0x007E), b"\x7E": chr(0x007E),
b"\x80": unichr(0x005C), b"\x80": chr(0x005C),
b"\xA0": unichr(0x00A0), b"\xA0": chr(0x00A0),
b"\xFD": unichr(0x00A9), b"\xFD": chr(0x00A9),
b"\xFE": unichr(0x2122), b"\xFE": chr(0x2122),
b"\xFF": unichr(0x2026), b"\xFF": chr(0x2026),
}), }),
"x_mac_trad_chinese_ttx": ("big5", { "x_mac_trad_chinese_ttx": ("big5", {
b"\x80": unichr(0x005C), b"\x80": chr(0x005C),
b"\xA0": unichr(0x00A0), b"\xA0": chr(0x00A0),
b"\xFD": unichr(0x00A9), b"\xFD": chr(0x00A9),
b"\xFE": unichr(0x2122), b"\xFE": chr(0x2122),
b"\xFF": unichr(0x2026), b"\xFF": chr(0x2026),
}), }),
"x_mac_korean_ttx": ("euc_kr", { "x_mac_korean_ttx": ("euc_kr", {
b"\x80": unichr(0x00A0), b"\x80": chr(0x00A0),
b"\x81": unichr(0x20A9), b"\x81": chr(0x20A9),
b"\x82": unichr(0x2014), b"\x82": chr(0x2014),
b"\x83": unichr(0x00A9), b"\x83": chr(0x00A9),
b"\xFE": unichr(0x2122), b"\xFE": chr(0x2122),
b"\xFF": unichr(0x2026), b"\xFF": chr(0x2026),
}), }),
"x_mac_simp_chinese_ttx": ("gb2312", { "x_mac_simp_chinese_ttx": ("gb2312", {
b"\x80": unichr(0x00FC), b"\x80": chr(0x00FC),
b"\xA0": unichr(0x00A0), b"\xA0": chr(0x00A0),
b"\xFD": unichr(0x00A9), b"\xFD": chr(0x00A9),
b"\xFE": unichr(0x2122), b"\xFE": chr(0x2122),
b"\xFF": unichr(0x2026), b"\xFF": chr(0x2026),
}), }),
} }

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont from fontTools.ttLib import TTFont
from fontTools.feaLib.builder import addOpenTypeFeatures, Builder from fontTools.feaLib.builder import addOpenTypeFeatures, Builder
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.error import FeatureLibError

View File

@ -1,10 +1,9 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import byteord, tobytes
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.error import FeatureLibError
from fontTools.feaLib.location import FeatureLibLocation from fontTools.feaLib.location import FeatureLibLocation
from fontTools.misc.encodingTools import getEncoding from fontTools.misc.encodingTools import getEncoding
from collections import OrderedDict from collections import OrderedDict
import itertools import itertools
from typing import NamedTuple
SHIFT = " " * 4 SHIFT = " " * 4
@ -1669,7 +1668,7 @@ class NameRecord(Statement):
def escape(c, escape_pattern): def escape(c, escape_pattern):
# Also escape U+0022 QUOTATION MARK and U+005C REVERSE SOLIDUS # Also escape U+0022 QUOTATION MARK and U+005C REVERSE SOLIDUS
if c >= 0x20 and c <= 0x7E and c not in (0x22, 0x5C): if c >= 0x20 and c <= 0x7E and c not in (0x22, 0x5C):
return unichr(c) return chr(c)
else: else:
return escape_pattern % c return escape_pattern % c

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import Tag, tostr
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import binary2num, safeEval from fontTools.misc.textTools import binary2num, safeEval
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.error import FeatureLibError
@ -33,6 +33,7 @@ from fontTools.otlLib.builder import (
from fontTools.otlLib.error import OpenTypeLibError from fontTools.otlLib.error import OpenTypeLibError
from collections import defaultdict from collections import defaultdict
import itertools import itertools
from io import StringIO
import logging import logging
import warnings import warnings
import os import os
@ -78,7 +79,7 @@ def addOpenTypeFeaturesFromString(
""" """
featurefile = UnicodeIO(tounicode(features)) featurefile = StringIO(tostr(features))
if filename: if filename:
featurefile.name = filename featurefile.name = filename
addOpenTypeFeatures(font, featurefile, tables=tables, debug=debug) addOpenTypeFeatures(font, featurefile, tables=tables, debug=debug)

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.feaLib.error import FeatureLibError, IncludedFeaNotFound from fontTools.feaLib.error import FeatureLibError, IncludedFeaNotFound
from fontTools.feaLib.location import FeatureLibLocation from fontTools.feaLib.location import FeatureLibLocation
import re import re

View File

@ -1,7 +1,7 @@
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.error import FeatureLibError
from fontTools.feaLib.lexer import Lexer, IncludingLexer, NonIncludingLexer from fontTools.feaLib.lexer import Lexer, IncludingLexer, NonIncludingLexer
from fontTools.misc.encodingTools import getEncoding from fontTools.misc.encodingTools import getEncoding
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, tobytes, tostr
import fontTools.feaLib.ast as ast import fontTools.feaLib.ast as ast
import logging import logging
import os import os
@ -1222,12 +1222,12 @@ class Parser(object):
# We convert surrogates to actual Unicode by round-tripping through # We convert surrogates to actual Unicode by round-tripping through
# Python's UTF-16 codec in a special mode. # Python's UTF-16 codec in a special mode.
utf16 = tobytes(s, "utf_16_be", "surrogatepass") utf16 = tobytes(s, "utf_16_be", "surrogatepass")
return tounicode(utf16, "utf_16_be") return tostr(utf16, "utf_16_be")
@staticmethod @staticmethod
def unescape_unichr_(match): def unescape_unichr_(match):
n = match.group(0)[1:] n = match.group(0)[1:]
return unichr(int(n, 16)) return chr(int(n, 16))
@staticmethod @staticmethod
def unescape_byte_(match, encoding): def unescape_byte_(match, encoding):

View File

@ -129,10 +129,8 @@ fb.save("test.otf")
``` ```
""" """
from .misc.py23 import *
from .ttLib import TTFont, newTable from .ttLib import TTFont, newTable
from .ttLib.tables._c_m_a_p import cmap_classes from .ttLib.tables._c_m_a_p import cmap_classes
from .ttLib.tables._n_a_m_e import NameRecord, makeName
from .misc.timeTools import timestampNow from .misc.timeTools import timestampNow
import struct import struct
from collections import OrderedDict from collections import OrderedDict
@ -894,7 +892,6 @@ def buildCmapSubTable(cmapping, format, platformID, platEncID):
def addFvar(font, axes, instances): def addFvar(font, axes, instances):
from .ttLib.tables._f_v_a_r import Axis, NamedInstance from .ttLib.tables._f_v_a_r import Axis, NamedInstance
from .designspaceLib import AxisDescriptor
assert axes assert axes

View File

@ -2,7 +2,6 @@
# #
# Google Author(s): Behdad Esfahbod, Roozbeh Pournader # Google Author(s): Behdad Esfahbod, Roozbeh Pournader
from fontTools.misc.py23 import *
from fontTools.misc.timeTools import timestampNow from fontTools.misc.timeTools import timestampNow
from fontTools import ttLib, cffLib from fontTools import ttLib, cffLib
from fontTools.ttLib.tables import otTables, _h_e_a_d from fontTools.ttLib.tables import otTables, _h_e_a_d

View File

@ -1,3 +1 @@
"""Empty __init__.py file to signal Python this directory is a package.""" """Empty __init__.py file to signal Python this directory is a package."""
from fontTools.misc.py23 import *

View File

@ -2,7 +2,6 @@
so on. so on.
""" """
from fontTools.misc.py23 import *
from fontTools.misc.roundTools import otRound from fontTools.misc.roundTools import otRound
from fontTools.misc.vector import Vector as _Vector from fontTools.misc.vector import Vector as _Vector
import math import math

View File

@ -3,8 +3,7 @@
""" """
from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea
from fontTools.misc.transform import Offset, Identity from fontTools.misc.transform import Identity
from fontTools.misc.py23 import *
import math import math
from collections import namedtuple from collections import namedtuple

View File

@ -1,7 +1,6 @@
""" fontTools.misc.classifyTools.py -- tools for classifying things. """ fontTools.misc.classifyTools.py -- tools for classifying things.
""" """
from fontTools.misc.py23 import *
class Classifier(object): class Classifier(object):

View File

@ -1,5 +1,4 @@
"""Collection of utilities for command-line interfaces and console scripts.""" """Collection of utilities for command-line interfaces and console scripts."""
from fontTools.misc.py23 import *
import os import os
import re import re

View File

@ -1,6 +1,5 @@
"""Misc dict tools.""" """Misc dict tools."""
from fontTools.misc.py23 import *
__all__ = ['hashdict'] __all__ = ['hashdict']

View File

@ -12,7 +12,8 @@ the new key at the end of the operation.
""" """
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, bytesjoin, byteord
def _decryptChar(cipher, R): def _decryptChar(cipher, R):
cipher = byteord(cipher) cipher = byteord(cipher)

View File

@ -1,7 +1,6 @@
"""fontTools.misc.encodingTools.py -- tools for working with OpenType encodings. """fontTools.misc.encodingTools.py -- tools for working with OpenType encodings.
""" """
from fontTools.misc.py23 import *
import fontTools.encodings.codecs import fontTools.encodings.codecs
# Map keyed by platformID, then platEncID, then possibly langID # Map keyed by platformID, then platEncID, then possibly langID

View File

@ -11,7 +11,7 @@ or subclasses built-in ElementTree classes to add features that are
only availble in lxml, like OrderedDict for attributes, pretty_print and only availble in lxml, like OrderedDict for attributes, pretty_print and
iterwalk. iterwalk.
""" """
from fontTools.misc.py23 import unicode, tounicode, open from fontTools.misc.py23 import unicode, tostr
XML_DECLARATION = """<?xml version='1.0' encoding='%s'?>""" XML_DECLARATION = """<?xml version='1.0' encoding='%s'?>"""
@ -242,7 +242,7 @@ except ImportError:
Reject all bytes input that contains non-ASCII characters. Reject all bytes input that contains non-ASCII characters.
""" """
try: try:
s = tounicode(s, encoding="ascii", errors="strict") s = tostr(s, encoding="ascii", errors="strict")
except UnicodeDecodeError: except UnicodeDecodeError:
raise ValueError( raise ValueError(
"Bytes strings can only contain ASCII characters. " "Bytes strings can only contain ASCII characters. "

View File

@ -16,7 +16,7 @@ by Tal Leming and is copyright (c) 2005-2016, The RoboFab Developers:
- Tal Leming - Tal Leming
- Just van Rossum - Just van Rossum
""" """
from fontTools.misc.py23 import unicode
illegalCharacters = r"\" * + / : < > ? [ \ ] | \0".split(" ") illegalCharacters = r"\" * + / : < > ? [ \ ] | \0".split(" ")
illegalCharacters += [chr(i) for i in range(1, 32)] illegalCharacters += [chr(i) for i in range(1, 32)]
@ -95,9 +95,9 @@ def userNameToFileName(userName, existing=[], prefix="", suffix=""):
>>> userNameToFileName("alt.con") == "alt._con" >>> userNameToFileName("alt.con") == "alt._con"
True True
""" """
# the incoming name must be a unicode string # the incoming name must be a str
if not isinstance(userName, unicode): if not isinstance(userName, str):
raise ValueError("The value for userName must be a unicode string.") raise ValueError("The value for userName must be a string.")
# establish the prefix and suffix lengths # establish the prefix and suffix lengths
prefixLength = len(prefix) prefixLength = len(prefix)
suffixLength = len(suffix) suffixLength = len(suffix)

View File

@ -17,9 +17,7 @@ functions for converting between fixed-point, float and string representations.
The maximum value that can still fit in an F2Dot14. (1.99993896484375) The maximum value that can still fit in an F2Dot14. (1.99993896484375)
""" """
from fontTools.misc.py23 import *
from .roundTools import otRound from .roundTools import otRound
import math
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -1,5 +1,3 @@
from fontTools.misc.py23 import *
__all__ = ['popCount'] __all__ = ['popCount']

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
import sys import sys
import logging import logging
import timeit import timeit

View File

@ -1,5 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import Tag, bytesjoin, strjoin
import sys
try: try:
import xattr import xattr
except ImportError: except ImportError:

View File

@ -1,4 +1,5 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin, tostr
from io import BytesIO
import struct import struct
from fontTools.misc import sstruct from fontTools.misc import sstruct
from collections import OrderedDict from collections import OrderedDict

View File

@ -1,5 +1,4 @@
import collections.abc import collections.abc
import sys
import re import re
from typing import ( from typing import (
Any, Any,
@ -24,10 +23,8 @@ from functools import singledispatch
from fontTools.misc import etree from fontTools.misc import etree
from fontTools.misc.py23 import ( from fontTools.misc.py23 import tostr
tounicode,
tobytes,
)
# By default, we # By default, we
# - deserialize <data> elements as bytes and # - deserialize <data> elements as bytes and
@ -368,7 +365,7 @@ def _dict_element(d: Mapping[str, PlistEncodable], ctx: SimpleNamespace) -> etre
continue continue
raise TypeError("keys must be strings") raise TypeError("keys must be strings")
k = etree.SubElement(el, "key") k = etree.SubElement(el, "key")
k.text = tounicode(key, "utf-8") k.text = tostr(key, "utf-8")
el.append(_make_element(value, ctx)) el.append(_make_element(value, ctx))
ctx.indent_level -= 1 ctx.indent_level -= 1
return el return el

View File

@ -2,7 +2,7 @@
CFF dictionary data and Type1/Type2 CharStrings. CFF dictionary data and Type1/Type2 CharStrings.
""" """
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, bytesjoin, strjoin
from fontTools.misc.fixedTools import ( from fontTools.misc.fixedTools import (
fixedToFloat, floatToFixed, floatToFixedToStr, strToFixedToFloat, fixedToFloat, floatToFixed, floatToFixedToStr, strToFixedToFloat,
) )

View File

@ -1,6 +1,21 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, bytesjoin, tobytes, tostr
from fontTools.misc import eexec from fontTools.misc import eexec
from .psOperators import * from .psOperators import (
PSOperators,
ps_StandardEncoding,
ps_array,
ps_boolean,
ps_dict,
ps_integer,
ps_literal,
ps_mark,
ps_name,
ps_operator,
ps_procedure,
ps_procmark,
ps_real,
ps_string,
)
import re import re
from collections.abc import Callable from collections.abc import Callable
from string import whitespace from string import whitespace

View File

@ -1,5 +1,3 @@
from fontTools.misc.py23 import *
_accessstrings = {0: "", 1: "readonly", 2: "executeonly", 3: "noaccess"} _accessstrings = {0: "", 1: "readonly", 2: "executeonly", 3: "noaccess"}

View File

@ -46,7 +46,7 @@ calcsize(fmt)
it returns the size of the data in bytes. it returns the size of the data in bytes.
""" """
from fontTools.misc.py23 import * from fontTools.misc.py23 import tobytes, tostr
from fontTools.misc.fixedTools import fixedToFloat as fi2fl, floatToFixed as fl2fi from fontTools.misc.fixedTools import fixedToFloat as fi2fl, floatToFixed as fl2fi
import struct import struct
import re import re

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.pens.basePen import BasePen from fontTools.pens.basePen import BasePen
from functools import partial from functools import partial
from itertools import count from itertools import count
@ -112,8 +111,7 @@ MomentXYPen = partial(GreenPen, func=x*y)
def printGreenPen(penName, funcs, file=sys.stdout): def printGreenPen(penName, funcs, file=sys.stdout):
print( print(
'''from fontTools.misc.py23 import * '''from fontTools.pens.basePen import BasePen
from fontTools.pens.basePen import BasePen
class %s(BasePen): class %s(BasePen):

View File

@ -1,12 +1,13 @@
"""Helpers for writing unit tests.""" """Helpers for writing unit tests."""
from collections.abc import Iterable from collections.abc import Iterable
from io import BytesIO
import os import os
import shutil import shutil
import sys import sys
import tempfile import tempfile
from unittest import TestCase as _TestCase from unittest import TestCase as _TestCase
from fontTools.misc.py23 import * from fontTools.misc.py23 import tobytes
from fontTools.misc.xmlWriter import XMLWriter from fontTools.misc.xmlWriter import XMLWriter
@ -25,7 +26,7 @@ def parseXML(xmlSnippet):
xml = b"<root>" xml = b"<root>"
if isinstance(xmlSnippet, bytes): if isinstance(xmlSnippet, bytes):
xml += xmlSnippet xml += xmlSnippet
elif isinstance(xmlSnippet, unicode): elif isinstance(xmlSnippet, str):
xml += tobytes(xmlSnippet, 'utf-8') xml += tobytes(xmlSnippet, 'utf-8')
elif isinstance(xmlSnippet, Iterable): elif isinstance(xmlSnippet, Iterable):
xml += b"".join(tobytes(s, 'utf-8') for s in xmlSnippet) xml += b"".join(tobytes(s, 'utf-8') for s in xmlSnippet)

View File

@ -1,7 +1,7 @@
"""fontTools.misc.textTools.py -- miscellaneous routines.""" """fontTools.misc.textTools.py -- miscellaneous routines."""
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, bytesjoin, strjoin, tobytes
import ast import ast
import string import string

View File

@ -1,7 +1,6 @@
"""fontTools.misc.timeTools.py -- tools for working with OpenType timestamps. """fontTools.misc.timeTools.py -- tools for working with OpenType timestamps.
""" """
from fontTools.misc.py23 import *
import os import os
import time import time
from datetime import datetime, timezone from datetime import datetime, timezone

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools import ttLib from fontTools import ttLib
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from fontTools.ttLib.tables.DefaultTable import DefaultTable from fontTools.ttLib.tables.DefaultTable import DefaultTable

View File

@ -1,6 +1,6 @@
"""xmlWriter.py -- Simple XML authoring class""" """xmlWriter.py -- Simple XML authoring class"""
from fontTools.misc.py23 import * from fontTools.misc.py23 import byteord, strjoin, tobytes, tostr
import sys import sys
import os import os
import string import string
@ -34,8 +34,8 @@ class XMLWriter(object):
self.totype = tobytes self.totype = tobytes
except TypeError: except TypeError:
# This better not fail. # This better not fail.
self.file.write(tounicode('')) self.file.write('')
self.totype = tounicode self.totype = tostr
self.indentwhite = self.totype(indentwhite) self.indentwhite = self.totype(indentwhite)
if newlinestr is None: if newlinestr is None:
self.newlinestr = self.totype(os.linesep) self.newlinestr = self.totype(os.linesep)
@ -156,7 +156,7 @@ class XMLWriter(object):
return "" return ""
data = "" data = ""
for attr, value in attributes: for attr, value in attributes:
if not isinstance(value, (bytes, unicode)): if not isinstance(value, (bytes, str)):
value = str(value) value = str(value)
data = data + ' %s="%s"' % (attr, escapeattr(value)) data = data + ' %s="%s"' % (attr, escapeattr(value))
return data return data

View File

@ -6,7 +6,6 @@
# http://monotype.github.io/OpenType_Table_Source/otl_source.html # http://monotype.github.io/OpenType_Table_Source/otl_source.html
# https://github.com/Monotype/OpenType_Table_Source/ # https://github.com/Monotype/OpenType_Table_Source/
from fontTools.misc.py23 import *
from fontTools import ttLib from fontTools import ttLib
from fontTools.ttLib.tables._c_m_a_p import cmap_classes from fontTools.ttLib.tables._c_m_a_p import cmap_classes
from fontTools.ttLib.tables import otTables as ot from fontTools.ttLib.tables import otTables as ot

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
import sys import sys
from fontTools.mtiLib import main from fontTools.mtiLib import main

View File

@ -36,7 +36,7 @@ Coordinates are usually expressed as (x, y) tuples, but generally any
sequence of length 2 will do. sequence of length 2 will do.
""" """
from typing import Any, Tuple from typing import Tuple
from fontTools.misc.loggingTools import LogMixin from fontTools.misc.loggingTools import LogMixin

View File

@ -13,7 +13,7 @@ For instance, whether or not a point is smooth, and its name.
""" """
import math import math
from typing import Any, List, Optional, Tuple from typing import Any, Optional, Tuple
from fontTools.pens.basePen import AbstractPen from fontTools.pens.basePen import AbstractPen

View File

@ -140,7 +140,6 @@ class RecordingPointPen(AbstractPointPen):
if __name__ == "__main__": if __name__ == "__main__":
from fontTools.pens.basePen import _TestPen
pen = RecordingPen() pen = RecordingPen()
pen.moveTo((0, 0)) pen.moveTo((0, 0))
pen.lineTo((0, 100)) pen.lineTo((0, 100))

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
import sys import sys
from fontTools.subset import main from fontTools.subset import main

View File

@ -1,5 +1,3 @@
from fontTools.misc.py23 import *
from .path import SVGPath, parse_path from .path import SVGPath, parse_path
__all__ = ["SVGPath", "parse_path"] __all__ = ["SVGPath", "parse_path"]

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import tostr
from fontTools.pens.transformPen import TransformPen from fontTools.pens.transformPen import TransformPen
from fontTools.misc import etree from fontTools.misc import etree

View File

@ -4,10 +4,8 @@ The code is mostly adapted from Blink's SVGPathNormalizer::DecomposeArcToCubic
https://github.com/chromium/chromium/blob/93831f2/third_party/ https://github.com/chromium/chromium/blob/93831f2/third_party/
blink/renderer/core/svg/svg_path_parser.cc#L169-L278 blink/renderer/core/svg/svg_path_parser.cc#L169-L278
""" """
from fontTools.misc.py23 import *
from fontTools.misc.py23 import isfinite
from fontTools.misc.transform import Identity, Scale from fontTools.misc.transform import Identity, Scale
from math import atan2, ceil, cos, fabs, pi, radians, sin, sqrt, tan from math import atan2, ceil, cos, fabs, isfinite, pi, radians, sin, sqrt, tan
TWO_PI = 2 * pi TWO_PI = 2 * pi

View File

@ -7,7 +7,6 @@
# Copyright (c) 2013-2014 Lennart Regebro # Copyright (c) 2013-2014 Lennart Regebro
# License: MIT # License: MIT
from fontTools.misc.py23 import *
from .arc import EllipticalArc from .arc import EllipticalArc
import re import re

View File

@ -15,7 +15,7 @@ write(path, data, kind='OTHER', dohex=False)
part should be written as hexadecimal or binary, but only if kind part should be written as hexadecimal or binary, but only if kind
is 'OTHER'. is 'OTHER'.
""" """
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, bytesjoin
from fontTools.misc import eexec from fontTools.misc import eexec
from fontTools.misc.macCreatorType import getMacCreatorAndType from fontTools.misc.macCreatorType import getMacCreatorAndType
import os import os

View File

@ -41,7 +41,6 @@ Dumping 'prep' table...
""" """
from fontTools.misc.py23 import *
from fontTools.misc.loggingTools import deprecateFunction from fontTools.misc.loggingTools import deprecateFunction
import logging import logging

View File

@ -1,5 +1,5 @@
"""ttLib.macUtils.py -- Various Mac-specific stuff.""" """ttLib.macUtils.py -- Various Mac-specific stuff."""
from fontTools.misc.py23 import * from io import BytesIO
from fontTools.misc.macRes import ResourceReader, ResourceError from fontTools.misc.macRes import ResourceReader, ResourceError

View File

@ -1,5 +1,3 @@
from fontTools.misc.py23 import *
# #
# 'post' table formats 1.0 and 2.0 rely on this list of "standard" # 'post' table formats 1.0 and 2.0 rely on this list of "standard"
# glyphs. # glyphs.

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,6 +1,5 @@
# Since bitmap glyph metrics are shared between EBLC and EBDT # Since bitmap glyph metrics are shared between EBLC and EBDT
# this class gets its own python file. # this class gets its own python file.
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
import logging import logging

View File

@ -3,7 +3,7 @@
# Google Author(s): Matt Fontaine # Google Author(s): Matt Fontaine
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin
from fontTools.misc import sstruct from fontTools.misc import sstruct
from . import E_B_D_T_ from . import E_B_D_T_
from .BitmapGlyphMetrics import BigGlyphMetrics, bigGlyphMetricsFormat, SmallGlyphMetrics, smallGlyphMetricsFormat from .BitmapGlyphMetrics import BigGlyphMetrics, bigGlyphMetricsFormat, SmallGlyphMetrics, smallGlyphMetricsFormat

View File

@ -2,7 +2,6 @@
# #
# Google Author(s): Matt Fontaine # Google Author(s): Matt Fontaine
from fontTools.misc.py23 import *
from . import E_B_L_C_ 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_):

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from io import BytesIO
from fontTools import cffLib from fontTools import cffLib
from . import DefaultTable from . import DefaultTable

View File

@ -1,5 +1,4 @@
from fontTools.misc.py23 import * from io import BytesIO
from fontTools import cffLib
from fontTools.ttLib.tables.C_F_F_ import table_C_F_F_ from fontTools.ttLib.tables.C_F_F_ import table_C_F_F_

View File

@ -2,7 +2,6 @@
# #
# Google Author(s): Behdad Esfahbod # Google Author(s): Behdad Esfahbod
from fontTools.misc.py23 import *
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable

View File

@ -2,7 +2,7 @@
# #
# Google Author(s): Behdad Esfahbod # Google Author(s): Behdad Esfahbod
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable
import array import array

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin, strjoin, tobytes, tostr
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from fontTools.misc import sstruct from fontTools.misc import sstruct
from . import DefaultTable from . import DefaultTable

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import Tag
from fontTools.ttLib import getClassTag from fontTools.ttLib import getClassTag
class DefaultTable(object): class DefaultTable(object):

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, bytesjoin, strjoin
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval, readHex, hexStr, deHexStr from fontTools.misc.textTools import safeEval, readHex, hexStr, deHexStr
from .BitmapGlyphMetrics import BigGlyphMetrics, bigGlyphMetricsFormat, SmallGlyphMetrics, smallGlyphMetricsFormat from .BitmapGlyphMetrics import BigGlyphMetrics, bigGlyphMetricsFormat, SmallGlyphMetrics, smallGlyphMetricsFormat

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin
from fontTools.misc import sstruct from fontTools.misc import sstruct
from . import DefaultTable from . import DefaultTable
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from fontTools.misc.timeTools import timestampFromString, timestampToString from fontTools.misc.timeTools import timestampFromString, timestampToString

View File

@ -1,8 +1,6 @@
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr from fontTools.misc.fixedTools import floatToFixedToStr
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from .otBase import BaseTTXConverter
from . import DefaultTable from . import DefaultTable
from . import grUtils from . import grUtils
import struct import struct

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import tobytes, tostr
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval, readHex from fontTools.misc.textTools import safeEval, readHex
from . import DefaultTable from . import DefaultTable

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,12 +1,11 @@
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr from fontTools.misc.fixedTools import floatToFixedToStr
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from itertools import * # from itertools import *
from functools import partial from functools import partial
from . import DefaultTable from . import DefaultTable
from . import grUtils from . import grUtils
import struct, operator, warnings import struct
Glat_format_0 = """ Glat_format_0 = """

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable
import struct import struct

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import byteord
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable
@ -229,7 +229,7 @@ class GlyphRecord(object):
# XXX The following two functions are really broken around UTF-8 vs Unicode # XXX The following two functions are really broken around UTF-8 vs Unicode
def mapXMLToUTF8(string): def mapXMLToUTF8(string):
uString = unicode() uString = str()
strLen = len(string) strLen = len(string)
i = 0 i = 0
while i < strLen: while i < strLen:
@ -245,9 +245,9 @@ def mapXMLToUTF8(string):
i = i+1 i = i+1
valStr = string[j:i] valStr = string[j:i]
uString = uString + unichr(eval('0x' + valStr)) uString = uString + chr(eval('0x' + valStr))
else: else:
uString = uString + unichr(byteord(string[i])) uString = uString + chr(byteord(string[i]))
i = i +1 i = i +1
return uString.encode('utf_8') return uString.encode('utf_8')

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval, num2binary, binary2num from fontTools.misc.textTools import safeEval, num2binary, binary2num
from fontTools.ttLib.tables import DefaultTable from fontTools.ttLib.tables import DefaultTable

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytechr, byteord, tobytes, tostr
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from . import DefaultTable from . import DefaultTable

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,12 +1,12 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import bytesjoin, strjoin, tobytes, tostr
from fontTools.misc import sstruct from fontTools.misc import sstruct
from . import DefaultTable from . import DefaultTable
try: try:
import xml.etree.cElementTree as ET import xml.etree.cElementTree as ET
except ImportError: except ImportError:
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from io import BytesIO
import struct import struct
import re
import logging import logging

View File

@ -1,13 +1,13 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import byteord
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr from fontTools.misc.fixedTools import floatToFixedToStr
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval
from itertools import * # from itertools import *
from . import DefaultTable from . import DefaultTable
from . import grUtils from . import grUtils
from array import array from array import array
from functools import reduce from functools import reduce
import struct, operator, warnings, re, sys import struct, re, sys
Silf_hdr_format = ''' Silf_hdr_format = '''
> >

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from fontTools.misc import sstruct from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr from fontTools.misc.fixedTools import floatToFixedToStr
from fontTools.misc.textTools import safeEval from fontTools.misc.textTools import safeEval

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .T_S_I_V_ import table_T_S_I_V_ from .T_S_I_V_ import table_T_S_I_V_
class table_T_S_I_B_(table_T_S_I_V_): class table_T_S_I_B_(table_T_S_I_V_):

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .otBase import BaseTTXConverter from .otBase import BaseTTXConverter

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .T_S_I_V_ import table_T_S_I_V_ from .T_S_I_V_ import table_T_S_I_V_
class table_T_S_I_D_(table_T_S_I_V_): class table_T_S_I_D_(table_T_S_I_V_):

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .T_S_I_V_ import table_T_S_I_V_ from .T_S_I_V_ import table_T_S_I_V_
class table_T_S_I_J_(table_T_S_I_V_): class table_T_S_I_J_(table_T_S_I_V_):

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .T_S_I_V_ import table_T_S_I_V_ from .T_S_I_V_ import table_T_S_I_V_
class table_T_S_I_P_(table_T_S_I_V_): class table_T_S_I_P_(table_T_S_I_V_):

View File

@ -1,4 +1,3 @@
from fontTools.misc.py23 import *
from .T_S_I_V_ import table_T_S_I_V_ from .T_S_I_V_ import table_T_S_I_V_
class table_T_S_I_S_(table_T_S_I_V_): class table_T_S_I_S_(table_T_S_I_V_):

View File

@ -1,4 +1,4 @@
from fontTools.misc.py23 import * from fontTools.misc.py23 import strjoin, tobytes, tostr
from . import asciiTable from . import asciiTable
class table_T_S_I_V_(asciiTable.asciiTable): class table_T_S_I_V_(asciiTable.asciiTable):

View File

@ -5,7 +5,6 @@ TSI0 is the index table containing the lengths and offsets for the glyph
programs and 'extra' programs ('fpgm', 'prep', and 'cvt') that are contained programs and 'extra' programs ('fpgm', 'prep', and 'cvt') that are contained
in the TSI1 table. in the TSI1 table.
""" """
from fontTools.misc.py23 import *
from . import DefaultTable from . import DefaultTable
import struct import struct

Some files were not shown because too many files have changed in this diff Show More