Most of the procedure is identical to the one I outlined in my answer concerning type1 fonts. Here, I will focus only on the additional complications involved in dealing with TTF fonts. I will ignore some rarer complications which do not apply to most cases and focus on only the standard complications.
You have two choices.
Option 1
Convert the font to type1 format and then proceed as described in the other answer.
Advantages:
- works with the traditional TeX engine;
- fewer complications involved in preparing the support files: you deal with one complication (conversion) and you are done.
Disadvantages:
- conversion inevitably involves some loss of quality, as I understand it, since the two font formats specify curves in different ways;
- the font licence may not permit conversion.
Various tools are available to perform the conversion. FontForge is probably the most obvious example. If the font is suitable, you could alternatively use autoinst
to convert it, prepare most of the required files and install it. I'm not very keen on autoinst
and friends myself, but this method is probably more popular than the fontinst
route because it is more automatic.
Option 2
Use the truetype font without converting to type1.
Advantages:
- no loss of quality;
- compatible with more font licences, although possibly not all.
Disadvantages:
- cannot be used with traditional TeX, but requires pdfTeX;
- somewhat more complex because adjustments are needed at various points in the installation process.
To use this method, I would normally begin by doing the following:
- rename the files appropriately;
- use
ttf2afm
to produce an AFM file for each TTF.
Normally, this is straightforward. Very occasionally, there are complications. ttf2afm
might complain, for example, that it cannot accommodate all kerning pairs. There isn't much you can do about this and I'd just carry on. If you get more serious problems, you can try using FontForge to produce AFMs, but more serious errors usually means that the TTF is so poorly designed that the font is hopeless and it is better to quit before sinking more time into it.
Then proceed with the fontinst
process as before with the following changes:
XYZ-map.tex
should be adjusted as follows:
\input finstmsc.sty
\resetstr{PSfontsuffix}{.ttf}
\adddriver{dvips}{XYZ.map}
\adddriver{pltotf}{XYZ-pltotf.sh}
\input XYZ-rec.tex
\donedrivers
\bye
where XYZ
is the prefix you're using (e.g. sck
in the linked example).
XYZ.sty
should be adjusted as follows:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{XYZ}[2016/06/21 v1.0 XYZ]
%%We don't want to add the map file through updmap because only pdftex can use truetype fonts.
\pdfmapfile{+XYZ.map}
\DeclareOption{default}{%
\renewcommand{\sfdefault}{XYZ}}
\ProcessOptions
\DeclareRobustCommand{\XYZfamily}{%
\fontseries{m}%
\fontshape{n}%
\fontfamily{XYZ}%
\selectfont}
\DeclareTextFontCommand{\XYZ}{\XYZfamily}
\endinput
Proceed to test the font, deleting \pdfmapfile{+XYZ.map}
from the test document since it is included in the package file.
If all is well, install the font as for type1 with the following changes:
replace
mkdir -p <TEXMFLOCAL>/fonts/type1/public/XYZ
with
mkdir -p <TEXMFLOCAL>/fonts/truetype/public/XYZ
and
mv *.pfb *.pfm <TEXMFLOCAL>/fonts/type1/public/XYZ/
with
mv *.ttf <TEXMFLOCAL>/fonts/truetype/public/XYZ/
do NOT run updmap-sys
!!
Retest.
The idea here is to avoid including the font in the mappings used by TeX because the font will not work with the traditional engine. Instead, the mappings are added when the package is loaded in a way which is specific to pdfTeX. If the traditional engine is used, this will generate an error complaining of an undefined control sequence including the string pdf
which should make it easy to diagnose the problem.