From e7c6079af8cb566c908e4a5d2ddf57e58c62116a Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 22 Dec 2008 05:53:15 +0000 Subject: [PATCH] (check_cmap_uvs): New function. Not yet completed. (UVS_P): New macro. (OTF_drive_cmap): Check UVS (Unicode Variation Sequences). --- src/otfdrive.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/otfdrive.c b/src/otfdrive.c index a32f6a4..7d0824d 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -1336,10 +1336,31 @@ lookup_encoding_12 (OTF_EncodingSubtable12 *sub12, OTF_GlyphString *gstring) return 0; } +static void +check_cmap_uvs (OTF_cmap *cmap, OTF_GlyphString *gstring, int idx) +{ + OTF_EncodingSubtable14 *sub14; + int c1 = gstring->glyphs[idx - 1].c; + int c2 = gstring->glyphs[idx].c; + int i; + + gstring->glyphs[idx].glyph_id = 0; + for (i = 0; i < cmap->numTables; i++) + if (cmap->EncodingRecord[i].subtable.format == 14) + break; + if (i == cmap->numTables) + return; + sub14 = cmap->EncodingRecord[i].subtable.f.f14; + /* */ +} + /* API */ +#define UVS_P(C) \ + (((C) >= 0xFE00 && (C) <= 0xFE0F) || ((C) >= 0xE0100 && (C) <= 0xE01EF)) + int OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring) { @@ -1357,6 +1378,8 @@ OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring) int c = gstring->glyphs[i].c; if (c < 32 || ! cmap->unicode_table) gstring->glyphs[i].glyph_id = 0; + else if (UVS_P (c) && i > 0) + check_cmap_uvs (cmap, gstring, i); else gstring->glyphs[i].glyph_id = cmap->unicode_table[c]; } -- 1.7.10.4