[tex-k] How dvips loads tfm files for virtual fonts?

Deimantas Galcius deimantas.galcius at gmail.com
Fri Apr 8 13:40:35 CEST 2022

On 4/8/22 09:37, Igor Liferenko wrote:
> Dvips does not load tfm-files for fonts which are not listed in psfonts.map

An excerpt from Donald Knuth, Virtual Fonts: More Fun for Grand Wizards,

Theidea is this:For each font specified in a dvi
file, the software looks first in a special table to see
if the font is device-resident(in which case the tfm
file is loaded,to get the characterwidths);failing
that,it looks for a suitable gf or pk file; failing that,
it looks for a vf file, which may in turn lead to other
actual or virtualfiles. The latterfiles should not be
loadedimmediately,butonly on demand,because
the process is recursive.Incidentally,if no resident
or gfor pk or vf file is found, a tfm file should be
loadedas a last resort,so thatthe characterscan
be left blank with appropriate widths.

> This can be verified with this these commands:
>      echo 'A \bye' >x.tex
>      tex x
>      dvips -Ppdf -d -1 x 2>&1 | grep 'fopen.*tfm' # tfm is opened
>      dvips -Ppk -d -1 x 2>&1 | grep 'fopen.*tfm'  # tfm not opened
> Virtual fonts are not present in map-file.
> But their metrics should be loaded, as these metrics are actually
> used during the typesetting (not the metrics of underlying fonts).
> Let's check:
>      echo '\font\ptm=ptmr7t \ptm A \bye' >y.tex
>      tex y
>      dvips -Ppk -d -1 y 2>&1 | grep 'fopen.*tfm'
> We see that ptmr7t.tfm is not loaded. Why?

Because ptmr7t.vf is found/loaded. tfm is needed by tex,
but not necessarily by dvips.

> Also, which rules determine that ptmr8r.tfm is loaded?

If you convert vf to vpl:
$ vftovp ptmr7t.vf ptmr7t.tfm ptmr7t.vpl

and inspect vpl file, you will see that ptmr7t font maps  to MTMI and 
ptmr8r fonts:
    (FONTCHECKSUM O 26441631172)
    (FONTAT R 1.0)
    (FONTDSIZE R 10.0)
    (FONTNAME ptmr8r)
    (FONTCHECKSUM O 23057243327)
    (FONTAT R 1.0)
    (FONTDSIZE R 10.0)

> And if a
> virtual font would
> consist of more that one font, will metrics for all of them be loaded?

Yes, all fonts will be expanded and loaded.

I think the above mentioned article by DEK should answer most of your 

- best, deimi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-k/attachments/20220408/4881ba12/attachment.html>

More information about the tex-k mailing list.