E

Release 3 and 4 Standard Fonts

This appendix shows the standard display fonts available in Release 4 of the MIT X distribution. The images contained in this appendix are window dumps created with our own program, called xshowfonts, the code for which is included.

E

Release 3 and 4 Standard Fonts

This appendix includes pictures of some representative fonts from the standard X distribution in Releases 3 and 4. Not every font may be supported by particular server vendors, and some vendors may supplement the set.

The standard Release 3 and 4 fonts are stored in three directories:

Directory Contents
/usr/lib/X11/fonts/misc Six ftxed-width fonts (also available in Release 2), the cursor font, other miscellaneous fonts.
/usr/lib/X11/fonts/75dpi Fixed- and variable-width fonts, 75 dots per inch.
/usr/lib/X11/fonts/100dpi Fixed- and variable-width fonts, 100 dots per inch.

Tables E-1 through E-3 list the fonts in each of the three Release 4 font directories. Tables E-4 through E-6 list the fonts in each of the three Release 3 font directories. The first column lists the name of the ftle in which the font is stored (without the .snf extension); the second column lists the actual font name. See Chapter 5, Font Specification, for information about font naming conventions.

PICTURES of the different font families supplied in the MIT X11 distribution appear on subsequent pages. We show just the fonts in the 75dpi directory. The 100dpi directory contains the same fonts stored in the 75dpi directory, but for 100 dots per inch monitors. Keep in mind that all of the fonts in the 75dpi and 100dpi directories are available in 8, 10, 12, 14, 18 and 24-point sizes. Each page shows fonts of various sizes, weights, and styles. We include the source for xshowfonts.c, the program we wrote to make these displays, at the end of the chapter.* We also show you, using xfd, one example of each of the unique character sets available.

All of the characters in each font are shown actual size, as they would appear on a 900 × 1180 pixel, 10″ × 13.5″ screen (Sun). On a screen with different pixel density, these fonts would appear a different size.

Fonts that begin with many blank characters are shown with most leading blanks removed. Therefore, you can't always get the character number of each cell in the font by counting from the first cell we have shown. Use xfd to quickly determine the code for a particular cell.

Table E-1. Fonts in the misc Directory, Release 4

images

Table E-2. Fonts in the 75dpi Directory, Release 4

images

images

images

images

images

images

Table E-3. Fonts in the 100dpi Directory, Release 4

images

images

images

images

images

Table E-4. Fonts in the misc Directory, Release 3

Filename Font name
6×10 6×10
6×12 6×12
8×13 8×13
8×13B 8×13bold
9×15 9×15
cursor cursor
6×13 fixed

Table E-5. Fonts in the 75dpi Directory, Release 3

images

images

images

images

Table E-6. Fonts in the 100dpi Directory, Release 3

images

images

Foundry: adobe

family:    courier

images

Foundry: adobe

family:     helvetica

images

Foundry: adobe

family:     new century schoolbook

images

Foundry: b&h

family:    lucida

images

Foundry: b&h

family:    lucidabright

images

Foundry: adobe

family:    times

images

Foundry: adobe

family:    symbol

images

Foundry: b&h

family:    lucidatypewriter

images

Foundry: bitstream

family:    charter

images

Foundry: bitstream

family:    terminal

images

Foundry: dec

family:    terminal

images

Foundry: misc

family:    fixed

images

Foundry: schumaapper

Family:    clean

images

Encoding: adobe-fontspecific

images

Encoding: dec-dectech

images

Encoding: is08859

images

Encoding: jisx0201.1976

images

Encoding: jisx0208.1983

images

Encoding: jisx0201.1976

images

Encoding: sunolglyph

images

Encoding: SunOLcursor

Example E-1 is the source code for the xshowfonts program, which we used to create most of the illustrations in this appendix. If you don’t want to type it in, you can fmd instructions for getting it online in the Preface.

Example E-1. xshowfont source listing

/* Dan Heller <argv@sun.com>, based on a design by Tim O'Reilly
 *
 * xshowfonts.c -
 *   Displays a set of fonts specified on the command line, from
 * a pipe, or typed into stdin. Fonts can be specified as specific
 * fonts or as wildcard character strings. A pixmap is created to
 * display all the fonts. This is done by using the pixmap as the
 * pixmap image for a label widget. Each font prints its own name
 * in its own font style -- the -phrase option prints the phrase
 * instead.
 *
 * All fonts are loaded first and scanned to determine the total
 * width and height of the pixmap first. Then the fonts are
 * reopened again to actually render the fonts into the pixmap.
 * All this could be avoided by using XListFontsWithinfo()
 * rather than XListFonts(), but since the list is potentially
 * very large, I didn't want to overload the server and client
 * with all those fonts + a very large pixmap.
 *
 * Usage: xshowfonts
 *   -s sorts the fonts in alphabetical order before displaying
        them.
 *   -v verbose mode for when input is redirected to stdin.
 *   -w width of viewport window
 *   -h height of viewport window
 *   -fg foreground_color
 *   -bg background_color
 *   -phrase "text string" (otherwise, name of font is used)
 *   -indicates to read from stdin. Piping doesn't require
 *    the '-' argument. With no arguments, xshowfonts reads
 *    from stdin anyway.
 *
 * Neat ways to use the program:
 *  xshowfonts -fg green -bg black "*adobe*"
 *  xshowfonts -sort "*"
 *  xshowfonts -phrase "The quick brown fox jumps over the lazy
 *              dog" "*times*"
 *  xlsfonts | xshowfonts -sort
 *  xshowfonts "*helvetica*"
 *
 * compile: (triple click and paste next line)
     cc -0 -s xshowfonts.c -lXaw -lXt -lXmu -lX11 -o xshowfonts
 */
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/Viewport.h>

