From 512e49e6e7857edf28df0c531a05abfe51904cad Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Tue, 27 Apr 2021 00:37:18 -0500 Subject: [PATCH] only return kern if we parsed it --- src/pixie/fontformats/opentype.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pixie/fontformats/opentype.nim b/src/pixie/fontformats/opentype.nim index 3168dfe..cc058ae 100644 --- a/src/pixie/fontformats/opentype.nim +++ b/src/pixie/fontformats/opentype.nim @@ -525,12 +525,14 @@ proc parseKernTable(buf: string, offset: int): KernTable = buf.eofCheck(i + 2) - result = KernTable() - result.version = buf.readUint16(i + 0).swap() + let version = buf.readUint16(i + 0).swap() i += 2 - if result.version == 0: + if version == 0: buf.eofCheck(i + 2) + + result = KernTable() + result.version = version result.nTables = buf.readUint16(i + 0).swap() i += 2