update to 4.32.0
This commit is contained in:
parent
87d4bc6e1a
commit
746a3afb21
Binary file not shown.
BIN
fonttools-4.32.0.tar.gz
Normal file
BIN
fonttools-4.32.0.tar.gz
Normal file
Binary file not shown.
@ -1,13 +1,12 @@
|
||||
Name: fonttools
|
||||
Version: 3.29.0
|
||||
Release: 6
|
||||
Version: 4.32.0
|
||||
Release: 1
|
||||
Summary: Tools to manipulate font files
|
||||
License: MIT
|
||||
URL: https://github.com/fonttools/fonttools/
|
||||
Source0: %{url}/releases/download/%{version}/fonttools-%{version}.zip
|
||||
Patch01: replace-fromtring-with-frombytes.patch
|
||||
Patch02: replace-totring-with-tobytes.patch
|
||||
Source0: %{url}/archive/%{version}.tar.gz#/fonttools-%{version}.tar.gz
|
||||
Requires: python3-fonttools
|
||||
Requires: python3-setuptools
|
||||
BuildArch: noarch
|
||||
Provides: ttx = %{version}-%{release}
|
||||
|
||||
@ -21,8 +20,9 @@ project has an MIT open-source licence.
|
||||
%package -n python3-fonttools
|
||||
Summary: Python 3 fonttools library
|
||||
BuildRequires: python3-devel python3-numpy python3-setuptools_scm
|
||||
BuildRequires: python3-setuptools
|
||||
BuildArch: noarch
|
||||
Requires: python3-numpy
|
||||
|
||||
%{?python_provide:%python_provide python3-fonttools}
|
||||
|
||||
%description -n python3-fonttools
|
||||
@ -64,6 +64,9 @@ rm -rf *.egg-info
|
||||
%{python3_sitelib}/fonttools-%{version}-py3.*.egg-info
|
||||
|
||||
%changelog
|
||||
* Sun Apr 24 2022 caodongxia <caodongxia@h-partners.com> - 4.32.0-1
|
||||
- update to 4.32.0
|
||||
|
||||
* Wed Apr 06 2022 houyingchao <houyingchao@h-partners.com> - 3.29.0-6
|
||||
- Replace totring with tobytes
|
||||
- Replace fromtring with frombytes
|
||||
|
||||
@ -1,331 +0,0 @@
|
||||
From 12814aa7b174428ef7c2baf83411b12fef921e0b Mon Sep 17 00:00:00 2001
|
||||
From: Chris Simpkins <git.simpkins@gmail.com>
|
||||
Date: Thu, 29 Aug 2019 22:58:42 -0400
|
||||
Subject: [PATCH] refactor array.fromstring to array.frombytes
|
||||
|
||||
fromstring is a deprecated array method
|
||||
---
|
||||
Lib/fontTools/designspaceLib/__init__.py | 2 +-
|
||||
Lib/fontTools/svgLib/path/__init__.py | 8 ++++----
|
||||
Lib/fontTools/ttLib/tables/G_P_K_G_.py | 4 ++--
|
||||
Lib/fontTools/ttLib/tables/G__l_o_c.py | 4 ++--
|
||||
Lib/fontTools/ttLib/tables/L_T_S_H_.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/T_S_I__5.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/TupleVariation.py | 4 ++--
|
||||
Lib/fontTools/ttLib/tables/_c_m_a_p.py | 10 +++++-----
|
||||
Lib/fontTools/ttLib/tables/_c_v_t.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_g_l_y_f.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_g_v_a_r.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_l_o_c_a.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_p_o_s_t.py | 4 ++--
|
||||
Lib/fontTools/varLib/designspace.py | 2 +-
|
||||
Snippets/svg2glif.py | 2 +-
|
||||
Tests/svgLib/path/path_test.py | 6 +++---
|
||||
16 files changed, 29 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/Lib/fontTools/designspaceLib/__init__.py b/Lib/fontTools/designspaceLib/__init__.py
|
||||
index 8063ac5..72a4cee 100644
|
||||
--- a/Lib/fontTools/designspaceLib/__init__.py
|
||||
+++ b/Lib/fontTools/designspaceLib/__init__.py
|
||||
@@ -38,7 +38,7 @@ def to_plist(value):
|
||||
except AttributeError:
|
||||
# Python 3
|
||||
string = plistlib.dumps(value).decode()
|
||||
- return ET.fromstring(string)[0]
|
||||
+ return ET.frombytes(string)[0]
|
||||
|
||||
|
||||
def from_plist(element):
|
||||
diff --git a/Lib/fontTools/svgLib/path/__init__.py b/Lib/fontTools/svgLib/path/__init__.py
|
||||
index 4f17e76..a18abd9 100644
|
||||
--- a/Lib/fontTools/svgLib/path/__init__.py
|
||||
+++ b/Lib/fontTools/svgLib/path/__init__.py
|
||||
@@ -27,10 +27,10 @@ class SVGPath(object):
|
||||
svg.draw(pen)
|
||||
|
||||
Or reading from a string containing SVG data, using the alternative
|
||||
- 'fromstring' (a class method):
|
||||
+ 'frombytes' (a class method):
|
||||
|
||||
data = '<?xml version="1.0" ...'
|
||||
- svg = SVGPath.fromstring(data)
|
||||
+ svg = SVGPath.frombytes(data)
|
||||
svg.draw(pen)
|
||||
|
||||
Both constructors can optionally take a 'transform' matrix (6-float
|
||||
@@ -46,9 +46,9 @@ class SVGPath(object):
|
||||
self.transform = transform
|
||||
|
||||
@classmethod
|
||||
- def fromstring(cls, data, transform=None):
|
||||
+ def frombytes(cls, data, transform=None):
|
||||
self = cls(transform=transform)
|
||||
- self.root = ElementTree.fromstring(data)
|
||||
+ self.root = ElementTree.frombytes(data)
|
||||
return self
|
||||
|
||||
def draw(self, pen):
|
||||
diff --git a/Lib/fontTools/ttLib/tables/G_P_K_G_.py b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
|
||||
index 4e13830..2849293 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/G_P_K_G_.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
|
||||
@@ -24,7 +24,7 @@ class table_G_P_K_G_(DefaultTable.DefaultTable):
|
||||
|
||||
GMAPoffsets = array.array("I")
|
||||
endPos = (self.numGMAPs+1) * 4
|
||||
- GMAPoffsets.fromstring(newData[:endPos])
|
||||
+ GMAPoffsets.frombytes(newData[:endPos])
|
||||
if sys.byteorder != "big":
|
||||
GMAPoffsets.byteswap()
|
||||
self.GMAPs = []
|
||||
@@ -35,7 +35,7 @@ class table_G_P_K_G_(DefaultTable.DefaultTable):
|
||||
pos = endPos
|
||||
endPos = pos + (self.numGlyplets + 1)*4
|
||||
glyphletOffsets = array.array("I")
|
||||
- glyphletOffsets.fromstring(newData[pos:endPos])
|
||||
+ glyphletOffsets.frombytes(newData[pos:endPos])
|
||||
if sys.byteorder != "big":
|
||||
glyphletOffsets.byteswap()
|
||||
self.glyphlets = []
|
||||
diff --git a/Lib/fontTools/ttLib/tables/G__l_o_c.py b/Lib/fontTools/ttLib/tables/G__l_o_c.py
|
||||
index d77c483..d1d62d1 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/G__l_o_c.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/G__l_o_c.py
|
||||
@@ -29,11 +29,11 @@ class table_G__l_o_c(DefaultTable.DefaultTable):
|
||||
flags = self.flags
|
||||
del self.flags
|
||||
self.locations = array.array('I' if flags & 1 else 'H')
|
||||
- self.locations.fromstring(data[:len(data) - self.numAttribs * (flags & 2)])
|
||||
+ self.locations.frombytes(data[:len(data) - self.numAttribs * (flags & 2)])
|
||||
self.locations.byteswap()
|
||||
self.attribIds = array.array('H')
|
||||
if flags & 2:
|
||||
- self.attribIds.fromstring(data[-self.numAttribs * 2:])
|
||||
+ self.attribIds.frombytes(data[-self.numAttribs * 2:])
|
||||
self.attribIds.byteswap()
|
||||
|
||||
def compile(self, ttFont):
|
||||
diff --git a/Lib/fontTools/ttLib/tables/L_T_S_H_.py b/Lib/fontTools/ttLib/tables/L_T_S_H_.py
|
||||
index dd0f195..6bb1df2 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/L_T_S_H_.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/L_T_S_H_.py
|
||||
@@ -19,7 +19,7 @@ class table_L_T_S_H_(DefaultTable.DefaultTable):
|
||||
# ouch: the assertion is not true in Chicago!
|
||||
#assert numGlyphs == ttFont['maxp'].numGlyphs
|
||||
yPels = array.array("B")
|
||||
- yPels.fromstring(data)
|
||||
+ yPels.frombytes(data)
|
||||
self.yPels = {}
|
||||
for i in range(numGlyphs):
|
||||
self.yPels[ttFont.getGlyphName(i)] = yPels[i]
|
||||
diff --git a/Lib/fontTools/ttLib/tables/T_S_I__5.py b/Lib/fontTools/ttLib/tables/T_S_I__5.py
|
||||
index dbf9e5a..11a2018 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/T_S_I__5.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/T_S_I__5.py
|
||||
@@ -17,7 +17,7 @@ class table_T_S_I__5(DefaultTable.DefaultTable):
|
||||
numGlyphs = ttFont['maxp'].numGlyphs
|
||||
assert len(data) == 2 * numGlyphs
|
||||
a = array.array("H")
|
||||
- a.fromstring(data)
|
||||
+ a.frombytes(data)
|
||||
if sys.byteorder != "big":
|
||||
a.byteswap()
|
||||
self.glyphGrouping = {}
|
||||
diff --git a/Lib/fontTools/ttLib/tables/TupleVariation.py b/Lib/fontTools/ttLib/tables/TupleVariation.py
|
||||
index 5fa71c8..e084dff 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/TupleVariation.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/TupleVariation.py
|
||||
@@ -266,7 +266,7 @@ class TupleVariation(object):
|
||||
else:
|
||||
points = array.array("B")
|
||||
pointsSize = numPointsInRun
|
||||
- points.fromstring(data[pos:pos+pointsSize])
|
||||
+ points.frombytes(data[pos:pos+pointsSize])
|
||||
if sys.byteorder != "big":
|
||||
points.byteswap()
|
||||
|
||||
@@ -424,7 +424,7 @@ class TupleVariation(object):
|
||||
else:
|
||||
deltas = array.array("b")
|
||||
deltasSize = numDeltasInRun
|
||||
- deltas.fromstring(data[pos:pos+deltasSize])
|
||||
+ deltas.frombytes(data[pos:pos+deltasSize])
|
||||
if sys.byteorder != "big":
|
||||
deltas.byteswap()
|
||||
assert len(deltas) == numDeltasInRun
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
|
||||
index eccf69e..1eab2bf 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
|
||||
@@ -254,7 +254,7 @@ class cmap_format_0(CmapSubtable):
|
||||
data = self.data # decompileHeader assigns the data after the header to self.data
|
||||
assert 262 == self.length, "Format 0 cmap subtable not 262 bytes"
|
||||
gids = array.array("B")
|
||||
- gids.fromstring(self.data)
|
||||
+ gids.frombytes(self.data)
|
||||
charCodes = list(range(len(gids)))
|
||||
self.cmap = _make_map(self.ttFont, charCodes, gids)
|
||||
|
||||
@@ -338,7 +338,7 @@ class cmap_format_2(CmapSubtable):
|
||||
maxSubHeaderindex = 0
|
||||
# get the key array, and determine the number of subHeaders.
|
||||
allKeys = array.array("H")
|
||||
- allKeys.fromstring(data[:512])
|
||||
+ allKeys.frombytes(data[:512])
|
||||
data = data[512:]
|
||||
if sys.byteorder != "big":
|
||||
allKeys.byteswap()
|
||||
@@ -355,7 +355,7 @@ class cmap_format_2(CmapSubtable):
|
||||
pos += 8
|
||||
giDataPos = pos + subHeader.idRangeOffset-2
|
||||
giList = array.array("H")
|
||||
- giList.fromstring(data[giDataPos:giDataPos + subHeader.entryCount*2])
|
||||
+ giList.frombytes(data[giDataPos:giDataPos + subHeader.entryCount*2])
|
||||
if sys.byteorder != "big":
|
||||
giList.byteswap()
|
||||
subHeader.glyphIndexArray = giList
|
||||
@@ -699,7 +699,7 @@ class cmap_format_4(CmapSubtable):
|
||||
segCount = segCountX2 // 2
|
||||
|
||||
allCodes = array.array("H")
|
||||
- allCodes.fromstring(data)
|
||||
+ allCodes.frombytes(data)
|
||||
self.data = data = None
|
||||
|
||||
if sys.byteorder != "big":
|
||||
@@ -871,7 +871,7 @@ class cmap_format_6(CmapSubtable):
|
||||
data = data[4:]
|
||||
#assert len(data) == 2 * entryCount # XXX not true in Apple's Helvetica!!!
|
||||
gids = array.array("H")
|
||||
- gids.fromstring(data[:2 * int(entryCount)])
|
||||
+ gids.frombytes(data[:2 * int(entryCount)])
|
||||
if sys.byteorder != "big":
|
||||
gids.byteswap()
|
||||
self.data = data = None
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_c_v_t.py b/Lib/fontTools/ttLib/tables/_c_v_t.py
|
||||
index 4fbee7b..5e42dd0 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_c_v_t.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_c_v_t.py
|
||||
@@ -9,7 +9,7 @@ class table__c_v_t(DefaultTable.DefaultTable):
|
||||
|
||||
def decompile(self, data, ttFont):
|
||||
values = array.array("h")
|
||||
- values.fromstring(data)
|
||||
+ values.frombytes(data)
|
||||
if sys.byteorder != "big":
|
||||
values.byteswap()
|
||||
self.values = values
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
|
||||
index 58c1eb2..3598b15 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
|
||||
@@ -511,7 +511,7 @@ class Glyph(object):
|
||||
|
||||
def decompileCoordinates(self, data):
|
||||
endPtsOfContours = array.array("h")
|
||||
- endPtsOfContours.fromstring(data[:2*self.numberOfContours])
|
||||
+ endPtsOfContours.frombytes(data[:2*self.numberOfContours])
|
||||
if sys.byteorder != "big":
|
||||
endPtsOfContours.byteswap()
|
||||
self.endPtsOfContours = endPtsOfContours.tolist()
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_g_v_a_r.py b/Lib/fontTools/ttLib/tables/_g_v_a_r.py
|
||||
index 9f97c31..0d5f79a 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_g_v_a_r.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_g_v_a_r.py
|
||||
@@ -120,7 +120,7 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
|
||||
# Long format: array of UInt32
|
||||
offsets = array.array("I")
|
||||
offsetsSize = (glyphCount + 1) * 4
|
||||
- offsets.fromstring(data[0 : offsetsSize])
|
||||
+ offsets.frombytes(data[0 : offsetsSize])
|
||||
if sys.byteorder != "big":
|
||||
offsets.byteswap()
|
||||
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_l_o_c_a.py b/Lib/fontTools/ttLib/tables/_l_o_c_a.py
|
||||
index 2fcd528..e4bafa1 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_l_o_c_a.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_l_o_c_a.py
|
||||
@@ -20,7 +20,7 @@ class table__l_o_c_a(DefaultTable.DefaultTable):
|
||||
else:
|
||||
format = "H"
|
||||
locations = array.array(format)
|
||||
- locations.fromstring(data)
|
||||
+ locations.frombytes(data)
|
||||
if sys.byteorder != "big":
|
||||
locations.byteswap()
|
||||
if not longFormat:
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
|
||||
index ede62da..3399cad 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
|
||||
@@ -83,7 +83,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
numGlyphs = ttFont['maxp'].numGlyphs
|
||||
data = data[2:]
|
||||
indices = array.array("H")
|
||||
- indices.fromstring(data[:2*numGlyphs])
|
||||
+ indices.frombytes(data[:2*numGlyphs])
|
||||
if sys.byteorder != "big":
|
||||
indices.byteswap()
|
||||
data = data[2*numGlyphs:]
|
||||
@@ -133,7 +133,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
from fontTools import agl
|
||||
numGlyphs = ttFont['maxp'].numGlyphs
|
||||
indices = array.array("H")
|
||||
- indices.fromstring(data)
|
||||
+ indices.frombytes(data)
|
||||
if sys.byteorder != "big":
|
||||
indices.byteswap()
|
||||
# In some older fonts, the size of the post table doesn't match
|
||||
diff --git a/Lib/fontTools/varLib/designspace.py b/Lib/fontTools/varLib/designspace.py
|
||||
index 7f235af..64fd7a4 100644
|
||||
--- a/Lib/fontTools/varLib/designspace.py
|
||||
+++ b/Lib/fontTools/varLib/designspace.py
|
||||
@@ -104,7 +104,7 @@ def load(filename):
|
||||
|
||||
def loads(string):
|
||||
"""Load designspace from a string."""
|
||||
- return _load(ET.fromstring(string))
|
||||
+ return _load(ET.frombytes(string))
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
diff --git a/Snippets/svg2glif.py b/Snippets/svg2glif.py
|
||||
index 2dd6402..a6e4e58 100755
|
||||
--- a/Snippets/svg2glif.py
|
||||
+++ b/Snippets/svg2glif.py
|
||||
@@ -24,7 +24,7 @@ def svg2glif(svg, name, width=0, height=0, unicodes=None, transform=None,
|
||||
conversion (must be tuple of 6 floats, or a FontTools Transform object).
|
||||
"""
|
||||
glyph = SimpleNamespace(width=width, height=height, unicodes=unicodes)
|
||||
- outline = SVGPath.fromstring(svg, transform=transform)
|
||||
+ outline = SVGPath.frombytes(svg, transform=transform)
|
||||
|
||||
# writeGlyphToString takes a callable (usually a glyph's drawPoints
|
||||
# method) that accepts a PointPen, however SVGPath currently only has
|
||||
diff --git a/Tests/svgLib/path/path_test.py b/Tests/svgLib/path/path_test.py
|
||||
index 09b9447..4bdc844 100644
|
||||
--- a/Tests/svgLib/path/path_test.py
|
||||
+++ b/Tests/svgLib/path/path_test.py
|
||||
@@ -50,16 +50,16 @@ class SVGPathTest(object):
|
||||
|
||||
assert pen.value == EXPECTED_PEN_COMMANDS
|
||||
|
||||
- def test_fromstring(self):
|
||||
+ def test_frombytes(self):
|
||||
pen = RecordingPen()
|
||||
- svg = SVGPath.fromstring(SVG_DATA)
|
||||
+ svg = SVGPath.frombytes(SVG_DATA)
|
||||
svg.draw(pen)
|
||||
|
||||
assert pen.value == EXPECTED_PEN_COMMANDS
|
||||
|
||||
def test_transform(self):
|
||||
pen = RecordingPen()
|
||||
- svg = SVGPath.fromstring(SVG_DATA,
|
||||
+ svg = SVGPath.frombytes(SVG_DATA,
|
||||
transform=(1.0, 0, 0, -1.0, 0, 1000))
|
||||
svg.draw(pen)
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -1,342 +0,0 @@
|
||||
From 791f619029931e9e80a8286f74cd14da3a142f98 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Simpkins <git.simpkins@gmail.com>
|
||||
Date: Thu, 29 Aug 2019 23:21:22 -0400
|
||||
Subject: [PATCH] refactor array.tostring to array.tobytes
|
||||
|
||||
the array.tostring method is deprecated
|
||||
---
|
||||
Lib/fontTools/designspaceLib/__init__.py | 2 +-
|
||||
Lib/fontTools/subset/__init__.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/G_P_K_G_.py | 4 ++--
|
||||
Lib/fontTools/ttLib/tables/G__l_o_c.py | 4 ++--
|
||||
Lib/fontTools/ttLib/tables/L_T_S_H_.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/S_V_G_.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/S__i_l_f.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/T_S_I__5.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_c_m_a_p.py | 6 +++---
|
||||
Lib/fontTools/ttLib/tables/_c_v_t.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_g_l_y_f.py | 12 ++++++------
|
||||
Lib/fontTools/ttLib/tables/_g_v_a_r.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_h_m_t_x.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_l_o_c_a.py | 2 +-
|
||||
Lib/fontTools/ttLib/tables/_p_o_s_t.py | 4 ++--
|
||||
Lib/fontTools/ttLib/tables/ttProgram.py | 2 +-
|
||||
Lib/fontTools/ttLib/woff2.py | 8 ++++----
|
||||
17 files changed, 30 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/Lib/fontTools/designspaceLib/__init__.py b/Lib/fontTools/designspaceLib/__init__.py
|
||||
index 72a4cee..3061691 100644
|
||||
--- a/Lib/fontTools/designspaceLib/__init__.py
|
||||
+++ b/Lib/fontTools/designspaceLib/__init__.py
|
||||
@@ -46,7 +46,7 @@ def from_plist(element):
|
||||
return {}
|
||||
plist = ET.Element('plist')
|
||||
plist.append(element)
|
||||
- string = ET.tostring(plist)
|
||||
+ string = ET.tobytes(plist)
|
||||
try:
|
||||
# Python 2
|
||||
return plistlib.readPlistFromString(string)
|
||||
diff --git a/Lib/fontTools/subset/__init__.py b/Lib/fontTools/subset/__init__.py
|
||||
index 53d1dc3..21d43d5 100644
|
||||
--- a/Lib/fontTools/subset/__init__.py
|
||||
+++ b/Lib/fontTools/subset/__init__.py
|
||||
@@ -2020,7 +2020,7 @@ def remapComponentsFast(self, indices):
|
||||
elif flags & 0x0080: i += 8 # WE_HAVE_A_TWO_BY_TWO
|
||||
more = flags & 0x0020 # MORE_COMPONENTS
|
||||
|
||||
- self.data = data.tostring()
|
||||
+ self.data = data.tobyteswq()
|
||||
|
||||
@_add_method(ttLib.getTableClass('glyf'))
|
||||
def closure_glyphs(self, s):
|
||||
diff --git a/Lib/fontTools/ttLib/tables/G_P_K_G_.py b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
|
||||
index 2849293..02c429c 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/G_P_K_G_.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
|
||||
@@ -60,7 +60,7 @@ class table_G_P_K_G_(DefaultTable.DefaultTable):
|
||||
gmapArray = array.array("I", GMAPoffsets)
|
||||
if sys.byteorder != "big":
|
||||
gmapArray.byteswap()
|
||||
- dataList.append(gmapArray.tostring())
|
||||
+ dataList.append(gmapArray.tobytes())
|
||||
|
||||
glyphletOffsets[0] = pos
|
||||
for i in range(1, self.numGlyplets +1):
|
||||
@@ -69,7 +69,7 @@ class table_G_P_K_G_(DefaultTable.DefaultTable):
|
||||
glyphletArray = array.array("I", glyphletOffsets)
|
||||
if sys.byteorder != "big":
|
||||
glyphletArray.byteswap()
|
||||
- dataList.append(glyphletArray.tostring())
|
||||
+ dataList.append(glyphletArray.tobytes())
|
||||
dataList += self.GMAPs
|
||||
dataList += self.glyphlets
|
||||
data = bytesjoin(dataList)
|
||||
diff --git a/Lib/fontTools/ttLib/tables/G__l_o_c.py b/Lib/fontTools/ttLib/tables/G__l_o_c.py
|
||||
index d1d62d1..27ef623 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/G__l_o_c.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/G__l_o_c.py
|
||||
@@ -41,11 +41,11 @@ class table_G__l_o_c(DefaultTable.DefaultTable):
|
||||
flags=(bool(self.attribIds) << 1) + (self.locations.typecode == 'I'),
|
||||
numAttribs=self.numAttribs))
|
||||
self.locations.byteswap()
|
||||
- data += self.locations.tostring()
|
||||
+ data += self.locations.tobytes()
|
||||
self.locations.byteswap()
|
||||
if self.attribIds:
|
||||
self.attribIds.byteswap()
|
||||
- data += self.attribIds.tostring()
|
||||
+ data += self.attribIds.tobytes()
|
||||
self.attribIds.byteswap()
|
||||
return data
|
||||
|
||||
diff --git a/Lib/fontTools/ttLib/tables/L_T_S_H_.py b/Lib/fontTools/ttLib/tables/L_T_S_H_.py
|
||||
index 6bb1df2..b7d23bf 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/L_T_S_H_.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/L_T_S_H_.py
|
||||
@@ -34,7 +34,7 @@ class table_L_T_S_H_(DefaultTable.DefaultTable):
|
||||
for name in names:
|
||||
yPels[ttFont.getGlyphID(name)] = self.yPels[name]
|
||||
yPels = array.array("B", yPels)
|
||||
- return struct.pack(">HH", version, numGlyphs) + yPels.tostring()
|
||||
+ return struct.pack(">HH", version, numGlyphs) + yPels.tobytes()
|
||||
|
||||
def toXML(self, writer, ttFont):
|
||||
names = sorted(self.yPels.keys())
|
||||
diff --git a/Lib/fontTools/ttLib/tables/S_V_G_.py b/Lib/fontTools/ttLib/tables/S_V_G_.py
|
||||
index b061153..a27153f 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/S_V_G_.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/S_V_G_.py
|
||||
@@ -60,7 +60,7 @@ the number of <colorParamUINameID> elements.
|
||||
|
||||
XML = ET.XML
|
||||
XMLElement = ET.Element
|
||||
-xmlToString = ET.tostring
|
||||
+xmlToString = ET.tobytes
|
||||
|
||||
SVG_format_0 = """
|
||||
> # big endian
|
||||
diff --git a/Lib/fontTools/ttLib/tables/S__i_l_f.py b/Lib/fontTools/ttLib/tables/S__i_l_f.py
|
||||
index 2afd71e..067cd15 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/S__i_l_f.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/S__i_l_f.py
|
||||
@@ -739,7 +739,7 @@ class Pass(object):
|
||||
transes = []
|
||||
for t in self.stateTrans:
|
||||
t.byteswap()
|
||||
- transes.append(t.tostring())
|
||||
+ transes.append(t.tobytes())
|
||||
t.byteswap()
|
||||
if not len(transes):
|
||||
self.startStates = [0]
|
||||
diff --git a/Lib/fontTools/ttLib/tables/T_S_I__5.py b/Lib/fontTools/ttLib/tables/T_S_I__5.py
|
||||
index 11a2018..7b19607 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/T_S_I__5.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/T_S_I__5.py
|
||||
@@ -31,7 +31,7 @@ class table_T_S_I__5(DefaultTable.DefaultTable):
|
||||
a.append(self.glyphGrouping.get(glyphNames[i], 0))
|
||||
if sys.byteorder != "big":
|
||||
a.byteswap()
|
||||
- return a.tostring()
|
||||
+ return a.tobytes()
|
||||
|
||||
def toXML(self, writer, ttFont):
|
||||
names = sorted(self.glyphGrouping.keys())
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
|
||||
index 1eab2bf..cd14565 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
|
||||
@@ -268,7 +268,7 @@ class cmap_format_0(CmapSubtable):
|
||||
valueList = [getGlyphID(cmap[i]) if i in cmap else 0 for i in range(256)]
|
||||
|
||||
gids = array.array("B", valueList)
|
||||
- data = struct.pack(">HHH", 0, 262, self.language) + gids.tostring()
|
||||
+ data = struct.pack(">HHH", 0, 262, self.language) + gids.tobytes()
|
||||
assert len(data) == 262
|
||||
return data
|
||||
|
||||
@@ -833,7 +833,7 @@ class cmap_format_4(CmapSubtable):
|
||||
charCodeArray.byteswap()
|
||||
idDeltaArray.byteswap()
|
||||
restArray.byteswap()
|
||||
- data = charCodeArray.tostring() + idDeltaArray.tostring() + restArray.tostring()
|
||||
+ data = charCodeArray.tobytes() + idDeltaArray.tobytes() + restArray.tobytes()
|
||||
|
||||
length = struct.calcsize(cmap_format_4_format) + len(data)
|
||||
header = struct.pack(cmap_format_4_format, self.format, length, self.language,
|
||||
@@ -894,7 +894,7 @@ class cmap_format_6(CmapSubtable):
|
||||
gids = array.array("H", valueList)
|
||||
if sys.byteorder != "big":
|
||||
gids.byteswap()
|
||||
- data = gids.tostring()
|
||||
+ data = gids.tobytes()
|
||||
else:
|
||||
data = b""
|
||||
firstCode = 0
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_c_v_t.py b/Lib/fontTools/ttLib/tables/_c_v_t.py
|
||||
index 5e42dd0..9c1563a 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_c_v_t.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_c_v_t.py
|
||||
@@ -18,7 +18,7 @@ class table__c_v_t(DefaultTable.DefaultTable):
|
||||
values = self.values[:]
|
||||
if sys.byteorder != "big":
|
||||
values.byteswap()
|
||||
- return values.tostring()
|
||||
+ return values.tobytes()
|
||||
|
||||
def toXML(self, writer, ttFont):
|
||||
for i in range(len(self.values)):
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
|
||||
index 3598b15..f189eee 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
|
||||
@@ -627,7 +627,7 @@ class Glyph(object):
|
||||
endPtsOfContours = array.array("h", self.endPtsOfContours)
|
||||
if sys.byteorder != "big":
|
||||
endPtsOfContours.byteswap()
|
||||
- data.append(endPtsOfContours.tostring())
|
||||
+ data.append(endPtsOfContours.tobytes())
|
||||
instructions = self.program.getBytecode()
|
||||
data.append(struct.pack(">h", len(instructions)))
|
||||
data.append(instructions)
|
||||
@@ -691,7 +691,7 @@ class Glyph(object):
|
||||
repeat = 0
|
||||
compressedflags.append(flag)
|
||||
lastflag = flag
|
||||
- compressedFlags = array.array("B", compressedflags).tostring()
|
||||
+ compressedFlags = array.array("B", compressedflags).tobytes()
|
||||
compressedXs = bytesjoin(xPoints)
|
||||
compressedYs = bytesjoin(yPoints)
|
||||
return (compressedFlags, compressedXs, compressedYs)
|
||||
@@ -746,9 +746,9 @@ class Glyph(object):
|
||||
raise Exception("internal error")
|
||||
except StopIteration:
|
||||
pass
|
||||
- compressedFlags = compressedFlags.tostring()
|
||||
- compressedXs = compressedXs.tostring()
|
||||
- compressedYs = compressedYs.tostring()
|
||||
+ compressedFlags = compressedFlags.tobytes()
|
||||
+ compressedXs = compressedXs.tobytes()
|
||||
+ compressedYs = compressedYs.tobytes()
|
||||
|
||||
return (compressedFlags, compressedXs, compressedYs)
|
||||
|
||||
@@ -981,7 +981,7 @@ class Glyph(object):
|
||||
# Remove padding
|
||||
data = data[:i]
|
||||
|
||||
- self.data = data.tostring()
|
||||
+ self.data = data.tobytes()
|
||||
|
||||
def removeHinting(self):
|
||||
self.trim (remove_hinting=True)
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_g_v_a_r.py b/Lib/fontTools/ttLib/tables/_g_v_a_r.py
|
||||
index 0d5f79a..02ddf20 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_g_v_a_r.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_g_v_a_r.py
|
||||
@@ -154,7 +154,7 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
|
||||
tableFormat = 1
|
||||
if sys.byteorder != "big":
|
||||
packed.byteswap()
|
||||
- return (packed.tostring(), tableFormat)
|
||||
+ return (packed.tobytes(), tableFormat)
|
||||
|
||||
def toXML(self, writer, ttFont):
|
||||
writer.simpletag("version", value=self.version)
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_h_m_t_x.py b/Lib/fontTools/ttLib/tables/_h_m_t_x.py
|
||||
index e6b8ea9..5a02150 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_h_m_t_x.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_h_m_t_x.py
|
||||
@@ -100,7 +100,7 @@ class table__h_m_t_x(DefaultTable.DefaultTable):
|
||||
additionalMetrics = array.array("h", additionalMetrics)
|
||||
if sys.byteorder != "big":
|
||||
additionalMetrics.byteswap()
|
||||
- data = data + additionalMetrics.tostring()
|
||||
+ data = data + additionalMetrics.tobytes()
|
||||
return data
|
||||
|
||||
def toXML(self, writer, ttFont):
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_l_o_c_a.py b/Lib/fontTools/ttLib/tables/_l_o_c_a.py
|
||||
index e4bafa1..da8cbb5 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_l_o_c_a.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_l_o_c_a.py
|
||||
@@ -49,7 +49,7 @@ class table__l_o_c_a(DefaultTable.DefaultTable):
|
||||
ttFont['head'].indexToLocFormat = 1
|
||||
if sys.byteorder != "big":
|
||||
locations.byteswap()
|
||||
- return locations.tostring()
|
||||
+ return locations.tobytes()
|
||||
|
||||
def set(self, locations):
|
||||
self.locations = array.array("I", locations)
|
||||
diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
|
||||
index 3399cad..98eaac7 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
|
||||
@@ -175,7 +175,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
indices.append(index)
|
||||
if sys.byteorder != "big":
|
||||
indices.byteswap()
|
||||
- return struct.pack(">H", numGlyphs) + indices.tostring() + packPStrings(extraNames)
|
||||
+ return struct.pack(">H", numGlyphs) + indices.tobytes() + packPStrings(extraNames)
|
||||
|
||||
def encode_format_4_0(self, ttFont):
|
||||
from fontTools import agl
|
||||
@@ -193,7 +193,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
indices.append(0xFFFF)
|
||||
if sys.byteorder != "big":
|
||||
indices.byteswap()
|
||||
- return indices.tostring()
|
||||
+ return indices.tobytes()
|
||||
|
||||
def toXML(self, writer, ttFont):
|
||||
formatstring, names, fixes = sstruct.getformat(postFormat)
|
||||
diff --git a/Lib/fontTools/ttLib/tables/ttProgram.py b/Lib/fontTools/ttLib/tables/ttProgram.py
|
||||
index 182982f..e13e942 100644
|
||||
--- a/Lib/fontTools/ttLib/tables/ttProgram.py
|
||||
+++ b/Lib/fontTools/ttLib/tables/ttProgram.py
|
||||
@@ -222,7 +222,7 @@ class Program(object):
|
||||
def getBytecode(self):
|
||||
if not hasattr(self, "bytecode"):
|
||||
self._assemble()
|
||||
- return self.bytecode.tostring()
|
||||
+ return self.bytecode.tobytes()
|
||||
|
||||
def getAssembly(self, preserve=True):
|
||||
if not hasattr(self, "assembly"):
|
||||
diff --git a/Lib/fontTools/ttLib/woff2.py b/Lib/fontTools/ttLib/woff2.py
|
||||
index 1952682..d73009b 100644
|
||||
--- a/Lib/fontTools/ttLib/woff2.py
|
||||
+++ b/Lib/fontTools/ttLib/woff2.py
|
||||
@@ -584,7 +584,7 @@ class WOFF2LocaTable(getTableClass('loca')):
|
||||
locations = array.array("I", self.locations)
|
||||
if sys.byteorder != "big":
|
||||
locations.byteswap()
|
||||
- data = locations.tostring()
|
||||
+ data = locations.tobytes()
|
||||
else:
|
||||
# use the most compact indexFormat given the current glyph offsets
|
||||
data = super(WOFF2LocaTable, self).compile(ttFont)
|
||||
@@ -679,7 +679,7 @@ class WOFF2GlyfTable(getTableClass('glyf')):
|
||||
for glyphID in range(self.numGlyphs):
|
||||
self._encodeGlyph(glyphID)
|
||||
|
||||
- self.bboxStream = self.bboxBitmap.tostring() + self.bboxStream
|
||||
+ self.bboxStream = self.bboxBitmap.tobytes() + self.bboxStream
|
||||
for stream in self.subStreams:
|
||||
setattr(self, stream + 'Size', len(getattr(self, stream)))
|
||||
self.version = 0
|
||||
@@ -907,8 +907,8 @@ class WOFF2GlyfTable(getTableClass('glyf')):
|
||||
triplets.append(absY >> 8)
|
||||
triplets.append(absY & 0xff)
|
||||
|
||||
- self.flagStream += flags.tostring()
|
||||
- self.glyphStream += triplets.tostring()
|
||||
+ self.flagStream += flags.tobytes()
|
||||
+ self.glyphStream += triplets.tobytes()
|
||||
|
||||
|
||||
class WOFF2FlavorData(WOFFFlavorData):
|
||||
--
|
||||
2.23.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user