From 4603ea0b5632b8dad34a193fd6a98e3d8684fe71 Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 6 Aug 2007 11:13:06 +0000 Subject: [PATCH] (gstring_subst): If otf->cmap is NULL, set character code of a glyph to 0. (OTF_drive_gsub): If otf->cmap is NULL, try to load it. --- src/otfdrive.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/otfdrive.c b/src/otfdrive.c index 44ec9e5..a822704 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -102,7 +102,10 @@ gstring_subst (OTF *otf, OTF_GlyphString *gstring, int from, int to, int flag, GSTRING_DELETE (gstring, from, (len - num)); for (i = 0; i < num; i++) { - gstring->glyphs[from + i].c = otf->cmap->decode_table[ids[i]]; + if (otf->cmap) + gstring->glyphs[from + i].c = otf->cmap->decode_table[ids[i]]; + else + gstring->glyphs[from + i].c = 0; gstring->glyphs[from + i].glyph_id = ids[i]; if (otf->gdef) gstring->glyphs[from + i].GlyphClass @@ -1426,6 +1429,8 @@ int OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring, const char *script, const char *language, const char *features) { + if (! otf->cmap) + OTF_get_table (otf, "cmap"); return OTF_drive_gsub_internal (otf, gstring, script, language, features, 0); } -- 1.7.10.4