diff options
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/cff.c | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/tt_cmap.c | 23 |
3 files changed, 22 insertions, 12 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index e0e5efbea02..f8c5c931ec5 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,12 @@ +2014-08-04 Jiang Jiang <gzjjgod@gmail.com> + + * cff.c (cff_get_glyphname): Remove duplicated cff_read_charsets() + call. + + * tt_cmap.c (sfnt_get_glyphname, create_ToUnicode_cmap): Make sure + we only do glyph name lookup for CFF fonts when they are not CID + fonts. + 2014-08-03 Jiang Jiang <gzjjgod@gmail.com> * tt_cmap.c (sfnt_get_glyphname, handle_subst_glyphs): Fix error on diff --git a/Build/source/texk/dvipdfm-x/cff.c b/Build/source/texk/dvipdfm-x/cff.c index f122044b921..f8d778165b2 100644 --- a/Build/source/texk/dvipdfm-x/cff.c +++ b/Build/source/texk/dvipdfm-x/cff.c @@ -982,8 +982,6 @@ char* cff_get_glyphname (cff_font *cff, card16 gid) { s_SID sid; - cff_read_charsets(cff); - sid = cff_charsets_lookup_inverse(cff, gid); return cff_get_string(cff, sid); } diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c index d1dc49c797c..21b37eb5f31 100644 --- a/Build/source/texk/dvipdfm-x/tt_cmap.c +++ b/Build/source/texk/dvipdfm-x/tt_cmap.c @@ -848,7 +848,7 @@ sfnt_get_glyphname(struct tt_post_table *post, cff_font *cffont, USHORT gid) if (post) name = tt_get_glyphname(post, gid); - if (!name && cffont && gid - 1 < cffont->charsets->num_entries) + if (!name && cffont) name = cff_get_glyphname(cffont, gid); return name; @@ -975,11 +975,6 @@ prepare_CIDFont_from_sfnt(sfnt* sfont) if (!cffont) return NULL; - if (!(cffont->flag & FONTTYPE_CIDFONT)) { - cff_close(cffont); - return NULL; - } - cff_read_charsets(cffont); return cffont; } @@ -1101,6 +1096,7 @@ create_ToUnicode_cmap (tt_cmap *ttcmap, USHORT i, gid, ch, count = 0; char used_glyphs_copy[8192]; cff_font *cffont = prepare_CIDFont_from_sfnt(sfont); + char is_cidfont = (cffont->flag & FONTTYPE_CIDFONT); cmap = CMap_new(); CMap_set_name (cmap, cmap_name); @@ -1109,7 +1105,7 @@ create_ToUnicode_cmap (tt_cmap *ttcmap, CMap_set_CIDSysInfo(cmap, &CSI_UNICODE); CMap_add_codespacerange(cmap, srange_min, srange_max, 2); - if (cmap_loaded && cffont) { + if (cmap_loaded && cffont && is_cidfont) { for (i = 0; i < 8192; i++) { int j; long len, inbytesleft, outbytesleft; @@ -1142,16 +1138,23 @@ create_ToUnicode_cmap (tt_cmap *ttcmap, } else { memcpy(used_glyphs_copy, used_glyphs, 8192); + /* For create_ToUnicode_cmap{4,12}(), cffont is for GID -> CID lookup, + * so it is only needed for CID fonts. */ switch (ttcmap->format) { case 4: - count = create_ToUnicode_cmap4(cmap, ttcmap->map, used_glyphs_copy, cffont); + count = create_ToUnicode_cmap4(cmap, ttcmap->map, used_glyphs_copy, + is_cidfont ? cffont : NULL); break; case 12: - count = create_ToUnicode_cmap12(cmap, ttcmap->map, used_glyphs_copy, cffont); + count = create_ToUnicode_cmap12(cmap, ttcmap->map, used_glyphs_copy, + is_cidfont ? cffont : NULL); break; } - count += handle_subst_glyphs(cmap, cmap_add, used_glyphs_copy, sfont, cffont); + /* For handle_subst_glyphs(), cffont is for GID -> glyph name lookup, so + * it is only needed for non-CID fonts. */ + count += handle_subst_glyphs(cmap, cmap_add, used_glyphs_copy, sfont, + is_cidfont ? NULL : cffont); } if (count < 1) |