summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/pdfencoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvipdfm-x/pdfencoding.c')
-rw-r--r--Build/source/texk/dvipdfm-x/pdfencoding.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Build/source/texk/dvipdfm-x/pdfencoding.c b/Build/source/texk/dvipdfm-x/pdfencoding.c
index 492e22ff976..0b7744f4cc9 100644
--- a/Build/source/texk/dvipdfm-x/pdfencoding.c
+++ b/Build/source/texk/dvipdfm-x/pdfencoding.c
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2008-2018 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata,
+ Copyright (C) 2002-2019 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
@@ -643,12 +643,15 @@ pdf_create_ToUnicode_CMap (const char *enc_name,
{
pdf_obj *stream;
CMap *cmap;
- int code, total_fail;
+ int code, count, total_fail;
char *cmap_name;
unsigned char *p, *endptr;
ASSERT(enc_name && enc_vec);
+ if (!is_used)
+ return NULL;
+
cmap_name = NEW(strlen(enc_name)+strlen("-UTF16")+1, char);
sprintf(cmap_name, "%s-UTF16", enc_name);
@@ -661,6 +664,7 @@ pdf_create_ToUnicode_CMap (const char *enc_name,
CMap_add_codespacerange(cmap, range_min, range_max, 1);
+ count = 0;
total_fail = 0;
for (code = 0; code <= 0xff; code++) {
if (is_used && !is_used[code])
@@ -677,6 +681,7 @@ pdf_create_ToUnicode_CMap (const char *enc_name,
total_fail++;
} else {
CMap_add_bfchar(cmap, wbuf, 1, wbuf + 1, len);
+ count++;
}
}
}
@@ -685,7 +690,7 @@ pdf_create_ToUnicode_CMap (const char *enc_name,
if (dpx_conf.verbose_level > 0)
WARN("Glyphs with no Unicode mapping found. Removing ToUnicode CMap.");
}
- stream = total_fail > 0 ? NULL : CMap_create_stream(cmap);
+ stream = (count == 0 || total_fail > 0) ? NULL : CMap_create_stream(cmap);
CMap_release(cmap);
RELEASE(cmap_name);