summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/tt_cmap.c
diff options
context:
space:
mode:
authorJjgod Jiang <gzjjgod@gmail.com>2014-08-05 19:57:17 +0000
committerJjgod Jiang <gzjjgod@gmail.com>2014-08-05 19:57:17 +0000
commit40177427f4c83e9facd363c67acc200c5334bfdb (patch)
tree593306b8f03bdf59aec900c979e7e8384366a211 /Build/source/texk/dvipdfm-x/tt_cmap.c
parent97fa7b3630528845d9934ad227bc9f3a0c9d1d98 (diff)
Fix xdvipdfmx ToUnicode regression caused by r34831
git-svn-id: svn://tug.org/texlive/trunk@34848 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/tt_cmap.c')
-rw-r--r--Build/source/texk/dvipdfm-x/tt_cmap.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c
index 26b340f8f57..f288891a195 100644
--- a/Build/source/texk/dvipdfm-x/tt_cmap.c
+++ b/Build/source/texk/dvipdfm-x/tt_cmap.c
@@ -1087,7 +1087,7 @@ create_ToUnicode_cmap (tt_cmap *ttcmap,
CMap *cmap_add,
const char *used_glyphs,
sfnt *sfont,
- CMap *cmap_loaded)
+ CMap *code_to_cid_cmap)
{
pdf_obj *stream = NULL;
CMap *cmap;
@@ -1103,7 +1103,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 && is_cidfont) {
+ if (code_to_cid_cmap && cffont && is_cidfont) {
for (i = 0; i < 8192; i++) {
int j;
long len;
@@ -1120,7 +1120,7 @@ create_ToUnicode_cmap (tt_cmap *ttcmap,
continue;
cid = cff_charsets_lookup_inverse(cffont, gid);
- ch = CMap_reverse_decode(cmap_loaded, cid);
+ ch = CMap_reverse_decode(code_to_cid_cmap, cid);
if (ch >= 0) {
unsigned char *p = wbuf + 2;
wbuf[0] = (cid >> 8) & 0xff;
@@ -1188,7 +1188,7 @@ otf_create_ToUnicode_stream (const char *font_name,
pdf_obj *cmap_ref = NULL;
long res_id;
pdf_obj *cmap_obj = NULL;
- CMap *cmap_add, *cmap_loaded;
+ CMap *cmap_add, *code_to_cid_cmap;
int cmap_add_id;
tt_cmap *ttcmap;
char *normalized_font_name;
@@ -1196,7 +1196,7 @@ otf_create_ToUnicode_stream (const char *font_name,
FILE *fp = NULL;
sfnt *sfont;
long offset = 0;
- int i;
+ int i, cmap_type;
/* replace slash in map name with dash to make the output cmap name valid,
* happens when XeTeX embeds full font path
@@ -1256,7 +1256,10 @@ otf_create_ToUnicode_stream (const char *font_name,
ERROR("Could not read OpenType/TrueType table directory.");
}
- cmap_loaded = CMap_cache_get(cmap_id);
+ code_to_cid_cmap = CMap_cache_get(cmap_id);
+ cmap_type = CMap_get_type(code_to_cid_cmap);
+ if (cmap_type != CMAP_TYPE_CODE_TO_CID)
+ code_to_cid_cmap = NULL;
cmap_add_id = CMap_cache_find(cmap_name);
if (cmap_add_id < 0) {
@@ -1273,7 +1276,7 @@ otf_create_ToUnicode_stream (const char *font_name,
if (ttcmap->format == 4 || ttcmap->format == 12) {
cmap_obj = create_ToUnicode_cmap(ttcmap, cmap_name, cmap_add, used_glyphs,
- sfont, cmap_loaded);
+ sfont, code_to_cid_cmap);
break;
}
}