Now that the new font can be used by both X11 and Ghostscript, how can one use the new font with groff? First of all, since we are dealing with type 1 PostScript® fonts, the groff device that is applicable is the ps device. A font file must be created for each font that groff can use. A groff font name is just a file in /usr/share/groff_font/devps. With our example, the font file could be /usr/share/groff_font/devps/SHOWBOAT. The file must be created using tools provided by groff.
The first tool is afmtodit. This is not normally installed, so it must be retrieved from the source distribution. I found I had to change the first line of the file, so I did:
% cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp % ex /tmp/afmtodit.pl :1c #!/usr/bin/perl -P- . :wq
This tool will create the groff font file from the metrics file (.afm suffix.) Continuing with our example:
Many .afm files are in Mac format... ^M delimited lines
We need to convert them to UNIX® style ^J delimited lines
% cd /tmp
% cat /usr/local/share/fonts/type1/showboat.afm |
tr '\015' '\012' >showboat.afm
Now create the groff font file
% cd /usr/share/groff_font/devps
% /tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT
The font can now be referenced with the name SHOWBOAT.
If Ghostscript is used to drive the printers on the system, then nothing more needs to be done. However, if true PostScript printers are used, then the font must be down loaded to the printer in order for the font to be used (unless the printer happens to have the showboat font built in or on an accessible font disk.) The final step is to create a down loadable font. The pfbtops tool is used to create the .pfa format of the font, and the download file is modified to reference the new font. The download file must reference the internal name of the font. This can easily be determined from the groff font file as illustrated:
Of course, if the .pfa file is already available, just use a symbolic link to reference it.
Get the internal font name % fgrep internalname SHOWBOAT internalname Showboat Tell groff that the font must be down loaded % ex download :$a Showboat showboat.pfa . :wq
To test the font:
% cd /tmp % cat >example.t <<EOF .sp 5 .ps 16 This is an example of the Showboat font: .br .ps 48 .vs (\n(.s+2)p .sp .ft SHOWBOAT ABCDEFGHI .br JKLMNOPQR .br STUVWXYZ .sp .ps 16 .vs (\n(.s+2)p .fp 5 SHOWBOAT .ft R To use it for the first letter of a paragraph, it will look like: .sp 50p \s(48\f5H\s0\fRere is the first sentence of a paragraph that uses the showboat font as its first letter. Additional vertical space must be used to allow room for the larger letter. EOF % groff -Tps example.t >example.ps To use ghostscript/ghostview % ghostview example.ps To print it % lpr -Ppostscript example.ps
References: /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man, groff_font(5), groff_char(7), pfbtops(1).
Prev | Home | Next |
Using type 1 fonts with Ghostscript | Converting TrueType fonts to a groff/PostScript format for groff |
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.