Next
Previous
Contents
AFM font metrics files are not required for display existing
files with TrueType fonts, but they are necessary to create new files.
The ghostscript program /usr/lib/ghostscript/5.50/printafm.ps
could be used to generate these metric files, but I have found
the ttf2afm program from the tetex-bin package to be easier
to use.
The following script will generate an afm file for all TrueType
fonts in a directory:
#!/bin/sh
set -e
for i in *.TTF
do
/usr/bin/ttf2afm $i > ${i%TTF}afm
done
for i in *.ttf
do
/usr/bin/ttf2afm $i > ${i%ttf}afm
done
One minor problem with ttf2afm is that some applications expect
afm files to start with the StartFontMetrics tag, but
files created by ttf2afm start with a comment. This "problem"
is easily fixed by hitting each file with a text editor.
Once we have our afm files, we need to tell the system how to
find them. This is often done via the font.map file.
I have been unable to find documentation on this file format, unlike
fonts.dir , fonts.scale , and fonts.alias , all created by
the mkfontdir program. However the minimum format appears to
be quite simple:
- Font name, without whitespace
AFM filename, without extension
Aliases appear to be implemented via multiple entries, and the filename
extension must be in lowercase.
GIMP is the Gnu image manipulation and paint program. I did not
have to make any additional changes to use TrueType fonts in gimp .
Enscript is a program that converts ASCII to PostScript. Other
programs which serve a similiar purpose are a2ps and mpage .
Enscript allows two-up rotation, watermarks, headers, and
keyword-based syntax coloring. It does not reformat text and is
commonly used to print source listing.
To use TrueType fonts with enscript , you must do two things:
- Add
/usr/share/fonts/truetype to your AFMPath .
- Specify a TrueType font, either explicitly or by aliasing a
default font.
For details, see the enscript documentation.
Once I had made these changes, I had no problem using TrueType
fonts.
Groff is the Gnu front end of the groff/troff document
formatting system. The power of Groff is best seen with
man pages.
user shell
$ zcat /usr/man/man1/groff.1.gz | groff -man | lpr
Besides man pages, an incredible amount of Unix documentation
uses troff formatting with ms (and occasionally me )
macros. The Debian xbooks package, for example, has 43
files using troff with ms macros. With groff , this
material can be attractively printed.
Groff is a very powerful system, but it's the grandchild (or
great-grandchild) of a program used to typeset 1960's era printing
presses. Font support in groff reflects that heritage.
Groff , in contrast to its predecessors, uses PostScript as
the default output format so our earlier work with ghostscript
takes care of half of the problem -- groff does not have to
deal with reading TrueType font files. It does need to have
accurate font metrics, and this section describes how to regenerate
the necessary groff files:
Groff PostScript description files
/usr/share/groff/font/devps/DESC
Device description file
/usr/share/groff/font/devps/text.enc
Encoding used for text fonts
/usr/share/groff/font/devps/generate/textmap
Standard mapping.
/usr/share/groff/font/devps/generate/Makefile
Standard makefile
We must edit the Makefile,
/usr/share/groff/font/devps/generate/Makefile
- afmdir=/usr/local/afm
+ afmdir=/usr/share/fonts/truetype
change the name of the fonts to their TrueType equivalent (e.g.,
if we're using Microsoft's free TrueType fonts we would replace
Helvetica with Arial ), and change TEXTFONTS
and the like to only include those fonts we are redefining.
We must also edit /usr/share/groff/font/devps/generate/afmname
to use the TrueType font names and afm files, and to remove an
"-e" flag from awk .
After all of this, we can rebuild the groff tables with
user shell
$ cd /usr/share/groff/font/devps
$ make -f generate/Makefile
As usual, the best way to verify the changes is to use a visually
distinctive font. E.g., if you are using the Microsoft free TrueType
fonts you can use Mistral for TR .
(I expect royalties from everyone who reconfigures their system to
print manual pages in Old English fonts next April First!)
TeX is the other common set of text formatting and typesetting
programs on most GNU/Linux systems.
TeX fonts can created with mktexmf , but I have little
information on the exact process. More details will be provided shortly.
Next
Previous
Contents
|