texlive[46443] Build/source/texk/web2c/pdftexdir: avoid failed

commits+karl at tug.org commits+karl at tug.org
Fri Jan 26 00:26:28 CET 2018


Revision: 46443
          http://tug.org/svn/texlive?view=revision&revision=46443
Author:   karl
Date:     2018-01-26 00:26:28 +0100 (Fri, 26 Jan 2018)
Log Message:
-----------
avoid failed assertion with \pdffontobjnum of unused font, pdftex r793

Revision Links:
--------------
    http://tug.org/svn/texlive?view=revision&revision=793

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
    trunk/Build/source/texk/web2c/pdftexdir/writefont.c

Modified: trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2018-01-25 21:53:06 UTC (rev 46442)
+++ trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2018-01-25 23:26:28 UTC (rev 46443)
@@ -1,3 +1,14 @@
+2018-01-25  Hironobu Yamashita <h.y.acetaminophen at gmail.com>
+        and Karl Berry  <karl at freefriends.org>
+
+	* writefont.c (font_is_used): import LuaTeX's font_has_subset
+	with different name.
+	(dopdffont): call it, to avoid failed assertion. (tests/09-fontobjnum)
+	Original report from Enrico Gregorio,
+	  tug.org/pipermail/tex-live/2018-January/040966.html
+	followup with patch at
+	  mailman.ntg.nl/pipermail/ntg-pdftex/2018-January/004209.html
+
 2018-01-06  Karl Berry  <karl at freefriends.org>
 
 	* pdftex.web (literal): if a non-PDF special is ignored,

Modified: trunk/Build/source/texk/web2c/pdftexdir/writefont.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/writefont.c	2018-01-25 21:53:06 UTC (rev 46442)
+++ trunk/Build/source/texk/web2c/pdftexdir/writefont.c	2018-01-25 23:26:28 UTC (rev 46443)
@@ -660,11 +660,40 @@
         write_fontdictionary(fo);
 }
 
-/**********************************************************************/
 
-void dopdffont(integer font_objnum, internalfontnumber f)
+

+/* This is called font_has_subset in luatex, but it returns 1 if any
+   characters from the font are used, and 0 if not (using fontbc and
+   fontec as the endpoints to check), i.e., whether any characters are
+   actually used from the font. */
+
+static int
+font_is_used(internalfontnumber f)
 {
+    int i, s;
+    /* search for |first_char| and |last_char| */
+    for (i = fontbc[f]; i <= fontec[f]; i++)
+        if (pdfcharmarked(f, i))
+            break;
+    s = i;
+    for (i = fontec[f]; i >= fontbc[f]; i--)
+        if (pdfcharmarked(f, i))
+            break;
+    if (s > i)
+        return 0;
+    else
+        return 1;
+}
+
+void
+dopdffont(integer font_objnum, internalfontnumber f)
+{
     fm_entry *fm;
+    if (!font_is_used(f))
+        return; /* avoid failed assertion in create_fontdictionary,
+                mailman.ntg.nl/pipermail/ntg-pdftex/2018-January/004209.html */
+       
+
     fm = hasfmentry(f) ? (fm_entry *) pdffontmap[f] : NULL;
     if (fm == NULL || is_pk(fm))
         writet3(fm, font_objnum, f);
@@ -672,5 +701,4 @@
         create_fontdictionary(fm, font_objnum, f);
 }
 
-/**********************************************************************/
 // vim: ts=4



More information about the tex-live-commits mailing list