[NTG-pdftex] [PATCH v3] pdftex - Add support for encfile and \pdfgentounicode for PK fonts

Pali Rohár pali.rohar at gmail.com
Thu Mar 30 09:35:39 CEST 2017

On Wednesday 29 March 2017 23:58:06 Karl Berry wrote:
> I installed the patch, thanks.
> But I admit I am still confused about the documentation. It's clear that
> with this new patch, both
> \pdfmapline{cmr10}
> and
> \pdfmapline{cmr10 <7t.enc}
> get the same output -- cmr10.3600pk and cmr10.600pk are embedded
> separately. That's what we want.
> But, as I read the documentation, this is the exact opposite of what it
> calls a "scalable Type 3" font. pdftex-t.tex says:
>     Lines containing nothing apart from {\em tfmname} [now, possibly
>     with a re-encoding] stand for scalable Type~3 fonts. For scalable
>     fonts as Type~1, TrueType and scalable Type~3, all the fonts loaded
>     from a \TFM\ at various sizes will be included only once in the
>     \PDF\ output. Thus if a font, let's say \type{csr10}, is described
>     in one of the map files, then it will be treated as scalable. As a
>     result the font source for csr10 will be included only once for
>     \type{csr10}, \type{csr10 at 12pt} etc. So \PDFTEX\ tries to do its
>     best to avoid multiple embedding of identical font sources. 
> But here, with or without the re-encoding, we are embedding cmr10
> separately from cmr10 at 60pt.

I forgot to include this part of patch:

--- source/src/texk/web2c/pdftexdir/mapfile.c
+++ source/src/texk/web2c/pdftexdir/mapfile.c
@@ -537,7 +537,7 @@ static void fm_scan_line(void)
-    } else
+    } else if (is_std_t1font(fm))
         set_type1(fm);          /* assume a builtin font is Type1 */
     if (check_fm_entry(fm, true) != 0)
         goto bad_line;

Previous (-) line caused that every type3 font was marked as type1.

(I have pdftex in local git repository and forgot to export whole patch
into svn diff)

$ cat test.tex

\font\fg=cmr10 at 60pt
\ff ABC
\fg ABC

$ pdffonts test.pdf 
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
[none]                               Type 3            yes no  no       4  0

Now is cmr10 really marked as scalable and included in output PDF only
once (for cmr10 and also for cmr10 at 60pt).

> In other words, as far as I can see, scalable Type 3 fonts in the sense
> of the current documentation are not supported at all. (After your first
> patch and before today's patch, accidentally, they were supported when a
> re-encoding was given but not otherwise.)
> Am I getting things backward?
> I believe the original idea of scalable Type 3 was that the font code
> itself would do the scaling to different sizes; that's why the font only
> had to be included once. Like a Type 1.

Yes, I understand that idea in same way.

> But since the demise of PGC et al., that was no longer operative.
> To sum up, I think the current behavior is good, and I should change the
> manual to get rid of PGC stuff, get rid of the phrase "scalable Type 3",
> and explain the current behavior.

I'm going to play with PGC files as I think it still could be useful for
ability to include any PDF shape into font file...

> ?
> Thanks,
> Karl

Pali Rohár
pali.rohar at gmail.com

More information about the ntg-pdftex mailing list