!8 Replace totring with tobytes
Merge pull request !8 from houyingchao/openEuler-22.03-LTS-Next
This commit is contained in:
commit
ed3f35e623
@ -1,11 +1,12 @@
|
||||
Name: fonttools
|
||||
Version: 3.29.0
|
||||
Release: 4
|
||||
Release: 5
|
||||
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
|
||||
Requires: python3-fonttools
|
||||
BuildArch: noarch
|
||||
Provides: ttx = %{version}-%{release}
|
||||
@ -63,6 +64,9 @@ rm -rf *.egg-info
|
||||
%{python3_sitelib}/fonttools-%{version}-py3.?.egg-info
|
||||
|
||||
%changelog
|
||||
* Tue Jan 11 2022 houyingchao <houyingchao@huawei.com> - 3.29.0-5
|
||||
- Replace totring with tobytes
|
||||
|
||||
* Fri Jan 07 2022 houyingchao <houyingchao@huawei.com> - 3.29.0-4
|
||||
- Replace fromtring with frombytes
|
||||
|
||||
|
||||
342
replace-totring-with-tobytes.patch
Normal file
342
replace-totring-with-tobytes.patch
Normal file
@ -0,0 +1,342 @@
|
||||
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