[texhax] Bypassing errors when loading fonts

Karl Berry karl at freefriends.org
Wed Jun 5 02:35:57 CEST 2013


Hi Samuel,

A test to see if a font can be used ... I believe it was Frank Mittelbach
who once posted this code to check if a .tfm can be loaded:

     \batchmode
     \font\X=<font name>
     \errorstopmode
     \ifx\X\nullfont
       <font not available>
     \else
       <use the font>
     \fi

However, I don't know of any way to test if a font can be rendered,
independent of whether the .tfm is readable.  In theory, I expect it
should be possible in LuaTeX since the whole font loading process can be
tinkered with, but I don't have a recipe.

You will want to set the environment variables MKTEXPK and MKTEXTFM to
the (string) value 0, as in (for Bourne shells)
  MKTEXPK=0; export MKTEXPK
  MKTEXTFM=0; export MKTEXTFM

Also, I expect it would be necessary to use either xetex or luatex to
process the document for the sake of fonts only available in OpenType
format, as Barbara mentioned.

Also, I expect you would want to skip the (1500 or so) tfm's under
japanese-otf* if you have them installed, since they are "Japanese"
tfm's and need to be processed using ptex, which conflicts with
the need for xetex/luatex.

Also, I expect that any such document will run afoul of hardwired limits
somewhere, so you'd have to change texmf.cnf, remake .fmt's, etc.

In case it's of interest, for some of the known-bad tfm's, etc., see the
exclude_tfm list in
http://tug.org/svn/texlive/trunk/Master/tlpkg/bin/check-files-by-format?view=co
We've tried to contact authors, sometimes fixed versions get released,
other times not.  So it goes.

Hope this helps.  Good luck :).

karl


P.S.  I've never tried to make a sampler like this, since there are over
25,000 .tfm files in TeX Live.  A document typesetting all of them seems
so large as to be unreadable, even if it can be processed.  Figuring out
any way to slice and dice such a large has always stopped me cold.

There are various attempts out there already -- my favorite is
http://www.tug.dk/FontCatalogue, FWIW.


More information about the texhax mailing list