From 2496dcf9cc0e6966379f097307a6ee2b874e44f6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 30 Apr 2021 15:41:25 -0600 Subject: [PATCH] [otConverters] Add array readers to int converters --- Lib/fontTools/ttLib/tables/otConverters.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py index a137f38a9..c443f1aa0 100644 --- a/Lib/fontTools/ttLib/tables/otConverters.py +++ b/Lib/fontTools/ttLib/tables/otConverters.py @@ -230,6 +230,8 @@ class Long(IntValue): staticSize = 4 def read(self, reader, font, tableDict): return reader.readLong() + def readArray(self, reader, font, tableDict, count): + return reader.readLongArray(count) def write(self, writer, font, tableDict, value, repeatIndex=None): writer.writeLong(value) @@ -237,6 +239,8 @@ class ULong(IntValue): staticSize = 4 def read(self, reader, font, tableDict): return reader.readULong() + def readArray(self, reader, font, tableDict, count): + return reader.readULongArray(count) def write(self, writer, font, tableDict, value, repeatIndex=None): writer.writeULong(value) @@ -249,6 +253,8 @@ class Short(IntValue): staticSize = 2 def read(self, reader, font, tableDict): return reader.readShort() + def readArray(self, reader, font, tableDict, count): + return reader.readShortArray(count) def write(self, writer, font, tableDict, value, repeatIndex=None): writer.writeShort(value) @@ -256,6 +262,8 @@ class UShort(IntValue): staticSize = 2 def read(self, reader, font, tableDict): return reader.readUShort() + def readArray(self, reader, font, tableDict, count): + return reader.readUShortArray(count) def write(self, writer, font, tableDict, value, repeatIndex=None): writer.writeUShort(value) @@ -263,6 +271,8 @@ class Int8(IntValue): staticSize = 1 def read(self, reader, font, tableDict): return reader.readInt8() + def readArray(self, reader, font, tableDict, count): + return reader.readInt8Array(count) def write(self, writer, font, tableDict, value, repeatIndex=None): writer.writeInt8(value) @@ -270,6 +280,8 @@ class UInt8(IntValue): staticSize = 1 def read(self, reader, font, tableDict): return reader.readUInt8() + def readArray(self, reader, font, tableDict, count): + return reader.readUInt8Array(count) def write(self, writer, font, tableDict, value, repeatIndex=None): writer.writeUInt8(value)