texlive[55615] Build/source/texk/dvipdfm-x: Lower priority of

commits+kakuto at tug.org commits+kakuto at tug.org
Sun Jun 21 04:26:50 CEST 2020


Revision: 55615
          http://tug.org/svn/texlive?view=revision&revision=55615
Author:   kakuto
Date:     2020-06-21 04:26:45 +0200 (Sun, 21 Jun 2020)
Log Message:
-----------
Lower priority of Soft-hyphen when generating ToUnicode. Show an
error when "CFF " table could not be found for a PS OpenType font.
(S. Hirata)

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

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2020-06-21 02:09:16 UTC (rev 55614)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2020-06-21 02:26:45 UTC (rev 55615)
@@ -1,3 +1,11 @@
+2020-06-21  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
+
+	* tt_cmap.c: Lower priority for Soft-hyphen U+00AD when
+	generating ToUnicode CMap.
+	* tt_cmap.c, type1c.c: Cause an error when "CFF " table is not
+	found. (Possibly due to variable font which uses unsupported
+	"CFF2" table)
+
 2020-06-09  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* pdfdev.c: Another workaround for fake-bold issue.

Modified: trunk/Build/source/texk/dvipdfm-x/tt_cmap.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_cmap.c	2020-06-21 02:09:16 UTC (rev 55614)
+++ trunk/Build/source/texk/dvipdfm-x/tt_cmap.c	2020-06-21 02:26:45 UTC (rev 55615)
@@ -705,6 +705,7 @@
   return;
 }
 
+/* Soft-hyphen (U+00AD) to lower its priority... added here for convenience */
 static int is_PUA_or_presentation (unsigned int uni)
 {
   /* Some of CJK Radicals Supplement and Kangxi Radicals
@@ -714,7 +715,8 @@
   return  ((uni >= 0x2E80 && uni <= 0x2EF3) || (uni >= 0x2F00 && uni <= 0x2FD5) ||
            (uni >= 0xE000 && uni <= 0xF8FF) || (uni >= 0xFB00 && uni <= 0xFB4F) ||
            (uni >= 0xF900 && uni <= 0xFAFF) || (uni >= 0x2F800 && uni <= 0x2FA1F) ||
-           (uni >= 0xF0000 && uni <= 0xFFFFD) || (uni >= 0x100000 && uni <= 0x10FFFD));
+           (uni >= 0xF0000 && uni <= 0xFFFFD) || (uni >= 0x100000 && uni <= 0x10FFFD) ||
+           (uni == 0x00AD));
 }
 
 static char *
@@ -937,6 +939,10 @@
     if (sfont->type == SFNT_TYPE_POSTSCRIPT) {
       ULONG offset;
       offset = sfnt_find_table_pos(sfont, "CFF ");
+      /* "CFF " table must exist here. Just abort... */
+      if (offset == 0) {
+        ERROR("\"CFF \" table not found. Must be found before... Can't continue.");
+      }
       cffont = cff_open(sfont->stream, offset, 0);
       cff_read_charsets(cffont);   
     }
@@ -1410,7 +1416,16 @@
     cff_font             *cffont;
     card16                gid;
 
-    offset = sfnt_find_table_pos(sfont, "CFF ");    
+    offset = sfnt_find_table_pos(sfont, "CFF ");
+    /* Possibly "CFF2" table for variable font: not supported. */
+    if (offset == 0) {
+      WARN("PS OpenType but no \"CFF \" table.. Maybe variable font? (not supported)");
+      RELEASE(cmap_name);
+      RELEASE(GIDToCIDMap);
+      sfnt_close(sfont);
+      DPXFCLOSE(fp);
+      return -1;       
+    } 
     cffont = cff_open(sfont->stream, offset, 0);
     if (!cffont) {
       RELEASE(cmap_name);
@@ -1682,7 +1697,14 @@
     num_glyphs = (card16) maxp->numGlyphs;
     RELEASE(maxp);
 
-    offset = sfnt_find_table_pos(sfont, "CFF ");    
+    offset = sfnt_find_table_pos(sfont, "CFF ");
+    if (offset == 0) {
+      WARN("PS OpenType but no \"CFF \" table.. Maybe variable font? (not supported)");
+      RELEASE(cmap_name);
+      sfnt_close(sfont);
+      DPXFCLOSE(fp);
+      return -1;
+    }
     cffont = cff_open(sfont->stream, offset, 0);
     if (cffont && cffont->flag & FONTTYPE_CIDFONT) {
       CMap       *cmap;

Modified: trunk/Build/source/texk/dvipdfm-x/type1c.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/type1c.c	2020-06-21 02:09:16 UTC (rev 55614)
+++ trunk/Build/source/texk/dvipdfm-x/type1c.c	2020-06-21 02:26:45 UTC (rev 55615)
@@ -94,7 +94,7 @@
 
   offset = sfnt_find_table_pos(sfont, "CFF ");
   if (offset < 1) {
-    ERROR("No \"CFF \" table found; not a CFF/OpenType font (10)?");
+    ERROR("No \"CFF \" table found; not a CFF/OpenType font (or variable font?) (10)?");
   }
 
   cffont = cff_open(sfont->stream, offset, 0);
@@ -296,7 +296,7 @@
   }
   if (sfont->type != SFNT_TYPE_POSTSCRIPT ||
       (offset = sfnt_find_table_pos(sfont, "CFF ")) == 0) {
-    ERROR("Not a CFF/OpenType font (11)?");
+    ERROR("Not a CFF/OpenType font (or variable font?) (11)?");
   }
 
   cffont = cff_open(fp, offset, 0);



More information about the tex-live-commits mailing list.