up

Unix/X font stuff

xlfd: X Logical Font Descriptions

The X Window System uses Logical Font Descriptions instead of font names. Since font names are not in fact logical, this doesn't work very well, and frankly ends up in a mess. None the less, if you download this short shell script, xlfd, and run chmod +x xlfd, you can use it to list fonts.

If you run xlfd -help you'll see this:

    xlfd: X11 logical font description (XLFD) manipulation
    usage: xlfd [options] command [...]
    Commands are:
        help -- prints this summary; -usage prints a shorter version.
        print -- print the corresponding XLFD pattern
        echo -- like print, but includes program options such as -bg.
        xlsfonts, xfd, xfontsel -- runs the coresponding program

    Options to specify Font Properties:
    
foundry name(e.g. bitstream)
family name(e.g. charter)
weight w(e.g. bold, medium)
slant spec(r i or o for roman/italic/oblique)
setwidth name(normal, condensed, etc.)
addedstyle name(serif, sans, '' for none)
pixelsz N(normally leave this as *) [also: pixelsize]
pointsize N(font size in units of 1/727.2 of an inch, e.g. 120)
resx N(x dots per inch, horizontal screen resolution)
resy N(y dots per inch, vertical screen resolution)
res(sets both x and y res, e.g. -res 100)
space name(m = monospaced, p = proportional, c = cell)
averagewidth N(average character width in pixels)
registry rrr(usually iso8859 or adobe)
encoding name(usually 1 or 2 (for iso8859) or fontspecific)
charset rrr-enc (sets both registry and encoding, e.g. iso8859-1)

    Program Options:
        -bg colourspec; -fg colourspec; -title ttl; -xrm res -option '-yyy zzz' 
        -geom[etry] geomspec
        -class name; -name name

    The font pattern right now is:
        -*-*-*-*-*-*-*-*-*-*-*-*-*-*
    

TrueType and PostScript fonts on X

If you want to use outline fonts on X, you will need a version of X that supports them. That includes all versions of OpenWindows, X11R5, recent versions of XF86, and some others.

There are three ways taht outline fonts might be supported.

  1. dierctly by the X server;
  2. using an external font server;
  3. using loadable X modules (e.g. OpenWindows can do this).

If you are using a font server, xfstt is a popular one. Install that (e.g. with addpkg or using /usr/ports on FreeBSD), and see the readme file.

The usual steps for setting up an X font server are as follows:

  1. Install the font server if necessary.
  2. Edit the xfs.conf file that comes with it. Here is a sample:
    clone-self = off
    use-syslog = off
    
    client-limit = 20
    catalogue = /home/lee/lib/ttfonts
    
    error-file = /tmp/ttfs.errors
    # in decipoints
    default-point-size = 140
    # x,y
    default-resolutions = 100,100,75,75
    Run the font server, perhaps like this:
    ./xfs -config `pwd`/xfs.config
    The exact options you need vary depending on the font server.
  3. Set up the font directory (/home/lee/lib/ttfonts in the example above); this is described below in more detail.
  4. tell X to use the font server after all other fonts:
    xset fp+ tcp/localhost:7100
  5. test it, perhaps with the xlfd script described above.

Setting up a font directory for X

You will need a special directory to contain all your outline fonts. This should notbe your normal X font directory, as otherwise you will have to set it up again when you install a new version of X.

You will need a file called fonts.scale in the directory; then inside the directory, in a teminal/shell, run mkfontdir to generate the file fonts.dir.

The fonts.scale file looks like this:

3
0rga.ttf        -brendel-Mackintosh SF-medium-r-normal--0-0-0-0-p-0-iso8859-1
39smooth.ttf    -Fanatico-39 Smooth-medium-r-normal--0-0-0-0-p-0-iso8859-1
72786___.ttf    -letraset-DfAttitudesLET Plain:1.0-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
The number 3 here is teh number of lines that follow. On each following line there are two fields: the name of a file that contains a TrueType or Type1 font, and then the X name that will be used. You have to use X names in this form, with foundry name, font name, and so forth. If it's not a text font, use the encoding name adobe-fontspecific as shown.

Fonts that you can use

You can use PostScript Type 1 fonts and, with some font servers, TrueType fonts. Don't expect the world's highest quality unless you are using a commercial font server, because the free font servers aren't all that good yet.

A Type 1 font usually has a name ending in .pfa or .pfb indicating Adobe's portable font ascii and binary formats, respectively. Not all font servers can use pfb files, so you may need to use Lee Hetherington's t1utils or pfb2ps to convert from pfb to pfa.

TrueType fronts from Microsoft Windows should work directly if your font server supports them. Macintosh TrueType fonts generally require more work, but sually these are simply automatic conversions from Type 1 PostScript in the first place. Use the Type 1 font instead.

fonts you can get here

runes: fonts for Elder Futhark and Ogham runes.

xfonttool

xfonttool is written for the XView toolkit with DevGuide; you are on your own. I have included a SPARC binary that may run.

xfonttool screenshots

The main font choosing window:

Sample text

A single screen shot showing the main window, a font sample window, the font path dialogue and a font size properties window can be perceived here.