summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog11
-rw-r--r--Build/source/texk/web2c/pdftexdir/writefont.c34
2 files changed, 42 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index b34e83ff220..dce48934885 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,14 @@
+2018-01-25 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+ and Karl Berry <karl@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@freefriends.org>
* pdftex.web (literal): if a non-PDF special is ignored,
diff --git a/Build/source/texk/web2c/pdftexdir/writefont.c b/Build/source/texk/web2c/pdftexdir/writefont.c
index 890e538bd61..b96aaf094e0 100644
--- a/Build/source/texk/web2c/pdftexdir/writefont.c
+++ b/Build/source/texk/web2c/pdftexdir/writefont.c
@@ -660,11 +660,40 @@ static void create_fontdictionary(fm_entry * fm, integer font_objnum,
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 @@ void dopdffont(integer font_objnum, internalfontnumber f)
create_fontdictionary(fm, font_objnum, f);
}
-/**********************************************************************/
// vim: ts=4