texlive[50676] Build/source/texk/dvipdfm-x: Fix a bug reported by

commits+kakuto at tug.org commits+kakuto at tug.org
Sun Mar 31 23:29:54 CEST 2019


Revision: 50676
          http://tug.org/svn/texlive?view=revision&revision=50676
Author:   kakuto
Date:     2019-03-31 23:29:54 +0200 (Sun, 31 Mar 2019)
Log Message:
-----------
Fix a bug reported by jfbu (S. Hirata).

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/pdfencoding.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2019-03-31 19:31:37 UTC (rev 50675)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2019-03-31 21:29:54 UTC (rev 50676)
@@ -1,3 +1,9 @@
+2019-04-01  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
+
+	* 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  <kakuto at w32tex.org>
 
 	* spc_xtx.c: "ap->curptr" was copied to "buffer" without

Modified: trunk/Build/source/texk/dvipdfm-x/pdfencoding.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfencoding.c	2019-03-31 19:31:37 UTC (rev 50675)
+++ trunk/Build/source/texk/dvipdfm-x/pdfencoding.c	2019-03-31 21:29:54 UTC (rev 50676)
@@ -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 at kettering.edu>
@@ -643,12 +643,15 @@
 {
   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 @@
 
   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 @@
         total_fail++;
       } else {
         CMap_add_bfchar(cmap, wbuf, 1, wbuf + 1, len);
+        count++;
       }  
     }
   }
@@ -685,7 +690,7 @@
     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);



More information about the tex-live-commits mailing list