Fonts Help

Peter Flynn peter at silmaril.ie
Fri Aug 7 16:56:53 CEST 2020


On 07/08/2020 10:30, Tianyi Chen wrote:
> Hi! this is Tianyi, and I am really sorry to bother you, but I really 
> need some help.
> 
> Recently, I was trying to learn TeX and reading "The TeXbook”. I am 
> confused reading chapter4 "Fonts of Type”, the author did a really good 
> job teaching switching one font from another, but when I was trying to 
> explore more fonts, there are two problems  cannot be solved by myself.

Are you quite sure it's TeX you want to learn and not LaTeX?
Plain TeX on its own is very low-level and usually of interest
mainly to computer scientists and typographic programmers.

> First, what are the all available fonts I can use. 

In plain TeX, by default only the METAFONT fonts that came with your TeX 
distribution (search under your distribution's installation directory 
for any filenames ending in .mf). It is also possible to use converted 
Type 1 Postscript fonts with TeX and LaTeX (find the file psfonts.map to 
see a list of those already installed).

> So unlike the Word just give me a list to select fonts, 

TeX is not a graphical user interface, so there is nowhere for a list to 
go. Some TeX editors have a font-selection window, I think.

> fonts are stored in the TeX directory structure (TDS), and I
> successfully use the \font control sequence to switch fonts I found
> in the tfm file. However, there are many other files as following I
> did not know what I can do with other files.

*.mf -- METAFONT source outlines
*.pk -- packed Type 3 bitmap font (from METAFONT)
*.pfb -- Postscript Type 1 source outlines
*.tfm -- TeX Font Metrics (height and width of each character)
*.vf -- TeX Virtual Font (maps between different font layouts)
*.map -- TeX Map file (tells Postscript the name of the font to use)

Down at this level it's a complex and messy business. Details of how to 
convert additional Postscript Type 1 fonts for use with LaTeX are at
http://latex.silmaril.ie/formattinginformation/psfonts.html#psfonts-prep

HOWEVER...

If you use XeLaTeX instead of TeX, you can use all your system fonts. 
Most of the ones available for XeLaTeX have packages, so you just say 
(eg for the Noto typeface)

\usepackage{Noto}

If you want to specify the three types manually, details are in the 
manual for the fontspec package. It's like
\setmainfont{Droid Serif}
\setsansfont{Raleway}
\setmonofont{Luxi Mono}

> Second, if I found a new created font, how can I use it in TeX.

If it's been done in METAFONT, and it's already installed, just load it 
with the \font command. I can't remember how to use Postscript fonts in 
plain TeX, but in LaTeX there are packages which implement them, eg times

But I still recommend XeLaTeX, personally. Others will disagree, 
sometimes vehemently.

> To conclude, I feel like I need to know fonts itself, and then how
> TeX uses it and what the logic is.
That's enough to fill a book.

Peter


More information about the texhax mailing list.