From 907d965e41a43d4bbd871b96c4d0c398ebe4ae58 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 16 Oct 2003 13:25:54 +0000 Subject: [PATCH] *** empty log message *** --- src/otf.h | 17 +++++++++++------ src/otfdrive.c | 17 ++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/otf.h b/src/otf.h index c3a307a..6a65160 100644 --- a/src/otf.h +++ b/src/otf.h @@ -219,8 +219,10 @@ typedef struct unsigned version; unsigned numTables; OTF_EncodingRecord *EncodingRecord; + /* Mapping table: Unicode->GlyphID */ unsigned short *unicode_table; int max_glyph_id; + /* Mapping table: GlyphID->Unicode */ unsigned short *decode_table; } OTF_cmap; @@ -1099,13 +1101,16 @@ extern int OTF_check_table (OTF *otf, char *name); typedef struct { - /* Character code of the glyph. This is the only member that a - client has to set before calling the function OTF_drive_XXX(). - The value less than 32 is treated as a place-holder character, - and OTF_drive_XXX () function just ignore the glyph. */ + /** The first two members must be set by a clinet before calling the + function OTF_drive_XXX(). **/ + + /* Character code of the glyph. The value less than 32 is treated + as a place-holder in a glyph string, and OTF_drive_XXX () + function just ignore the glyph as if it doesn't exist. */ int c; - /* Glyph ID of the glyph. */ + /* Glyph ID of the glyph. If the value is 0, the library gets a + correct value from the above character code via cmap. */ OTF_GlyphID glyph_id; /* GlyphClass of the glyph. The value is extracted from the GDEF @@ -1175,7 +1180,7 @@ typedef struct The OTF_drive_cmap() function looks up the cmap table of OpenType font $OTF, and setup the member of all glhphs in the - glyph string $GSTRING. */ + glyph string $GSTRING if the value of the member is not zero. */ extern int OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring); diff --git a/src/otfdrive.c b/src/otfdrive.c index 84f2f5f..ffc9926 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -941,15 +941,14 @@ OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring) cmap = otf->cmap; for (i = 0; i < gstring->used; i++) - { - int c = gstring->glyphs[i].c; - if (c < 32 || ! cmap->unicode_table) - gstring->glyphs[i].glyph_id = 0; - else - gstring->glyphs[i].glyph_id = cmap->unicode_table[c]; - if (gstring->glyphs[i].glyph_id < 0) - return -1; - } + if (! gstring->glyphs[i].glyph_id) + { + int c = gstring->glyphs[i].c; + if (c < 32 || ! cmap->unicode_table) + gstring->glyphs[i].glyph_id = 0; + else + gstring->glyphs[i].glyph_id = cmap->unicode_table[c]; + } return 0; } -- 1.7.10.4