~draft 1.1 as of 18-DEC-2002~
This small How-To describes how to use Postscript Type 1 fonts with the UNIX textformatting program groff and its helper applications. I will describe my own setup, which works for me and as always, your mileage may vary.
Assuming you have a Postscript Type 1 font file on your Apple Macintosh, you may wish to copy it on a netatalk volume, so you can access it easily on the UNIX side of life. Netatalk provides file server capabilites for Apple Macintosh computers. The data and the resource fork are stored separately on the UNIX side, where the resource fork is found in a hidden subdirectory called .AppleDouble
.
The following utilities are used in this process:
utility | package | purpose | download location |
---|---|---|---|
t1unmac | t1utils | to generate PFA files from a Type 1 resource fork | download |
pfa2afm | – | to generate probably missing AFM files from PFA files | download |
afmtodit | groff | to generate GROFF compatible font file out of the above files | download |
First we change our current working directory to groff’s prefix and step further into the font/devps
directory, where all files for the poscript device reside:
cd ${groff_prefix}/font/devps
which for example means on my system
cd /usr/share/groff/1.18.1/font/devps
Garamand Condensed (a type by SWFTE is used in this example)
/MacVol_01/Fonts/GaramConSWPla
/MacVol_01/Fonts/.AppleDouble/GaramConSWPla
t1unmac --appledouble --pfa \ /MacVol_01/Fonts/.AppleDouble/GaramConSWPla GaramConSWPla.pfa pfa2afm GaramConSWPla.pfa
We choose to make the type named “Garamand Condensed” available als “GCP” in groff:
afmtodit -d DESC -e text.enc \ GaramConSWPla.afm generate/textmap GCP
Now the type is ready to be used in groff, but if we want to print it on a postscript printer, we have to tell it that this font is downloadable. This is easily achieved by adding a line to the file “download”. We need to add a reference from the groff’s internal file name to the downloadable PFA font file:
echo -e "`grep "internalname" GCP | awk '{print $2}'`\tGaramConSWPla.pfa" \ >> download
You can reference the new font by “GCP” in groff, e.g. by using
.ft GCP This is Garamand Condensed
Sometimes Macintosh font files are stored with ^M
as their “line switching” character, especially if you have ready-to-use AFM files (adobe font metrics) enclosed with your Type 1 font files. If one of the programs above doesn’t produce a suitable output, you need to convert its input file by converting the “line switching” character. This is done by using tr
(“translate”):
cat inputfile | tr '\015' '\012' > outfile