[NTG-pdftex] \pdffontobjnum assertion failed

Karl Berry karl at freefriends.org
Thu Jan 25 01:56:47 CET 2018


Thanks much Hironobu, but it seems conceivable that a font might be
entirely used, in which case it would not have a "subset", but should
still be processed in dopdffont.

However, what the font_has_subset code actually seems to be doing is
checking if any characters are used at all from the font, not whether it
is subsetted (vs. completely used). In which case, ok. (Except for the
confusing name. :)

Am I understanding correctly?

Thanks again,
Karl


--- ptexlib.h	(revision 46427)
+++ ptexlib.h	(working copy)

[...]

--- writefont.c	(revision 46427)
+++ writefont.c	(working copy)
@@ -665,6 +665,8 @@
 void dopdffont(integer font_objnum, internalfontnumber f)
 {
     fm_entry *fm;
+    if (!font_has_subset(f)) return; /* avoid Assertion failed */
+
     fm = hasfmentry(f) ? (fm_entry *) pdffontmap[f] : NULL;
     if (fm == NULL || is_pk(fm))
         writet3(fm, font_objnum, f);
@@ -672,5 +674,22 @@
         create_fontdictionary(fm, font_objnum, f);
 }
 
+static int font_has_subset(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;
+}
+
 /**********************************************************************/
 // vim: ts=4


More information about the ntg-pdftex mailing list