struct _resrcs {
    int-sort;

    int verbose;
    Pixel fg, bg;
    char *phrase;
    int view_width, view_height;
} Resrcs;

static XtResource resources[] = {
    { "sort", "Sort", XtRBoolean, sizeof (int),
    XtOffsetOf(struct _resrcs,sort), XtRImmediate,
        False },
    { "verbose", "Verbose", XtRBoolean, sizeof (int),
    XtOffsetOf(struct _resrcs,verbose), XtRImmnediate,
       False },
    { "foreground", "Foreground", XtRPixel, sizeof (Pixel},
     XtOffsetOf(struct _resrcs,fg), XtRString,
         XtDefaultForeground },
    { "background", "Background", XtRPixel, sizeof (Pixel),
    XtOffsetOf(struct _resrcs, bg), XtRString,
       XtDefaultBackground },
    { "phrase", "Phrase", XtRString, sizeof (String),
    XtOffsetOf(struct _resrcs,phrase}, XtRImmediate, NULL },
    { "view-width", "View-width", XtRInt, sizeof (int),
    XtOffsetOf(struct _resrcs, view_width), XtRImmediate,
       (char *)500 ),
    { "view-height", "View-height", XtRInt, sizeof (int},
    XtOffsetOf(struct _resrcs,view _height), XtRImmediate,
        (char *)300 },
};
static XrmOptionDescRec options[] = {
    { "-sort", "sort", XrmoptionNoArg, "True" },
    { "-v", "verbose", XrmoptionNoArg, "True" },
    { "-fg", "foreground", XrmoptionSepArg, NULL },
    { "-bg", "background", XrmoptionSepArg, NULL },
    { "-phrase", "phrase", XrmoptionSepArg, NULL },
    { "-w", "view-width", XrmoptionSepArg, NULL },
    { "-h", "view-height", XrmoptionSepArg, NULL },
};
/* sort font according to the following parameters.
 * font specs we're interested in:
 *    -fndry-fmly-wght-slant-*swdth-*adstyl-*pxlsz-ptsz- ....
 * foundry -- sort by foundry first; similar ones are always
 *            grouped together
 * weight -- medium, demi-bold, bold
 * slant -- roman, italic/oblique, reverse italic/oblique
 *          (i or o, r, ri, ro)
 * ptsize -- increase numerical order
 */
