Fonts & Character SetsKnowing installed fonts

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Knowing installed fonts

Post by Keta »

Hi,

Using different fonts within LaTeX is one of the things I don't get to fully understand. Besides using packages to change the default fonts, I recently learned commands such as \fontfamily{ptm}\selectfont, but found those weird names "ptm" "pcr" and so. I guess all those names will be stored somewhere, along with the "real" names "Adobe Times" and "Adobe Courier".

How can I know what fonts are installed and usable by LaTeX?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: Knowing installed fonts

Post by josephwright »

Usually for LaTeX (as opposed to plain TeX) you use a package to load a font, for example:

\usepackage{mathptmx} % Times
\usepackage{helvet} % Helvetica

In a lot of cases, these are actually free "clone" fonts, rather than the commercial originals. For example, neither of the above use the named fonts directly: they both use URW fonts which are free (GPL, I think).

Of course, if you use xelatex, you can load system fonts with the fontspec package. This is the way forward for working with fonts, in my opinion.
--
Joseph Wright
Joseph Wright
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Knowing installed fonts

Post by daleif »

Keta wrote:Hi,

Using different fonts within LaTeX is one of the things I don't get to fully understand. Besides using packages to change the default fonts, I recently learned commands such as \fontfamily{ptm}\selectfont, but found those weird names "ptm" "pcr" and so. I guess all those names will be stored somewhere, along with the "real" names "Adobe Times" and "Adobe Courier".

How can I know what fonts are installed and usable by LaTeX?
it might be useful to visit

http://www.tug.dk/FontCatalogue/
Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Re: Knowing installed fonts

Post by Keta »

The link is very helpful, thanks! It's a very good resource for using fonts in LaTeX. :D

Still, sometimes I feel the need to use other commands. Some packages provide commands to select a particular font, but others just change the default behavior of the roman or sans-serif families, and the only way I know to manually change the fonts at desire is the \selectfont command. I have lots of folders with fonts installed, but I don't know how to use them. The only families I managed to correctly use are the common PostScript fonts (Times, Courier, Chancery...). I think there must be a way to use the installed fonts, but I can't find how. I know the easy of xelatex in this respect, but I don't want to use it right now.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: Knowing installed fonts

Post by phi »

TeX can only use Type-1 fonts (*.pfa or *.pfb) and Metafont bitmap fonts (*.pg or *.pk), and it needs special font metric files (*.tfm). In addition to that, the LaTeX New Font Selection Scheme (NFSS) requires font definition files or equivalent declarations. TrueType and OpenType fonts don't work. This is the reason why xetex was created in the first place.
Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Knowing installed fonts

Post by Keta »

phi wrote:TeX can only use Type-1 fonts (*.pfa or *.pfb) and Metafont bitmap fonts (*.pg or *.pk), and it needs special font metric files (*.tfm). In addition to that, the LaTeX New Font Selection Scheme (NFSS) requires font definition files or equivalent declarations. TrueType and OpenType fonts don't work. This is the reason why xetex was created in the first place.
I have 2 .pfa, 16 .pk, 3955 .pfb and 15182 .tfm files installed in my TeX distribution; I only know how to use a minuscule part of them. For example, the Font Catalogue above lists Optima, and to use the font one needs the \selectfont and so commands. I tried, but I did not get Optima. If you look at the LaTeX source file, the section font is declared with \usefont{T1}{fvs}{m}{n} (there is no way to know which typeface fvs is, or is it?), which works fine (seems like I have the unknown font installed somewhere), but the Optima selection command \renewcommand{\sfdefault}{uop} doesn't work for me. Changing uop with kurier worked, however (pure luck). How can I know which are the names I can use? If TeX knows, I'd say there might be a way for me to know.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Knowing installed fonts

Post by phi »

When you request the font family F in encoding E, LaTeX loads a file EF.fd. This file contains commands that tell LaTeX how to load the corresponding font, as described in the fntguide documentation file. One of the items in the argument of the \DeclareFontShape command is a TeX font name which is eventually loaded using the \font primitive. TeX itself only knows about the metric files (*.tfm). The mapping between TeX font names and font data files is driver specific and usually defined in terms of mapping files (*.map), e.g. pdftex.map for pdfTeX. This mapping file contains a line for each font that describes how the driver should load the font. For pdfTeX, the actual format of the map file is described in the pdfTeX manual.
Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Re: Knowing installed fonts

Post by Keta »

Thanks for the explanation phi, it helped so much! :D :D Now I understand it much better. Will have a look at the documents, I'll try to learn more about fonts, thanks! :)
Post Reply