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;
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
The OTF_drive_cmap() function looks up the cmap table of OpenType
font $OTF, and setup the member <glyhph_id> 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);
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;
}