Previous Next TOC Index Feedback


Forty

Chapter


 

How to get fonts to Gimp

In this chapter you'll find some basic information about how to make fonts available to Gimp in Xwindows.

 

How fonts work in Gimp

All of the fonts you use in Gimp come from the X server. There is no internal font render in Gimp, so Gimp needs X to render the fonts. This is also the reason why the text tool dialog looks a bit like the xfontsel program in X.

Scalable fonts

First of all, use scalable fonts (Type 1 or Speedo) in Gimp. As you can tell from the name, these fonts can be scaled up and down without losing in quality. There are also bitmapped fonts in X. When you scale a bitmap font, it will lose its shape and get very jaggy and ugly.

Where are the fonts and font PATH

To find out where in your system X keeps its fonts, type: xset -q <enter> in a shell. The last line in the output tells your font path. If you are an XFree86 user, and use the default XF86 configuration, you have to make some editing to make sure that the Type 1 and Speedo font are the first to come up when X is looking for a certain font. It's very simple, just place the Speedo and Type 1 directories first in your Fontpath.

An other way is to add a string :unscaled after your bitmap fonts. If you add this string the scalable i.e the type 1 fonts will be used if you need to scale up or down your font. The font path in the XF86Config file may the look like this.(Note this may only work with XFree 86.)

Section "Files"
   RgbPath    "/usr/X11R6/lib/X11/rgb"
   FontPath   "/usr/X11R6/lib/X11/fonts/misc:unscaled"
   FontPath   "/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
   FontPath   "/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
   FontPath   "/usr/X11R6/lib/X11/fonts/MY_NEW_FONTS"
   FontPath   "/usr/X11R6/lib/X11/fonts/Type1"
   FontPath   "/usr/X11R6/lib/X11/fonts/Speedo"
   FontPath   "/usr/X11R6/lib/X11/fonts/misc"
   FontPath   "/usr/X11R6/lib/X11/fonts/75dpi"
   FontPath   "/usr/X11R6/lib/X11/fonts/100dpi"
EndSection

If you can stand that your fonts in Xwindow will look a bit odd, i.e when an unscaled font would normally be used, instead a scalable type 1 font will be used, then set all your type 1 fonts before the bitmap fonts.

To find out what kind of Type 1 fonts you have; change directory to the Type 1 dir, and read the fonts.dir file (e.g cd /usr/X11/lib/X11/fonts/Type1 && more fonts.dir) in a terminal window and all your available Type 1 fonts will be displayed. One of the most common reasons for a Script-Fu to fail, is that the specified Script-Fu font isn't available. This makes the script bug and there will be no output.

 

Installing fonts

Type 1 fonts installation & the type1inst program

We will only cover Type 1 fonts (postscript fonts) other font types are beyond the scope of this chapter. The first thing you have to do is to download a program called type1inst (written by James Macnicol) from ftp://sunsite.unc.edu/pub/Linux/X11/xutils or one of its mirrors.

Preparing for installation

At the time of this writing, the file is called type1inst-0.6.tar.gz. Unpack the program like you did with the Gimp archive (see Chapter 4). Copy the files type1inst and t1embed to a directory in your PATH, for example /usr/local/bin.

To see your PATH, execute the following in a shell: echo $PATH. If you aren't the system administrator, then you probably can't install files in system directories. To overcome this problem, create a bin directory in your home directory and install the type1inst program there. To include the program in your PATH, do the following if you run Bash, Sh or Ksh as your shell:

export PATH=$PATH:$HOME/bin

Copying the fonts to the fonts dir

Now copy The Type 1 fonts that you want to install in a directory of your own choice. A word of advise: If you have a large font collection, and you want easy font management in Gimp, install an xfontserver, or install the fonts in different directories with, say 20 fonts in each.

Font management

Here's how we manage fonts at Frozenriver: Karin needs a lot of fonts, but if you load all fonts into X and Gimp, it becomes hard to choose and find the right font. We have solved this by making different directories for each type of font, e.g we have one directory for artistic fonts and one for strict business fonts and so on. This makes it easy for Karin to load and unload the fonts depending on what she wants to do.

