|Concepts||User's Guide||User Scripting|
Fonts are a somewhat complex matter in Linux and X. Sketch's main output format for printing is PostScript. Because of that, Sketch identifies fonts with their PostScript names and must know how to get the appropriate metrics (these tell Sketch how to place the individual letters for instance) and it must know X's name for the font (to be able to show the text on the screen appropriately).
The information Sketch needs to map the PostScript names to metric-filenames (.afm-files) and X font names is stored in .sfd-files.
An sfd-file maps font names to the filenames of the
to various font attributes like weight and width and to two strings that
are used to build the font name for X.
For example, the line concerning the Courier font in
Courier, ... ,-adobe-Courier-medium-r-normal,iso8859-1,pcrr8a
This tells Sketch that the metrics file is
pcrr8a.afm and that
the first part of the font name is
and its last part is
iso8859-1. The parts missing from the font
name describe the size and transformation and are automatically filled
in by Sketch. Sketch assumes that fonts can be arbitrarily scaled
and transformed. (The XFree servers often used on Linux have this
capability; other servers on other platforms may not)
If the font is not installed in the server (either the X-server or the font server), or if it is installed under a different name, Sketch will not be able to display the text.
On start-up, Sketch reads all sfd-files it finds in the directories listed in its font-path.
Sketch maintains a list of directories where it searches for font-related files like sfd-files and metrics. Note that this is a sketch-specific font-path and has nothing to do with X's font-path.
By default (as of version 0.6.2) the font-path consists of the
Resources/Fontmetrics (relative to where Sketch is
If you need to add directories or otherwise modify the font-path, you
can do so in Sketch's start-up file,
which is executed by Sketch if it exists. E.g. to add a directory to
the font-path you could put this code into
from Sketch import config config.font_path.append('/usr/local/share/fonts/bitstream')
If you install new Type 1 fonts on your system for use with Sketch, you have to make them available to X and you have to create an sfd-file for Sketch.
The X-specific part of this is described in the usual man-pages, like
mkfontdir(1) (for the format of
xset(1) (for ways to change the fontpath at
Xserver(1) (for general information about the X server,
including fonts) and
XF86Config(5) (for the default configuration
To help with the installation, Sketch comes with a script, mkfontdb.py, that can create both Sketch's sfd-files and X's fonts.scale files. In my opinion it's a good idea to generate both files with mkfontdb.py to make sure the X-font-names in both files match, because Sketch won't be able to display the fonts otherwise.
The easiest way to use mkfontdb.py is:
When invoked like this, mkfontdb.py reads the afm-files in the directory
<dir> and creates the two files
in the current directory. For more information about the command line
options run 'mkfontdb.py -h'.
A good way to install new Type 1 fonts on a Linux-system, in my opinion,
is to put the files (pfb/pfa and afm) into a separate directory, e.g.
/usr/local/share/fonts and create
fonts.scale and an sfd
file in that directory, and append it to X's font-path and Sketch's
To use the standard PostScript fonts, I recommend installing the appropriate Type1 fonts from the Ghostscript distribution. They are high quality fonts and distributed under the GPL.
The following suggestions and instructions are mainly for XFree86. I don't know in how far these are applicable to other X-servers or other platforms than Linux.
WARNING: The following instructions describe how to change the configuration files of XFree86. Be careful and make backup copies of the files you modify so you can restore them if something goes wrong.
Copy or symlink the necessary files from Ghostscript's
/usr/X11R6/lib/X11/fonts/Type1/ (or wherever you
have X). On my system this can be done from the
$ ln -s /usr/share/ghostscript/fonts/*l.pfb .
Append the file
The first line in the latter file contains a single number. This is the
number of fonts listed in that file. Update that number to reflect the
changes (if there are no blank lines or comments, this number is the
number of lines minus 1)
You may have noticed that the font names used in
Doc/fonts.scale don't match the ones in in
The reason for this is that fonts you have just installed aren't the
original adobe PostScript fonts. Instead, they were contributed to
ghostscript by a company called URW. To use the standard PostScript
names to refer to these fonts, append
/usr/X11/lib/X11/fonts/misc/fonts.alias. There is no number to
Doc/fonts.scale lists Ghostscript's fonts with their
own name and not with the name of the Adobe fonts they can replace. The
Doc/fonts.alias maps the adobe names to these real names.
Now you have to run mkfontdir(1) to update the font database:
If your X-server is running already you have to tell it to reread the font databases with xset(1):
$ xset fp rehash
|Concepts||User's Guide||User Scripting|