font _cmp(fl, f2)
char **fl, **f2;
{
    char fndry1[16], fmly1[64], wght1(32], slant1[3];
    char fndry2[16], fmly2[64], wght2[32], slant2[3];
    int n, m, ptsize1, ptsize2;
    char *font_fmt_str = "-%[^-]-%[^-]-%[^-]-%[^-]-%[^0-9]%
         *d-%d-";

    n = sscanf(*fl, font_fmt_str, fndry1, fmly1, wght1, slant1,
               &ptsize1);
    m = sscanf(*f2, font_fmt_str, fndry2, fmly2, wght2, slant2,
               &ptsize2);
    if (m < 5 | | n < 5)
    /* font not in correct format -- just return font names
     * in order */
    return strcmp(*f1, *f2);
   if (n = strcmp(fndry1, fndry2))
    return n; /* different foundries -- return alphabetical
                  * order */
   if (n = strcmp(fmly1, fmly2))
    return n; /* different families -- return alphabetical
                  * order */
   if (n = strcmp(wght1, wght2))
    return -n; /* weight happens to be correct in reverse
                   * alpha order */
   if (n = strcmp(slant1, slant2))
    return n; /* slants happen to be correct in alphabetical
                  * order */
   /* sort according to point size */
   return ptsize1 - ptsize2;
}
main(argc, argv)
int argc;
char *argv[];
{
    Widget topLevel, vp;
    char **list = (char **)NULL, **tmp;
    char buf[128];
    extern char **XListFonts();
    extern int strcmp();
    XFontStruct *font;
    Pixmap pixmap;
    GC gc;
    Display *dpy;
    int istty = isatty(O), redirect= !istty, i, j, total 0;
    unsigned int w, width = 0, height = 0;

    topLevel = Xtlnitialize(argv[O], argv[O], options,
        XtNumber(options), &argc, argv);
    dpy = XtDisplay(topLevel);
    XtGetApplicationResources(topLevel, &Resrcs,
     resources, XtNumber(resources), NULL, 0);
    if (!argv[1] | | !strcmp(argv[1], "-")) {
     printf("Loading fonts from input. ");
     if (istty) {
         puts("End with EOF or .");
         redirect++;
     } else
         puts("Use -v to view font names being loaded.");
    } else if (!istty && strcmp(argv[1], "-"))
    printf("%s: either use pipes or specify font names --
           not both.\n",

         argv[O]), exit(1);
    while (*++argv | | redirect) {
     if (!redirect)
         if (!strcmp(*argv, "-"))
          redirect++;
         else
          strcpy(buf, *argv);
     if (redirect) {
         if (istty)
          printf("Fontname: "), fflush(stdout);
         if (!fgets (buf, sizeof buf, stdin) ||
                !strcmp(buf, ".\n"))
          break;
         buf[strlen(buf)-1] = 0;
    }
    if (!buf[O])
        continue;
    if (istty || Resrcs.verbose)
        printf("Loading
    tmp = XListFonts(dpy, buf, 32767, &i);
    if (i == 0) {
        printf("couldn't load font ");
        if (!istty && !Resrcs.verbose)
         printf("
        putchar('\n');
        continue;
    }
    if (istty || Resrcs.verbose)
        printf("%d font%s\n", i, i == 1? "" : "s");
    if (!list) {
        list = tmp;
        total = i;
    } else {
        i += total;
        if (!(list = (char **)XtRealloc(list, i *
                    sizeof (char *))))
         XtError("Not enough memory for font names");
        for (j = 0; total < i; j++, total++)
         list[total] = tmp[j];
    }
   }
   if (total == 0)
    puts("No fonts?!"), exit(1);
   printf("Total fonts loaded: %d\n", total);
   if (Resrcs.sort) {
    printf("Sorting fonts ... "), fflush(stdout);
    qsort(list, total, sizeof (char *), font_cmp);
    putchar('\n');
   }
  /* calculate size for pixmap by getting the dimensions
   * of each font */
  puts("Calculating sizes for pixmap.");
  for (i = 0; i < total; i++) {
   fi (!(font= XLoadQueryFont(dpy, list[i]))) {
       printf("Can't load font: %s\n", list[i]);
       continue;

    }
    if ((w = XTextWidth(font, list[i],
         strlen(list[i]))) > width)
        width = w;
    height += font->ascent + font->descent;
    XFreeFont(dpy, font);
   }
   width += 6;
   height += 6;
   /* Create pixmap + GC */
   printf("Creating pixmap of size %dx%d\n", width, height);
   if (! (pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy),
    width, height, DefaultDepth(dpy, DefaultScreen(dpy)))))
    XtError("Can't Create pixmap");
   if (! (gc = XCreateGC(dpy, pixmap, NULL, 0)))
    XtError("Can't create gc");
   XSetForeground(dpy, gc, Resrcs.bg);
   XFillRectangle(dpy, pixmap, gc, 0, 0, width, height);
   XSetForeground(dpy, gc, Resrcs.fg);
   XSetBackground(dpy, gc, Resrcs.bg);
   height = 0;
   for (i = 0; i < total; i++) {
   if (!(font= XLoadQueryFont(dpy, list[i])))
       continue; /* it's already been reported */
   XSetFont(dpy, gc, font->fid);
   height += font->ascent;
   if (Resrcs.phrase)
       XDrawString(dpy, pixmap, gc, 0, height,
        Resrcs.phrase, strlen(Resrcs.phrase));
   else
       XDrawString(dpy, pixmap, gc, 5, height, list[i],
                  strlen(list[i]));
   height += font->descent;
   XFreeFont(dpy, font);
  }
  vp = XtVaCreateManagedWidget("viewport", viewportWidgetClass,
       topLevel,
   XtNallowHoriz,    True,
   XtNallowVert, True,
   XtNwidth,Resrcs.view_width,
   XtNheight, Resrcs.view_height,
   NULL);
  XtVaCreateManagedWidget("_foo", labelWidgetClass, vp,
   XtNbitmap,   pixmap,
   NULL);
  if (!redirect)
   XFreeFontNames(list);
  XtRealizeWidget(topLevel);
  XtMainLoop ();
}

>__________
*If you don’t want to type this program in, you can obtain the source from uunet.uu.net via anonymous ftp or uucp. See the Preface for more information.

Get X Window System User's Guide for X11 R3 and R4 of the X Window System now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.