From: handa Date: Mon, 22 Dec 2008 05:52:33 +0000 (+0000) Subject: (read_cmap_uvs_table): New function. X-Git-Tag: REL-0-9-9~36 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6b3661ff2a321aab840ac4dc4d920781c01fd8a6;p=m17n%2Flibotf.git (read_cmap_uvs_table): New function. (read_cmap_table): Handle format 14 (Unicode Variation Sequences). Not yet completed. --- diff --git a/src/otfopen.c b/src/otfopen.c index 2a7f989..443b822 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -495,6 +495,21 @@ read_name_table (OTF *otf, OTF_TableInfo *table, enum OTF_ReaderFlag flag) /*** (1-4) "cmap" table */ +static OTF_EncodingSubtable14 * +read_cmap_uvs_table (OTF *otf, OTF_Stream *stream, int nbytes) +{ + OTF_EncodingSubtable14 *sub14; + char *errfmt = "cmap-uvs%s"; + void *errret = NULL; + int i; + + OTF_MALLOC (sub14, 1, " (EncodingSubtable14)"); + sub14->nbytes = nbytes; + OTF_MALLOC (sub14->data, nbytes, " (EncodingSubtable14-Data)"); + READ_BYTES (stream, sub14->data, nbytes); + return sub14; +} + static void * read_cmap_table (OTF *otf, OTF_TableInfo *table, enum OTF_ReaderFlag flag) { @@ -540,15 +555,23 @@ read_cmap_table (OTF *otf, OTF_TableInfo *table, enum OTF_ReaderFlag flag) SEEK_STREAM (stream, cmap->EncodingRecord[i].offset); READ_USHORT (stream, format); cmap->EncodingRecord[i].subtable.format = format; - READ_USHORT (stream, cmap->EncodingRecord[i].subtable.length); - if (format == 8 || format == 10 || format == 12) + if (format == 14) { - READ_ULONG (stream, cmap->EncodingRecord[i].subtable.length); - READ_ULONG (stream, cmap->EncodingRecord[i].subtable.language); + READ_ULONG (stream, cmap->EncodingRecord[i].subtable.length); + cmap->EncodingRecord[i].subtable.language = 0; } else { - READ_USHORT (stream, cmap->EncodingRecord[i].subtable.language); + READ_USHORT (stream, cmap->EncodingRecord[i].subtable.length); + if (format == 8 || format == 10 || format == 12) + { + READ_ULONG (stream, cmap->EncodingRecord[i].subtable.length); + READ_ULONG (stream, cmap->EncodingRecord[i].subtable.language); + } + else + { + READ_USHORT (stream, cmap->EncodingRecord[i].subtable.language); + } } switch (format) { @@ -705,6 +728,15 @@ read_cmap_table (OTF *otf, OTF_TableInfo *table, enum OTF_ReaderFlag flag) } break; + case 14: + { + cmap->EncodingRecord[i].subtable.f.f14 + = read_cmap_uvs_table (otf, stream, + cmap->EncodingRecord[i].subtable.length + - 6); + break; + } + default: OTF_ERROR (OTF_ERROR_TABLE, " (invalid Subtable format)"); }