Tgif Home
----
About Tgif
Current Release & Download
FAQ
Copyright Info
A Screendump of Tgif
Release History
Tools That Tgif Uses
Tools That Work with Tgif
Author of Tgif
Miscellaneous Info
----
 
Return to Tgif's Home Page
William Chia-Wei Cheng
(bill.cheng@usc.edu)
 

Tgif FAQ - Adding Free Fonts

 
I've downloaded the free Dingbests font (Windows PostScript) from FontFont. 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.

  1. Unzip the zip file:
        unzip wint1.zip

    You should get:

        dingbest.AFM
        dingbest.pfb
        dingbest.INF
        dingbest.PFM

  2. If you don't have your own X11 fonts directory, create something like:
        ~/lib/X11/fonts/

    Then do:

        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-
        medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
    

    (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.

  3. Add the following X default:

    Tgif.AdditionalFonts: \n\
        ff dingbests-medium-r-normal,adobe-fontspecific,FFDingbests\n\
        ff dingbests-medium-r-normal,adobe-fontspecific,FFDingbests\n\
        ff dingbests-medium-r-normal,adobe-fontspecific,FFDingbests\n\
        ff dingbests-medium-r-normal,adobe-fontspecific,FFDingbests
    
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.

  1. If you don't have your own ghostscript directory, create something like:
        ~/lib/ghostscript/fonts/

    Then do:

        cp dingbest.AFM ~/lib/ghostscript/fonts/dingbest.afm
        cp dingbest.pfb ~/lib/ghostscript/fonts/dingbest.pfb
        cp dingbest.PFM ~/lib/ghostscript/fonts/dingbest.pfm

  2. 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 that matters.)

  3. 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 or ghostview.
Gimp comes with these free fonts (e.g., freefonts-0.10.tar.gz). 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.

  1. 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.
        cd ~/lib/fonts
        gunzip -c ~/freefonts-0.10.tar.gz | tar xvf -
        cd freefont
        mv Fontmap Fontmap.old
        cat > Fontmap
            /VictoriasSecret (victoria.pfb) ;

  2. 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

  3. Let's see if X can see the Victoria's Secret X font now. Do:
        xlsfonts | grep victoria

    You should see:

        -freefont-victoriassecret-normal-r-normal--0-0-0-0-p-0-iso8859-1

    If you don't see the above output, there may be something wrong with your X environment.

  4. Let's see if ghostscript can see the Victoria's Secret PostScript font now. In an xterm, do:
        gs
    
        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.

  5. 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 iso8859-1 here.
    • 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 ~/.Xdefaults file:

        Tgif.AdditionalFonts: \n\
            victoriassecret-normal-r-normal,iso8859-1,VictoriasSecret\n\
            victoriassecret-normal-r-normal,iso8859-1,VictoriasSecret\n\
            victoriassecret-normal-r-normal,iso8859-1,VictoriasSecret\n\
            victoriassecret-normal-r-normal,iso8859-1,VictoriasSecret

    If your X environment requires you to run xrdb, do:

        xrdb ~/.Xdefault

  6. 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.