[pdftex] font strategy in pdftex

Han The Thanh thanh at informatics.muni.cz
Tue Feb 13 17:05:49 CET 2001


> I found excessive font embedding in documents
> produced by pdftex.
> 
> I use 3 ways (dvips+distiller, dvipdfm, pdftex) to generate pdf
> from the following file and font map.
> %%%  FILE %%%%
>         \def\test{abcdefghijklmnopqrstuvwxyz\\}
>         \begin{document}
>             \font\true=ptmr8r17 at 10 pt\selectfont\true\test
>             \font\true=ptmr8r   at 10 pt\selectfont\true\test
>             \font\true=ptmr8r9  at 10 pt\selectfont\true\test
>             \font\true=ptmr8r8  at 10 pt\selectfont\true\test
>             \font\true=ptmr8r7  at 10 pt\selectfont\true\test
>             \font\true=ptmr8r6  at 10 pt\selectfont\true\test
>             \font\true=ptmr8r5  at 10 pt\selectfont\true\test
>         \end{document}
> %%%  This is the map for pdftex, maps for dvips and dvipdfm are similar  %%%
>         ptmr8r   Times-Roman   <8r.enc
>         ptmr8r17 <tir_____.pfb <8r.enc ".97 ExtendFont"
>         ptmr8r9  <tir_____.pfb <8r.enc "1.03 ExtendFont"
>         ptmr8r8  <tir_____.pfb <8r.enc "1.07 ExtendFont"
>         ptmr8r7  <tir_____.pfb <8r.enc "1.11 ExtendFont"
>         ptmr8r6  <tir_____.pfb <8r.enc "1.15 ExtendFont"
>         ptmr8r5  <tir_____.pfb <8r.enc "1.25 ExtendFont"
> %%%%%%%%%%%%%%
> As seen, only the standard font is used.
> 
> The results are dramatically different.
> Neither dvipdfm nor dvips+distiller embed standard resource
> but pdftex embeds it six times. Why? Only Tz operator should
> change horizontal scaling when an extended font is used
> (see 'PDF reference' sec.ed. 5.2.).
> 
> Excessive font embedding increases file size, for example,
>  1.987 kB for dvips+distiller,
>  3.990 kB for dvipdfm and
> 51.791 kB (!) for pdftex.
> Moreover, such a font strategy leads to incorrect result.
> Printer (or viewer) font will be used for unextended font
> while creator's font is embedded for extended fonts. As it was
> recently discussed in mail-list, these fonts can be different.
> 
> What is the reason for the excessive font embedding in pdftex?

in the early days of pdftex, I used to change the graphic state matrix to
emulate FontExtend and FontSlant, so it could be used for truetype fonts as
well.  Afterward, when experimenting with hz-opt, I found it too
problematic to do it this way. So I switched to changing the FontMatrix of
Type1 font instead. This causes the output larger and avoids
extending/slanting truetype fonts, but also makes the implementation
cleaner and easier to extend, especially when playing with the hz-opt. 

Concerning use of builtin fonts, one can always embed the 14 base fonts by
URW++ if he/she wishes. 

The current implementaion however doesn't check if two tfm share a single
font file. It could have been improved, but I don't consider it worthwhile.
It happens rarely, and having the file a little bit larger doesn't seem to
hurt much.

Regards,
Thanh



More information about the pdftex mailing list