From b5b7eaa9825fa33e18892491b5865820a5770df1 Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Sat, 14 Aug 2021 00:15:28 +0900 Subject: [PATCH] Fix parsing cmap subtable format 14 --- src/ttf/table/cmap/parse.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ttf/table/cmap/parse.js b/src/ttf/table/cmap/parse.js index 5a0f513..921cdea 100644 --- a/src/ttf/table/cmap/parse.js +++ b/src/ttf/table/cmap/parse.js @@ -180,10 +180,12 @@ function readSubTable(reader, ttf, subTable, cmapOffset) { format14.length = reader.readUint32(); const numVarSelectorRecords = reader.readUint32(); const groups = []; + let offset = reader.offset; for (let i = 0; i < numVarSelectorRecords; i++) { - const varSelector = reader.readUint24(); - const defaultUVSOffset = reader.readUint32(); - const nonDefaultUVSOffset = reader.readUint32(); + const varSelector = reader.readUint24(offset); + const defaultUVSOffset = reader.readUint32(offset + 3); + const nonDefaultUVSOffset = reader.readUint32(offset + 7); + offset += 11; if (defaultUVSOffset) { const numUnicodeValueRanges = reader.readUint32(startOffset + defaultUVSOffset);