Harald Harders (mailto:h.harders@tu-bs.de)
2000-05-12
Strictly speaking this document doesn't describe how to use TrueType fonts with teTEX but how to convert TrueType fonts to PostScript Type 1 format which can be used with TEX.
If I have made any errors or if you have a suggestion please mail it to me.
I don't know if the shown conversion violates any copyrights.
A postscript version and an acrobat reader version are also available.
As an example I will show how to convert the font ``VAG Rounded BT'' which
is part of Microsoft Windows 98 (tt0756m_.TTF
).
First copy the fonts you want to convert into a temporary directory (e.g. a Windows disk is mounted on /dos/c):
Then rename the files to a name conforming the fontname scheme by K. Berry [Ber99]. In this case the supplier is ``Bitstream'' (Filename$ mkdir ~/ttf
$ cp /dos/c/windows/fonts/tt0756m_.TTF ~/ttf
b*******.ttf
)1. The Shortcut for the typeface is ``vr'' (Filename
*vr*****.ttf
) taken from [Ber99]. The weight is
``regular'' (Filename ***r****.ttf
). The variant is omitted
because itself and the width are normal. The encoding is set to ``8a''
which means Adobe standard encoding2 (Filename ****8a**.ttf
). Because the
width is standard and the font is linearly scaled, these parts of the
filename are omitted. Finaly the filename results in bvrr8a.ttf
. Move
the original file to this filename:
$ mv tt0756m_.TTF bvrr8a.ttf
A more detailed description on the naming conventions can be found in
[Ber99].
To convert the TrueType font to Postscript Type 1 format I used the program
ttf2pt1
by Andrew Weeks et al.
(http://www.netspace.net.au/~mheath/ttf2pt1/). Generate the font files
bvrr8a.afm
, bvrr8a.pfa
, and bvrr8a.pfb
by using
these commands:
In one of the last lines of the output the fontname is noted:$ ttf2pt1 -e bvrr8a.ttf bvrr8a
$ ttf2pt1 -b bvrr8a.ttf bvrr8a
FontName VAGRoundedBT_Regular
Note the name on a sheet of paper--You will need it later again.
The script
ttf2type1
does these conversion automaticaly for all files with
the extension ttf
in the present working directory. To get the
font names you should start it as follows:
$ ./ttf2type1 2>&1 | grep FontName
Use ``fontinst'' by Alan Jeffrey and Rowland McDonnell (ftp://ftp.tex.ac.uk/tex-archive/fonts/utilities/fontinst) to generate the files that TEX needs to use the fonts:
If you use fonts with different variants you have to append the letter of the variant to the family name of the font (E.g. VAGRoundedBT_Condensed would be bvrc). Now use pltotf on every file with the extension$ tex fontinst.sty
* \latinfamily{bvr}{} \bye
.pl
and
vptovf on all files with the extension .vpl
:
Now you may delete all files that are not used anymore:$ for a in *.pl; do pltotf $a; done
$ for a in *.vpl; do vptovf $a; done
$ rm *.pl *.vpl *.mtx
The manual of the fontinst package includes a better description.
Now all files have to be moved to a position where TEX can find them. I
suggest to put them in the TEXMFLOCAL
tree.
One possibility to get its location is to view the file texmf.cnf
.
You can locate it by using kpsewhich
:
$ kpsewhich texmf.cnf
E.g. on SuSE 6.2 and teTEX 1.0 texmf.cnf
is located in the directory
/etc/texmf/
.
Another possibility to get TEXMFLOCAL
is to use kpsexpand
:
$ kpsexpand '$TEXMFLOCAL'
On my computer the TEXMFLOCAL
tree starts at
/usr/local/share/texmf
. The TEXMFMAIN
tree starts at
/usr/share/texmf
.
The files of each file type are installed in an own directory tree which has this structure:
In this case:TEXMFLOCAL/fonts/
<extension>/
<supplier>/
<fontname>/
The extensions are:/usr/local/share/texmf/fonts/
<extension>/bitstream/vagrounded/
tfm
, vf
, pfa
, pfb
,
afm
, and ttf
. Copy the files by typing:
You do not really need to copy the$ for a in tfm vf pfa pfb afm ttf; do
> mkdirhier /usr/local/share/texmf/fonts/$a/bitstream/vagrounded;
> mv *.$a /usr/local/share/texmf/fonts/$a/bitstream/vagrounded;
> done
ttf
and pfa
files
into the directory because TEX does not use them.
I just did it to be sure that they don't get lost, if I need them for
other purposes later.
Move the *.fd
files to the directory
TEXMFLOCAL/tex/latex/psnfss/
:
$ mkdirhier /usr/local/share/texmf/tex/latex/psnfss
$ mv *.fd /usr/local/share/texmf/tex/latex/psnfss
There are at least two possibilities to make dvips find the new font. The first has a simple installation but it' usage is a little bit more complicated and it does not enable xdvi to use the font. The second possibility has a more complicated installation and may leed to problems when updating LATEX later. But it enables xdvi to use the new fonts.
Create the file TEXMFLOCAL/dvips/config/config.vagrounded with these contents:
Create the file TEXMFLOCAL/dvips/config/vagrounded.map with these contents (each font definition in one single line):o
p +vagrounded.map
The first item is the filename of the TrueType font with ``8r'' instead of ``8a''. The second item is the font name you held in mind, hopefully. The next items are the same all times. The last one is the filename of the TrueType font with the extensionbvrr8r VAGRoundedBT_Regular
"TeXBase1Encoding ReEncodeFont" <8r.enc <bvrr8a.pfb
bvrr8r VAGRoundedBT_Regular
"0.167 SlantFont TeXBase1Encoding ReEncodeFont"
<8r.enc <bvrr8a.pfb
.pfb
.
In the second line the slanted shape of the font is defined. The fontinst package generates slanted, italic and small capital shapes of the font automatically if no special font file is available. To use the generated slanted shape the second line is necessary.
Additional font effects can be reached by using afm2tfm. Type
$ info afm2tfm
and go to the section ``Special font effects'' (This was a tip of
Thomas Henlich (mailto:henlich@mmers1.mw.tu-dresden.de)).
Finaly type
$ texhash
to update the TEX file database.
This technique was suggested by Nguyên-Dai Quý (mailto:daiquy.nguyen@ulg.ac.be) [Quý00]. Here again two possibilities are available:
TEXMFMAIN/dvips/config/psfonts.map
to local
directory TEXMFLOCAL/dvips/config
and append the contents of
the file
TEXMFLOCAL/dvips/config/vagrounded.map
to the
new file:
$ cat /usr/share/texmf/dvips/config/psfonts.map \
/usr/local/share/texmf/dvips/config/vagrounded.map \
> /usr/local/share/texmf/dvips/config/psfonts.map
updmap
that is located in
TEXMFMAIN/dvips/config
. Copy it to
TEXMFLOCAL/dvips/config/localupdmap
and edit it.
Insert the lines
before the ``Configuration section''. Insert###############################################
# locate the map files of the TEXMFMAIN tree
###############################################
KPSEMAIN=`kpsexpand '$TEXMFMAIN'`
DVIPSCONFIG=$KPSEMAIN/dvips/config
$DVIPSCONFIG/
at the beginning of every filename ending on .map
in the
file: E.g. charter.map
$DVIPSCONFIG/charter.map
. On 2000-04-12 I wrote this change as a suggestion to Thomas
Esser. So hopefully this isn't necessary anymore in one of the next
releases of teTEX.
Edit the extra_modules
entry in the file localupdmap
and add the filename of the new map file (vagrounded.map
):
As an example you can download my own localupdmap. But don't use my version of this file because the original file of your teTEX distribution may be different from mine.extra_modules="
vagrounded.map
"
Now, run localupdmap
:
$ cd /usr/local/share/texmf/dvips/config
$ ./localupdmap
Finaly type
$ texhash
to update the TEX file database.
These solutions have one big problem. When you install a new version of
teTEX probably the file TEXMFMAIN/dvips/config/psfonts.map
will
change so that your version TEXMFLOCAL/dvips/config/psfonts.map
will be out of date. Then you will have to redo the procedure of the section.
To use the new font you simple have to insert
\renewcommand{\rmdefault}{bvr}\rmfamily
into you TEX sourcecode. For example sample.tex
It is more elegant to create an new style file that switches to your new font. The style file vagrounded.sty is an example how this can be done.\documentclass{article}
\begin{document}
\renewcommand{\rmdefault}{bvr}\rmfamily
\noindent Hello, I am VAG Rounded BT
{\slshape Hello, I am VAG Rounded BT slanted}\\
{\scshape Hello, I am VAG Rounded BT small capitals}\\
\end{document}
\ProvidesPackage{vagrounded}
[2000/05/12 VAG-Rounded font as default sf font]
%%
\renewcommand{\sfdefault}{bvr}
%%
\AtEndDocument{\PackageWarningNoLine{vagrounded.sty}%
{Ensure to use dvips with the option -Pvagrounded}}
%%
If you have not included the mapping entries to the file
psfonts.map
(section ) you also have to tell
dvips that it should use the font:
This should produce the PostScript file sample.ps which looks like figure .$ latex sample
$ dvips -Pvagrounded sample
Nguyên-Dai Quý has complained that the fontnames contain the
underscore (_
) instead of the minus (-
). I have not been
able to find out whether this causes problems using the fonts. But I
also know that nobody uses fonts with an underscore in the name. So I
should find out whether the underscores may cause problems e.g. when
including eps files which use these fonts (e.q. from Adobe Illustrator).
Nguyên-Dai Quý has written a script that does all or most of the conversion automatically [Quý00]. It is available from http://iris.ltas.ulg.ac.be/viettug/contrib/q/. This script also replaces the underscores by minuses in the fontnames.
This document was generated using the LaTeX2HTML translator Version 99.2beta6 (1.42)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 -show_section_numbers -no_navigation -image_type gif -dir html/ ttf-tetex
The translation was initiated by Harald Harders on 2000-05-12
b*******.ttf
)1