Running type1inst

When you have copied the fonts, cd to the directory where you installed the fonts, and run type1inst. This will create the necessary font.dir and font.scale file in this directory.

Loading the fonts into X

Now you can load the fonts into X by applying xset +fp full path to the font directory. The fonts are now installed and you can use them in Gimp, but if you installed them while you had Gimp running, you must restart Gimp.

Please notice that the + is placed in front of fp. If you put it in the wrong place, all the default font directories will be queried of the font name first, and if there is a font with the same name as yours this font will be used instead of your own.

The Helvetica font is a good example. The standard Helvetica font that comes with X is of quite poor quality, but if you download Acrobat Reader from Adobe, it will also include some new fonts including a very nice Helvetica font.

If you install these fonts with xset fp+ you will never see them, because the standard Helvetica font that comes with X, is placed in front of the font you installed when X is looking for its font directories. So make sure that you do it right, otherwise you will be wasting valuable fonts (and maybe money too).

Installing type 1 fonts by hand

It's not always possible to use the type1inst program. In that case, you'll have to do it the hard way and install the fonts.* files by hand.

The font file

Generally you have to load the fontfile to a text editor and look in the file header for name, type etc.... The header of the file ends with the eexec command, and everything after that is binary font data and of little interest. Note that you can only do this with ps font files. Such files normally end with .pfb and have %!PS-AdobeFont typed in the first line of the file.

The font field in the font file

The first thing you need to understand is how to code the font field in the font.scale file. Here is an example line:

Extracted pic [1]

Extracting data

All you have to do now is to load the pfb in a file editor (like vi file.pfb) in a terminal such as xterm, and search for data. Here's what to look for:

We know that this is probably not the best description of font decoding, but if we were to describe it in depth we could make a book out of it.

In the end of this chapter you'll find some tables that can help you with your decoding. They are taken from the source of the type1inst program.

Generally, you don't have to worry, because type1inst will make the job for you. But sometimes it will not get the Foundry information, and then you can take a look in the font file or the log file which type1inst creates. Most of the time, it's quite easy to figure out what's missing.

 

Tables

Foundry table

Company Foundry
Adobe adobe
Publishers Paradise paradise
Bigelow & Holmes b&h
Bitstream bitstream
International Typeface Corporation itc
IBM ibm
LETRASET letraset
Monotype Corporation monotype
SoftMaker softmaker
URW urw
Jonathan Brecher brecher
Brendel Informatik brendel
A. Carr carr
FontBank fontbank
Hershey hershey
A.S.Meit meit
Andrew s. Meit meit
S.G. Moye moye
D. Rakowski rakowski
David Rakowski rakowski
Reasonable Solutions reasonable
Southern Software southern
Title Wave titlewave
ZSoft zsoft

Weight table

Weights Weight
book book
demibold demibold
semibold demibold
demi demibold
semi demibold
extrabold extrabold
boldface bold
bold bold
heavyface heavyface
heavy heavy
ultrablack ultrablack
extrablack extrablack
ultra ultra
black black
extralight extralight
light light
thin thin
super super
normal medium
regular regular
roman regular

Slant table

Slants Slant
italic i
roman r
regular r
cursive i
kursiv i
oblique o
obl o
slanted o
upright r
inclined i

Set Width table

Widths Set Width
extracondensed extracondensed
condensed condensed
cond condensed
sans sans
wide wide
cn condensed
narrow narrow
extracompresse extracompresse
compressed compressed
extraextended extraextended
extended extended
expanded expanded
normal normal

Additional style table

Styles Style
alt alternate
beginning beginning
display display
dfr dfr
ending ending
ep expert
expert
ornaments ornaments
osf oldstylefigures
outline outline
sc smallcaps
shaded shaded
shadowed shadowed
stencil stencil
swash swash
sw swash
one one
two two
three three
four four
a alternate

 


The Gimp User Manual
Last modified: 20 May 1998

Previous Next TOC Index Feedback