Adding fonts to TeX and LaTeX is a somewhat complex procedure. However, like a lot of things, it's easy if you know how to do it. Some fonts are distributed in metafont format, and some in Type 1 format. Usually, the Type 1 formats are more easily available. However, metafont fonts have the distinct advantage that they can adjust their shape at different sizes, while Type 1 and TrueType fonts at different point sizes are simply magnified or reduced versions of precisely the same shape. The main reason why this feature is desirable is that ideally, fonts should be ( relatively ) wider at smaller sizes and narrower at larger sizes.
For this discussion, we focus on Type 1 fonts, since they are more widely available, and more problematic to install.
Here's a quick primer on LaTeX fonts. LaTeX uses the following types of font files for handling Type 1 fonts:
.pl -- property list. This is a human readable version of a tex font metric file.
.vpl -- virtual property list. Human readable version of a virtual font file.
.fd -- font definition. Used to define a family of fonts.
.tfm -- tex font metric. This is a metric file, as explained in the glossary. It is completely analogous to the .afm files used by Type 1 fonts. TeX needs the font metrics to properly layout the page.
.vf -- virtual font. These files contain encoding details, and act as interpreters. TeX treats them as fonts. For example, Imagine that there's some wacky font foobar-exp.pfb which consists of a few ( say 20 ) alternate characters, and there's a virtual font which uses a few of these alternate characters ( and it gets the rest of the characters from font foobar.pfb ). Dvips might say ``I want character 65 of virtual font foo.vf''. Dvips knows that 65 is always an ``a'' in TeX's scheme. Then the virtual font maps TeX's request to a request for character 14 of the Type 1 font foobar.pfb ( which might be the alternate ``a'' in the Type 1 font foobar.pfb ). The virtual font mechanism is very flexible and allows fonts to be constructed from many different font files. This is useful when using fonts such as adobe's ``expert'' fonts.
.pk -- a device dependent bitmap font. These are usually constructed on an as-needed basis ( they are renderings of Type 1 and metafont fonts ). They are typically high resolution ( about 300-1200dpi ), and are intended to be rendered on a printer. Because of their high resolution, and the fact that each point size of each font requires a .pk file, they require a lot of disk space, so they are cached, but not stored.
.mf -- metafont files. Metafont is a graphics programming language widely used for font design ( though it can also be used for graphics ). It has many advantages over TrueType and Type 1 schemes. However, it's main weakness is that it is not as ubiquitous as TrueType or Type 1 ( and it is also not terribly well suited to WYSIWYG publishing. Of course, this isn't a major disadvantage when TeX is your typesetting system. )
It's good to know your way around the TeX directory structure. Here are the main directories you'll need to know about:
$TEXMF/fonts -- the main font directory
$TEXMF/fonts/type1 -- the type1 font directory
$TEXMF/fonts/type1/foundry -- the directory for the shape files in a given foundry
$TEXMF/fonts/type1/foundry/fontname -- contains the font called name. The name is usually plain English, and needn't follow TeX's cryptic naming scheme for fonts.
$TEXMF/fonts/afm/foundry/fontname -- the directory containing the afm files corresponding to the font name belonging to foundry foundry.
$TEXMF/fonts/tfm/foundry/fontname -- analogous to the afm directory, but contains tfm files instead.
$TEXMF/fonts/vf/foundry/fontname -- similar to the above, but contains the virtual fonts.
$TEXMF/fonts/source/foundry/fontname -- similar to the above, but contains metafont files.
$TEXMF/dvips/config/psfonts.map -- fontmap file for dvips. This file is similar in both function and format to ghostscript's Fontmap file.
$TEXMF/tex/latex/psnfss -- this is where all the font definition files go.
First, you need to appropriately name your fonts. See the fontinst documentation on your system for instructions on how to name fonts ( it should be fontinst subdirectory of the directory containing your tetex documentation ). To make a long story very short, the naming scheme is FNW{V}E{n} where:
F is a one-letter abbreviation for the foundry ( m = monotype, p = adobe, b = bitstream, f = free )
N is a two letter abbreviation for the font name ( for example, ag = ``avant garde'' )
W is the font weight ( r = regular, b = bold, l = light d = demibold )
V is an optional slope variant ( i = italic , o = oblique )
E is an abbreviation for the encoding ( almost always 8a which is adobe standard encoding ).
N is an optional width variant ( n = narrow )
Now you can run fontinst as follows: latex `kpsewhich fontinst.sty` then you type at the prompt: \latinfamily{font_name}{}\bye where font_name is the first three letters of your font file name ( for example, pad for adobe garamond ). Now fontinst will generate a number of files -- font description files, property list files and virtual property list files. It also generates a lot of .mtx files. These are created by fontinst, but you don't need to use them. You need to convert the property lists and virtual property lists to metrics and virtual fonts. This is done using the utilities vptovf and pltotf. for X in *.pl; do pltotf $X; done for X in *.vpl; do vptovf $X; done Then remove the old vpl, pl and mtx files.
You will need to edit your dvips config file, psfonts.map. The best way to explain the format of the file is to give an example.
marr8r ArialMT <8r.enc <farr8a.pfa marbi8r Arial_BoldItalicMT <8r.enc <farbi8a.pfa marb8r Arial_BoldMT <8r.enc <farb8a.pfa marri8r Arial_ItalicMT <8r.enc <farri8a.pfa marr8rn Arial_Narrow <8r.enc <farr8an.pfa |
Try running latex on a document like this: \documentclass{article} \begin{document} \usefont{T1}{pga}{m}{n}\selectfont \huge Testing a new font \dots the quick red fox jumped over the lazy brown dogs \end{document} where you replace pga with the outline of your font. If this works, you are almost done. All you have to do now is put all the files in the right directories ( as explained in the primer ), then run texconfig rehash so that tex can update the directory lists.
You may want to create a .sty file so that you can more easily use fonts. Use the files in $TEXMF/tex/latex/psnfss as a template.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |