From: handa Date: Tue, 2 Nov 2004 06:10:24 +0000 (+0000) Subject: (read_cmap_table): Support Format 2 of cmap. X-Git-Tag: REL-0-9-5~99 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9ff1add018858921898729fe535bd4fe33a98ca9;p=m17n%2Flibotf.git (read_cmap_table): Support Format 2 of cmap. --- diff --git a/src/otfopen.c b/src/otfopen.c index 60adefe..54091d0 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -518,7 +518,36 @@ read_cmap_table (OTF *otf, OTF_Stream *stream) break; case 2: - OTF_ERROR (OTF_ERROR_TABLE, " (not yet supported)"); + { + OTF_EncodingSubtable2 *sub2; + int j, max_key, remaining_bytes; + + OTF_MALLOC (sub2, 1, " (EncodingSubtable2)"); + cmap->EncodingRecord[i].subtable.f.f2 = sub2; + for (j = 0, max_key = 0; j < 256; j++) + { + READ_USHORT (stream, sub2->subHeaderKeys[j]); + if (max_key < sub2->subHeaderKeys[j]) + max_key = sub2->subHeaderKeys[j]; + } + max_key += 8; + sub2->subHeaderCount = max_key / 8; + OTF_MALLOC (sub2->subHeaders, max_key / 8, " (subHeaders)"); + for (j = 0; j < sub2->subHeaderCount; j++) + { + READ_USHORT (stream, sub2->subHeaders[j].firstCode); + READ_USHORT (stream, sub2->subHeaders[j].entryCount); + READ_SHORT (stream, sub2->subHeaders[j].idDelta); + READ_USHORT (stream, sub2->subHeaders[j].idRangeOffset); + /* Make it offset from sub2->glyphIndexArray. */ + sub2->subHeaders[j].idRangeOffset -= max_key - (j * 8 + 6); + } + sub2->glyphIndexCount = (cmap->EncodingRecord[i].subtable.length + - 262 - max_key); + OTF_MALLOC (sub2->glyphIndexArray, sub2->glyphIndexCount, + " (glyphIndexArray)"); + READ_BYTES (stream, sub2->glyphIndexArray, sub2->glyphIndexCount); + } break; case 4: