diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-25 23:26:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-25 23:26:28 +0000 |
commit | 57e7650be3f2d82e0bb71944b5aa1aa0424ea529 (patch) | |
tree | 62aeaf305dd5a68c37d6ddf629ee4c66e96d6d76 /Build | |
parent | a3e963986c05c9ecf0db84a955d3070a84c5531c (diff) |
avoid failed assertion with \pdffontobjnum of unused font, pdftex r793
git-svn-id: svn://tug.org/texlive/trunk@46443 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 11 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/writefont.c | 34 |
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 |