[glyf] Use memoryview() in decompile for larger glyphs
This commit is contained in:
parent
4ff6b3390e
commit
e328ee0254
@ -689,6 +689,10 @@ class Glyph(object):
|
|||||||
len(data))
|
len(data))
|
||||||
|
|
||||||
def decompileCoordinates(self, data):
|
def decompileCoordinates(self, data):
|
||||||
|
# Slicing small bytes() object is faster than slicing memoryview;
|
||||||
|
# Cutoff empirically determined.
|
||||||
|
if len(data) >= 128:
|
||||||
|
data = memoryview(data)
|
||||||
endPtsOfContours = array.array("h")
|
endPtsOfContours = array.array("h")
|
||||||
endPtsOfContours.frombytes(data[:2*self.numberOfContours])
|
endPtsOfContours.frombytes(data[:2*self.numberOfContours])
|
||||||
if sys.byteorder != "big": endPtsOfContours.byteswap()
|
if sys.byteorder != "big": endPtsOfContours.byteswap()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user