Converting TrueType fonts for use with LaTeX.

The following script is based on the guide Using TrueType fonts with teTEX and dvips by Harald Harders.

Do not run this script! Copy and paste parts into a root terminal after carefully editing it.

Hopefully it is fairly clear what to do:

  1. Edit the ttf2pt1 section to make the appropriate LaTeX fonts. You need to work out the correct(ish) LaTeX names for the fonts.
  2. Add the right stuff to the map file!

This seems not to work for .TTF files from Windows.


#C O N F I G



# S C R I P T

# Convert ttf to LaTeX
# Use fondu to extract the dfont to separate ttf s
../fondu/fondu Optima.dfont

# the a flag includes vital things like ligatures.
../ttf2pt1/ttf2pt1 -a -e OptimaRegular.ttf lopr8a  # pfa
../ttf2pt1/ttf2pt1 -a -b OptimaRegular.ttf lopr8a  # pfb

../ttf2pt1/ttf2pt1 -a -e OptimaItalic.ttf lopri8a  # pfa
../ttf2pt1/ttf2pt1 -a -b OptimaItalic.ttf lopri8a  # pfb

../ttf2pt1/ttf2pt1 -a -e OptimaBold.ttf lopb8a  # pfa
../ttf2pt1/ttf2pt1 -a -b OptimaBold.ttf lopb8a  # pfb

../ttf2pt1/ttf2pt1 -a -e OptimaBoldItalic.ttf lopbi8a  # pfa
../ttf2pt1/ttf2pt1 -a -b OptimaBoldItalic.ttf lopbi8a  # pfb

../ttf2pt1/ttf2pt1 -a -e OptimaExtraBlack.ttf lopx8a  # pfa
../ttf2pt1/ttf2pt1 -a -b OptimaExtraBlack.ttf lopx8a  # pfb

echo "Now running tex `kpsewhich fontinst.sty`"
echo "At the * prompt enter \latinfamily{$texName}{}\bye"

tex `kpsewhich fontinst.sty`

for a in *.pl; do pltotf $a; done
for a in *.vpl; do vptovf $a; done

rm *.pl *.mtx *.vpl

# move the needed files

mkdir -p $texmf/fonts/{type1,vf,tfm,afm}/linotype/$fullName

mv *.pfa $texmf/fonts/type1/linotype/$fullName
mv *.pfb $texmf/fonts/type1/linotype/$fullName
mv *.vf $texmf/fonts/vf/linotype/$fullName
mv *.tfm $texmf/fonts/tfm/linotype/$fullName

mv *.fd $texmf/tex/latex/psnfss/

sudo find $texmf/ -user rwb -exec chown root:root {} \;

# M A P S
mkdir -p $texmf/fonts/map/dvips/$fullName
touch $texmf/fonts/map/dvips/$fullName/$

# add to this file:
# lopr8r Optima-Regular "TeXBase1Encoding ReEncodeFont" <8r.enc <lopr8a.pfb
# lopri8r Optima-Italic "TeXBase1Encoding ReEncodeFont" <8r.enc <lopri8a.pfb
# lopb8r Gill-Bold "TeXBase1Encoding ReEncodeFont" <8r.enc <lopb8a.pfb
# lopbi8r Optima-BoldItalic "TeXBase1Encoding ReEncodeFont" <8r.enc <lopbi8a.pfb
# lopx8r Optima-ExtraBlack "TeXBase1Encoding ReEncodeFont" <8r.enc <lopx8a.pfb

mkdir -p $texmf/dvips/$fullName
touch $texmf/dvips/$fullName/config.$texName
# add to this file:
# o
# p

touch /etc/texmf/updmap.d/10local.cfg
# add
# Map /sw/share/texmf-local/dvips/config/