FONT(9.5)                                               FONT(9.5)

          font - jerq font layouts

          #include <jerq.h>
          #include <font.h>

          typedef struct Fontchar Fontchar;
          typedef struct Font Font;

          extern Font defont;

          A Font is  a character set, stored as a single Bitmap with
          the characters placed side-by-side.  It is described by the
          following data structures.

               typedef struct Fontchar {
                    short x;                     /* left edge of bits */
                    unsigned char top;           /* first non-zero scan-line */
                    unsigned char bottom;        /* last non-zero scan-line */
                    char left;                   /* offset of baseline */
                    unsigned char width;         /* width of baseline */
               } Fontchar;
               typedef struct Font {
                    short n;                     /* number of chars in font */
                    char height;                 /* height of bitmap */
                    char ascent;                 /* top of bitmap to baseline */
                    long unused;
                    Bitmap *bits;                /* where the characters are */
                    Fontchar info[n+1];          /* n+1 character descriptors */
               } Font;

          Characters in bits abut exactly, so the displayed width of
          the character c is[c+1][c].x.  The
          first left columns of pixels in a character overlap the pre-
          vious character.  The upper left corner of the nonempty
          columns appears at (x,0) in the bitmap.  Width is the dis-
          tance to move horizontally after drawing a character.  The
          font bitmap has a fixed height; parameters top and bottom
          may be used to optimize the copying of a character in some

          A character drawn at point p in an arbitrary Bitmap has its
          upper-leftmost dot, including empty space above it in the
          Bitmap, at p.

          To copy character c from font f to point p do

               Fontchar *i = f->info + c;

     FONT(9.5)                                               FONT(9.5)

               bitblt(f->bits, Rect(i->x, i->top, (i+1)->x, i->bottom), Pt(p.x+i->left, p.y+i->top), fc);
               p.x += i->width;

          The above example is correct for XOR and OR mode.  For STORE
          mode, the bitblt call is different because all the scan
          lines must be drawn:

               bitblt(f->bits, Rect(i->x, 0, (i+1)->x, f->height),
               Pt(p.x+left, p.y), fc);

          Fonts are stored on disk in binary with byte order that of
          the terminal.  First in the file is the first eight bytes
          (up to unused) of the Font strcture, then the array of
          Fontchar structures, then the data for the bitmap Font.bits.
          The header for the bitmap must be inferred from Font.height
          and[Font.n].x. See string(9.3) for a description
          of how to read and write font files.

          jf(9.1), string(9.3), infont(9.3)