From 076a42c3933de3b196cb3725e67ab847d94c2d9a Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 31 Mar 2019 21:29:54 +0000 Subject: Fix a bug reported by jfbu (S. Hirata). git-svn-id: svn://tug.org/texlive/trunk@50676 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 6 ++++++ Build/source/texk/dvipdfm-x/pdfencoding.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 709472bedae..9fb69c5a280 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,9 @@ +2019-04-01 Shunsaku Hirata + + * pdfencoding.c: Fix a bug that dvipdfmx wrongly tries to + create ToUnicode CMap even when there is no valid mapping + entry. It just results in "Invalid CMap" warning. + 2019-03-30 Akira Kakuto * spc_xtx.c: "ap->curptr" was copied to "buffer" without 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 @@ -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); -- cgit v1.2.3