Tgif FAQ - Adding Free Fonts
I've downloaded the free
Dingbests font (Windows PostScript) from
Can tgif use it?
Sure! First of all, make sure you've downloaded the Windows
PostScript version of the font (the file name is wint1.zip).
Please try the following.
- Unzip the zip file:
You should get:
- If you don't have your own X11 fonts directory, create something
cp dingbest.pfb ~/lib/X11/fonts/
xset fp+ ~/lib/X11/fonts/
If you already have your own X11 fonts directory (look for the
Font Path entry when you do xset -q), just copy the
dingbest.pfb file into it.
Append the following line into the fonts.dir file in
yoru X11 fonts directory:
dingbest.pfb -ff-ff dingbests-
(Please note that the above should be in a single line with no space
between the last - character in the first line and the
medium in the second line.)
Increment the number in the first line of the fonts.dir file.
- Add the following X default:
At this point, tgif should be able to use the FF Dingbests font.
However, there's still a problem. When you generate a PostScript
file with FF Dingbests text, the PostScript file doesn't look right
in ghostscript. This is because your ghostscript doesn't know
about the FFDingbests font, yet. Please try the following.
- If you don't have your own ghostscript directory, create something
cp dingbest.AFM ~/lib/ghostscript/fonts/dingbest.afm
cp dingbest.pfb ~/lib/ghostscript/fonts/dingbest.pfb
cp dingbest.PFM ~/lib/ghostscript/fonts/dingbest.pfm
Create ~/lib/ghostscript/fonts/Fontmap with the following
line in it:
/FFDingbests (dingbest.pfb) ;
(The space above should be <TAB> characters, but I'm not sure if
- Do the following in csh (and add it to your ~/.cshrc) or something
equivalent if you use another shell.
setenv GS_FONTPATH ~/lib/ghostscript/fonts
Now you should be able to view the PostScript file with ghostscript
comes with these
free fonts (e.g.,
How can tgif use them?
Let's start from scratch. Rename your ~/.Xdefaults file and start
with an empty one. There's a Victoria's Secret font in
freefonts-0.10, the example below will illustrate how to make
tgif use it. You can repeat the process for other fonts.
The example below also assume that you are running
ghostscript 5.50. Working with newer version of ghostscript may
require slight modifications. Let's also assume that the freefonts
will be placed in ~/lib/fonts/freefont.
- Unpack and install freefonts. The last line below creates a new
Fontmap file with a single line in it. It maps the PostScript
font name VictoriasSecret to the font file victoria.pfb.
gunzip -c ~/freefonts-0.10.tar.gz | tar xvf -
mv Fontmap Fontmap.old
cat > Fontmap
/VictoriasSecret (victoria.pfb) ;
- Make ghostscript and X aware of the new fonts. Ghostscript 5.50
uses the GS_LIB environment variable and ghostscript 6.01
uses the GS_FONTPATH environment variable.
xset fp+ ~/lib/fonts/freefont/
setenv GS_LIB ~/lib/fonts/freefont
setenv GS_FONTPATH ~/lib/fonts/freefont
- Let's see if X can see the Victoria's Secret X font now. Do:
xlsfonts | grep victoria
You should see:
If you don't see the above output, there may be something wrong with
your X environment.
- Let's see if ghostscript can see the Victoria's Secret PostScript font
now. In an xterm, do:
GS> 200 200 moveto
GS> /VictoriasSecret findfont [48 0 0 -48 0 0] makefont setfont
GS> (Hello) show
The word Hello would be shown up-side-down, but that's expected.
If Hello is not shown in Victoria's Secret font, either this
procedure is not compatible with the ghostscript you have, or there's
something wrong with your ghostscript setup.
- Now, let's make tgif use the Victoria's Secret font. We will use the
Tgif.AdditionalFonts X default. Recall that you will
need 4 lines for each font in tgif. One for the Roman style,
one for the Bold style, one for the Italic style, and one for
the BoldItalic style.
Since there's only one Victoria's Secret X font, we should make
all these 4 lines the same.
Each line in Tgif.AdditionalFonts has 3 parts that
are separated by commas.
- The 1st part is the family-weight-slant-sWidth, which would be
victoriassecret-normal-r-normal here (please notice that
freefont is the font foundary).
- The 2nd part is the registry-encoding, which would be
- The 3rd part is the name of the corresponding PostScript font,
which would be VictoriasSecret here.
Put it all together, we would add the following lines to an empty
If your X environment requires you to run xrdb, do:
- It's time to test this. Run tgif. You should see VictoriasSecret
in tgif's Font Menu. Select it and create a text object with
large font size in this font.
Save the file and export/print it in PS format. View the
generated PS file with ghostscript.