Prev Up Next
Configuration Configuration User Scripting

Fonts

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

To this end, Sketch comes with the metrics for a variety of standard PostScript fonts (.afm-files) and a configuration file (std.sfd). These files are in the Resources/Fontmetrics subdirectory.

std.sfd maps font names to the filenames of the afm-files and 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 is:

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 -adobe-Courier-medium-r-normal 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.

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.

The instructions below describe just one way to do it. For general information on installing fonts have a look at the man pages for mkfontdir(1) (for the format of fonts.scale and fonts.alias), xset(1) (for ways to change the fontpath at runtime), Xserver(1) (for general information about the X server, including fonts) and XF86Config(5) (for the default configuration of XFree86).

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.

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.

Copy or symlink the necessary files from Ghostscript's fonts directory to /usr/X11R6/lib/X11/fonts/Type1/ (or wherever you have X). On my system this can be done from the Type1 directory with:

$ ln -s /usr/share/ghostscript/fonts/*l.pfb .

Append the file Doc/fonts.scale to Type1/fonts.scale. 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 std.sfd. 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 Doc/fonts.alias to /usr/X11/lib/X11/fonts/misc/fonts.alias. There is no number to update here.

The file Doc/fonts.scale lists Ghostscript's fonts with their own name and not with the name of the Adobe fonts they can replace. The file Doc/fonts.alias maps the adobe names to these real names.

Now you have to run mkfontdir(1) to update the font database:

$ mkfontdir

If your X-server is running already you have to tell it to reread the font databases with xset(1):

$ xset fp rehash


Configuration Configuration User Scripting
Prev Up Next