[NTG-pdftex] 1.20b-rc0 font replacement bug
Hartmut Henkel
hartmut_henkel at gmx.de
Thu Nov 25 02:25:06 CET 2004
Hi Thanh,
when a PDF file with embedded fonts is included by \pdfximage, fonts
will be replaced through lookup_ps_name() heuristics. However it's
actually not checked there whether the font file itself is available.
Problem example:
Some PDF file comes with a Palatino-Roman. TFM entry pplr8r is listed in
the mapfile together with fontfile <pplr8a.pfb. But pplr8a.pfb isn't on
the PC. Still the font embedded in the PDF file will be replaced by ---
nothing. One gets an invalid stream, missing letters.
But if the fontfile is not available, the replacement of embedded fonts
in PDF files shouldn't be done at all; instead the font coming with the
PDF file should be used as is. Below is a quick patch. Only roughly
checked.
Regards, Hartmut
--- mapfile.c.orig Sun Nov 7 14:34:23 2004
+++ mapfile.c Thu Nov 25 02:06:08 2004
@@ -721,8 +721,9 @@
/* lookup_ps_name looks for an entry with a given ps name + slant + extend.
* As there may exist several such entries, we need to select the `right'
* one. We do so by checking all such entries and return the first one that
- * fulfils the following criteria (in descending priority):
+ * fulfills the following criteria:
*
+ * - the font file is available, and (in descending priority):
* - the tfm has been used (some char from this font has been typeset)
* - the tfm has been loaded (but not used yet)
* - the tfm can be loaded (but not loaded yet)
@@ -732,6 +733,7 @@
static fm_entry *lookup_ps_name(fm_entry *fm)
{
fm_entry *p, *p2;
+ ff_entry *ff;
struct avl_traverser t, t2;
strnumber s;
int a;
@@ -750,14 +752,16 @@
/* search forward */
do {
- if (used_tfm(p))
+ ff = check_ff_exist(p);
+ if (ff->ff_path != NULL && used_tfm(p))
return p;
p = avl_t_next(&t);
} while (p != NULL && comp_fm_entry_ps(fm, p, NULL) == 0);
/* search backward */
while (p2 != NULL && comp_fm_entry_ps(fm, p2, NULL) == 0) {
- if (used_tfm(p2))
+ ff = check_ff_exist(p2);
+ if (ff->ff_path != NULL && used_tfm(p2))
return p2;
p2 = avl_t_prev(&t2);
}
More information about the ntg-pdftex
mailing list