Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fonts(5) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

master

data stream

display symbols

Reconfigure

(HFRCONF)

gsgtat

gsgtxt

gstatt

gstext

gsxtat

gsxtxt

fonts

Purpose

     Defines  character fonts  for  an HFT  display device  in
     annotated, geometric, and rtfont formats.

Description

     IBM supplies two sets of precompiled annotated text fonts
     with the AIX  Operating System.  One set of  fonts is for
     the IBM 5081 Display Adapter and the other set is for all
     other devices supported by  the Advanced Display Graphics
     Support  Library  (GSL).   The  fonts for  the  IBM  5081
     Display Adapter cannot be used on other devices and fonts
     for other devices cannot be used on the 5081 Display.

     The AIX operating system  can supply annotated font defi-
     nitions to the  VRM.  This can be done  either by config-
     uring  new font  files  into the  VRM  or by  dynamically
     installing  font  modules into  the  VRM  and issuing  an
     HFRCONF operation  with the  ioctl system call  to inform
     the VRM that they exist.

     The  provided  annotated  text  fonts  are  automatically
     installed with the VRM, and others that you create can be
     configured into  the system by modifying  the /etc/master
     file.  You  can select the  active display font  from the
     installed fonts by using the display command.

     In addition  to the  precompiled fonts, IBM  supplies the
     source for  each non-5081  font, which  you can  copy and
     modify to create new font definitions.  Since precompiled
     font files  must be  linked to the  VRM at  run-time, the
     source font files must be compiled and converted to table
     of contents  (TOC) format using  the vcc and  vrmfmt com-
     mands.  For  details about the TOC  object module format,
     see Virtual Resource  Manager Technical Reference.  After
     converting the files, you must  issue the ioctl call that
     does an HFT reconfigure.  (See "hft.")

     The GSL-supported  devices also recognize two  other font
     file  formats:  a  geometric  text format  and an  rtfont
     format.  The format for  geometric text fonts, also known
     as programmable character set  (PCS) fonts, allows you to
     create fonts that can be  scaled and rotated.  The rtfont
     format allows you  to design fonts that can  be used with
     both X-Windows  and the GSL.   PCS font and  rtfont files
     can be  used on  all GSL-supported devices  including the
     IBM 5081 Display.

     For more information on how to use the fonts described in
     this section, see -- Heading id 'gsl' unknown --.

ANNOTATED TEXT FONT FORMAT

     An annotated  text font  definition file has  three major
     parts in the following sequence:

     o   A header that  describes the font. The  header is the
         same for all annotated text fonts.

     o   A set of character descriptions:

         -   5081  fonts --  A set  of expanded  character bit
             arrays that describes each character in the font.

         -   Non-5081  fonts  --  A set  of  condensed  raster
             mosaics  that  describes  each character  in  the
             font.

     o   A look-up table that has  an index entry to find each
         character representation in the font.

         -   5081 fonts -- Look-up table entries are 16 bits.

         -   Non-5081 fonts  -- Look-up  table entries  are 32
             bits and  each describes the start  of its raster
             mosaics  entry, its  width, and  the white  space
             compressed from the top  and bottom of its raster
             mosaics entry.

     Annotated Text Font Header

     The annotated  text font header is  a fixed-length struc-
     ture common to all annotated text fonts for all displays.
     The VRM  run-time binder uses  the DDDFSIZE field  in the
     header to link the font  to the virtual terminal resource
     manager.  The information in header fields are:

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0x00     | 4        | DDDFSIZE | The size in bytes of |
                    |          |          |          | the  area containing |
                    |          |          |          | the  font   and  the |
                    |          |          |          | look-up table.       |
                    +----------+----------+----------+----------------------+
                    | 0x04     | 2        | fntclass | A     number    that |
                    |          |          |          | uniquely  identifies |
                    |          |          |          | the  format  of  the |
                    |          |          |          | look-up  table  that |
                    |          |          |          | follows:             |
                    |          |          |          |   0x01 =  not a 5081 |
                    |          |          |          | font                 |
                    |          |          |          |   0x02 = a 5081 font |
                    +----------+----------+----------+----------------------+

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0x06     | 2        | fntid    | The name an applica- |
                    |          |          |          | tion  uses to  iden- |
                    |          |          |          | tify  a font.   This |
                    |          |          |          | must   be  a   value |
                    |          |          |          | within the  range of |
                    |          |          |          | 0 to 1024.           |
                    +----------+----------+----------+----------------------+
                    | 0x08     | 4        | fntstyle | Font style.          |
                    +----------+----------+----------+----------------------+
                    | 0x0C     | 4        | fntattr  | Identifies       the |
                    |          |          |          | attributes   of  the |
                    |          |          |          | font.       Possible |
                    |          |          |          | values are:          |
                    |          |          |          |   0x0000     -    no |
                    |          |          |          | special values       |
                    |          |          |          |   0x0001    -   bold |
                    |          |          |          | version of this font |
                    |          |          |          |   0x0002   -  italic |
                    |          |          |          | version    of   this |
                    |          |          |          | font.                |
                    +----------+----------+----------+----------------------+
                    | 0x10     | 4        | fnttotch | The total  number of |
                    |          |          |          | characters   in  the |
                    |          |          |          | font.  This  is used |
                    |          |          |          | to determine whether |
                    |          |          |          | a   specified  char- |
                    |          |          |          | acter code  is valid |
                    |          |          |          | for this font.       |
                    +----------+----------+----------+----------------------+
                    | 0x14     | 4        | fnttblsz | Total    number   of |
                    |          |          |          | words  in  the  font |
                    |          |          |          | table.               |
                    +----------+----------+----------+----------------------+
                    | 0x18     | 2        | fntbasln | The scan line within |
                    |          |          |          | a  character box  of |
                    |          |          |          | the   baseline   for |
                    |          |          |          | characters  in  this |
                    |          |          |          | font (zero origin).  |
                    +----------+----------+----------+----------------------+
                    | 0x1A     | 2        | fntcapln | The scan line within |
                    |          |          |          | a  character box  of |
                    |          |          |          | the  caps  line  for |
                    |          |          |          | characters  in  this |
                    |          |          |          | font (zero origin).  |
                    +----------+----------+----------+----------------------+
                    | 0x1C     | 2        | fntcolmn | Width  of  character |
                    |          |          |          | box in pels.         |
                    +----------+----------+----------+----------------------+
                    | 0x1E     | 2        | fntrows  | Height  of character |
                    |          |          |          | box in pels.         |
                    +----------+----------+----------+----------------------+
                    | 0x20     | 2        | fntchrbt | Total number of bits |
                    |          |          |          | per character.       |
                    +----------+----------+----------+----------------------+

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0x22     | 2        | fntultop | The scan line within |
                    |          |          |          | the character box of |
                    |          |          |          | the top  line in the |
                    |          |          |          | underscore     (zero |
                    |          |          |          | origin).             |
                    +----------+----------+----------+----------------------+
                    | 0x24     | 2        | fntulbot | The scan line within |
                    |          |          |          | the character box of |
                    |          |          |          | the  bottom line  in |
                    |          |          |          | the underscore (zero |
                    |          |          |          | origin).             |
                    +----------+----------+----------+----------------------+
                    | 0x26     | 1        | fntmonpt | Mono  pitch flag  in |
                    |          |          |          | leftmost bit of this |
                    |          |          |          | byte.                |
                    +----------+----------+----------+----------------------+
                    | 0x28     | 4        | fntlkup  | Byte offset from the |
                    |          |          |          | beginning   of  this |
                    |          |          |          | structure   to   the |
                    |          |          |          | beginning   of   the |
                    |          |          |          | font look-up table.  |
                    +----------+----------+----------+----------------------+

     Annotated Text Font Raster Mosaics (non-5081)

This contains a definition for each character in the font.  Each character is
entered in  this area with the  horizontal slices bit-packed one  right after
the other.  The first bit of the  first character slice is forced to begin in
the most  significant bit of  a byte.   The raster mosaics  start immediately
after the  header (0x2C from the  start address of the  font structure).  See
Annotated Text Example One (non-5081) on .

     Annotated Text Character Bit Array (5081)

This contains a  definition for each character in the  5081 font.  Each char-
acter in the character bit array must be a multiple of 4 pels wide and a mul-
tiple of 4 pels high.  Zeros are padded to the right and padded to the bottom
of the character as needed to accomplish this.

Each 4x4 pel array  is then stored in a 16-bit word with  the first four bits
of the array leftmost in the word and proceeding to the right.

The 4x4 arrays are  stored beginning with the bottom left  array in the char-
acter and is  repeated across the bottom of the  character.  The process then
continues at the left of the next  higher horizontal row of 4x4 arrays and so
on until the 4x4 array representing the  top right corner of the character is
stored in a 16-bit word.  See Annotated Text Example Two (5081) on .

     Annotated Text Font Look-up Table (non-5081)

The look-up table immediately follows the raster mosiac.  There is one 32-bit
look-up table entry for each character in the font.  The look-up table can be
found by adding the value fntlkup given in the header to the starting address
of the font structure.   The table entry for any given  character is found by
using the  font position number  as an index  into the table.   (See "display
symbols" for a list of the  font position numbers.)  Each look-up table entry
contains the following fields:

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bits  | in Bits  | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0        | 5        | lkup_top | The number  of blank |
                    |          |          |          | scan lines that have |
                    |          |          |          | been eliminated from |
                    |          |          |          | the   top  of   this |
                    |          |          |          | character     raster |
                    |          |          |          | image (white space). |
                    +----------+----------+----------+----------------------+
                    | 5        | 5        | lkup_bot | The number  of blank |
                    |          |          |          | scan lines that have |
                    |          |          |          | been eliminated from |
                    |          |          |          | the  bottom of  this |
                    |          |          |          | character     raster |
                    |          |          |          | image (white space). |
                    +----------+----------+----------+----------------------+
                    | 10       | 6        | lkup_widt| Contains  the  width |
                    |          |          |          | in pels of this par- |
                    |          |          |          | ticular character.   |
                    +----------+----------+----------+----------------------+
                    | 16       | 16       | lkup_ref | Byte offset from the |
                    |          |          |          | start  of   the  the |
                    |          |          |          | raster   mosaics  of |
                    |          |          |          | the  first  scanline |
                    |          |          |          | of  the  character's |
                    |          |          |          | raster image.        |
                    +----------+----------+----------+----------------------+

     Annotated Text Font Look-up Table (5081)

     The character  look-up table for IBM  5081 fonts contains
     an entry for each character  or possible character in the
     font.

     Each entry  is 16 bits  and contains the offset  from the
     start of the character bit array to the first byte of the
     bit array for the corresponding character.  That is, this
     offset is kept as a 16-bit  word offset from the start of
     the bit array section.  The character look-up table entry
     for  any given  character  is found  by concatenating  an
     offset to  the start  of the code  page in  the character
     look-up table with the  ASCII (or EBCDIC) character code,
     and  adding the  result to  the starting  address of  the
     character look-up table found in the font header.

Annotated Text Example One (non-5081)

See Figure 5-1 for this example.  The  character chosen is a capital A.  This
is shown as it would appear on the  display and how it would be stored in the
raster mosaics.   Also shown is the  font look-up table entry  for this char-
acter.  Note that the data associated with  the top and bottom two scan lines
of the character image do not appear in the raster mosaics since they consist
of zeros.

To reconstruct the  character image from the raster mosaics,  it is necessary
to use the  font look-up table.  The display symbol  code associated with the
character that is to be displayed  is used to access its corresponding 4-byte
entry in the font look-up table.  The information contained in a font look-up
table  entry is  shown.  The  capital Ts  represent the  bits containing  the
number of top blank scan lines that were compressed from the character image.
The capital Bs represent the bits  containing the number of bottom blank scan
lines that were  compressed from the character image.  The  capital Ws repre-
sent the  bits containing the  width in pels  of this character.   Capital Os
represent the  bits containing the offset  of the compressed portion  of this
character image  data in  the raster  mosaics.  For  this example,  the value
associated with T is  2, the value associated with B is 2,  and the width (W)
is 5.   The value associated with  O is the offset  of the y(th) byte  of the
raster mosaics.

                              ol807041

     Figure  5-1.  Example  of  Annotated  Text  Font  Storage
                   (non-5081)

If  this font  is defined  in  a file  named "/usr/lib/vtm/nrm1.9x20s",  then
compile it and convert the a.out file  to TOC format using the following com-
mands:

     vcc     /usr/lib/vtm/nrm1.9x20.s  -o nrm1.9x20.0
     vrmfmt  nrm1.9x20.0  nrm1.9x20
Annotated Text Example Two (5081)

See Figure 5-2 for this example.  The character chosen is an uppercase A, and
is shown  as a 5x11  character box,  which is then  padded with zeros  to the
right and  bottom to  make the  rows and columns  a multiple  of 4.   The 4x4
arrays are then stored in 16-bit words  beginning at the bottom left array in
the box and continuing horizontally to the top right array in the character.

                              ol807225

     Figure  5-2.  Example  of  Annotated  Text  Font  Storage
                   (5081)

     Annotated Text Font Files (non-5081)

/etc/vtm/nrm1.4x8           Normal 4 by 8 micro font, compiled
/etc/vtm/nrm1.6x9           Normal 6 by 9 font, compiled
/etc/vtm/nrm1.6x11          Normal 6 by 11 font, compiled
/etc/vtm/nrm1.7x15          Normal 7 by 15 font, compiled
/etc/vtm/nrm1.7x22          Normal 7 by 22 font, compiled
/etc/vtm/nrm1.8x14          Normal 8 by 14 font, compiled
/etc/vtm/bld1.9x20          Bold 9 by 20 font, compiled
/etc/vtm/erg1.9x20          Ergonomic 9 by 20 font, compiled
/etc/vtm/itl1.9x20          Italic 9 by 20 font, compiled
/etc/vtm/nrm1.9x20          Normal 9 by 20 font, compiled
/etc/vtm/bld1.11x23         Bold 11 by 23 font, compiled
/etc/vtm/nrm1.11x23         Normal 11 by 23 font, compiled
/etc/vtm/nrm1.12x30         Normal 12 by 30 font, compiled
/etc/vtm/nrm1.18x40         Normal 18 by 40 title font, compiled
/usr/lib/vtm/nrm1.4x8.s     Normal 4 by 8 micro font, source
/usr/lib/vtm/nrm1.6x9.s     Normal 6 by 9 font, source
/usr/lib/vtm/nrm1.6x11.s    Normal 6 by 11 font, source
/usr/lib/vtm/nrm1.7x15.s    Normal 7 by 15 font, source
/usr/lib/vtm/nrm1.7x22.s    Normal 7 by 22 font, source
/usr/lib/vtm/nrm1.8x14.s    Normal 8 by 14 font, source
/usr/lib/vtm/bld1.9x20.s    Bold 9 by 20 font, source
/usr/lib/vtm/erg1.9x20.s    Ergonomic 9 by 20 font, source
/usr/lib/vtm/itl1.9x20.s    Italic 9 by 20 font, source
/usr/lib/vtm/nrm1.9x20.s    Normal 9 by 20 font, source
/usr/lib/vtm/bld1.11x23.s   Bold 11 by 23 font, source
/usr/lib/vtm/nrm1.11x23.s   Normal 11 by 23 font, source
/usr/lib/vtm/nrm1.12x30.s   Normal 12 by 30 font, source
/usr/lib/vtm/nrm1.18x40.s   Normal 18 by 40 title font, source.

     Annotated Text Font Files (5081)

/etc/vtm/nrmMP1.4x8         Normal 4 by 8 micro font, compiled
/etc/vtm/nrmMP1.6x9         Normal 6 by 9 font, compiled
/etc/vtm/nrmMP1.6x11        Normal 6 by 11 font, compiled
/etc/vtm/nrmMP1.7x15        Normal 7 by 15 font, compiled
/etc/vtm/nrmMP1.7x22        Normal 7 by 22 font, compiled
/etc/vtm/nrmMP1.8x14        Normal 8 by 14 font, compiled
/etc/vtm/bldMP1.9x20        Bold 9 by 20 font, compiled
/etc/vtm/ergMP1.9x20        Ergonomic 9 by 20 font, compiled
/etc/vtm/itlMP1.9x20        Italic 9 by 20 font, compiled
/etc/vtm/nrmMP1.9x20        Normal 9 by 20 font, compiled
/etc/vtm/bldMP1.11x23       Bold 11 by 23 font, compiled
/etc/vtm/nrmMP1.11x23       Normal 11 by 23 font, compiled
/etc/vtm/nrmMP1.12x30       Normal 12 by 30 font, compiled
/etc/vtm/nrmMP1.18x40       Normal 18 by 40 title font, compiled.

GEOMETRIC TEXT FONT FORMAT

Geometric text fonts are also known as programmable character set (PCS) fonts
and they  can be  used on all  GSL supported devices  including the  IBM 5081
Display.  Each character is defined as a series of moves or draws that define
the shape of the  character.  The moves and draws are  specified as X-Y pairs
of signed relative  values (relative to the previous ending  point, or to the
bottom left of the  character box for the first X-Y pair).   The range of the
incremental values for the X and Y coordinates is -64 to +63.

Each character definition  in the font consists of a  2-byte length field for
the character definition followed by 2-byte X-Y entries:

          Length of definition         2 bytes
          sXXXXXX 1  sYYYYYY b         2 bytes
            .     .      .   .
          sXXXXXX 1  sYYYYYY b         2 bytes

     s is the sign bit (0 = positive, 1 = negative).  Negative values
     are in twos complement notation.

     b is the blanking bit.  If b = 1, the primitive is blanked causing
     movement without display.

     1 is the low order bit of the X coordinate field and must always
     be a 1.

If the first  X-Y pair is a draw  rather than a move, the line  is drawn from
the bottom left corner of the character box.  A move is specified by the low-
order bit of the Y coordinate being on.  A draw is specified by the low-order
bit being off.  The last X-Y pair  in the series for the character is defined
by the length field.

     Geometric Text Font Definition File

The PCS font definition file consists of:

o   A header that contains identifier and control information
o   A table of index values used to find each character definition
o   The character definitions.

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0x00     | 2        | length   | The  length  of  the |
                    |          |          |          | PCS       descriptor |
                    |          |          |          | record including the |
                    |          |          |          | length field.        |
                    +----------+----------+----------+----------------------+
                    | 0x02     | 4        | Reserved | 0x00000000           |
                    +----------+----------+----------+----------------------+

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0x06     | 1        |          |   Bit  1   = 0 - EBCD|C
                    |          |          |          |              = 1 - AS|II
                    |          |          |          |   Bits 1-2 = Reserved|
                    |          |          |          |   Bits 3-7 = (Type) s|ecifies the data format
                    |          |          |          |              definiti|n for programmable
                    |          |          |          |              characte|s.  One is defined:
                    |          |          |          |                 '0000|'B = Type 1
                    +----------+----------+----------+----------------------+
                    | 0x07     | 1        | Reserved | Must be 0.           |
                    +----------+----------+----------+----------------------+
                    | 0x08     | 2        | fontid   | This  field  identi- |
                    |          |          |          | fies   the  program- |
                    |          |          |          | mable character set. |
                    |          |          |          | Font IDs  within the |
                    |          |          |          | range  of   1025  to |
                    |          |          |          | 3267   are  reserved |
                    |          |          |          | for 1-byte character |
                    |          |          |          | sets.    IDs  within |
                    |          |          |          | the  range of  32768 |
                    |          |          |          | to     65535     are |
                    |          |          |          | reserved  for 2-byte |
                    |          |          |          | character sets.      |
                    +----------+----------+----------+----------------------+
                    | 0x0A     | 1        | segmentid| For 2-byte character |
                    |          |          |          | sets, this byte con- |
                    |          |          |          | tains the first byte |
                    |          |          |          | of the  2-byte char- |
                    |          |          |          | acter code.          |
                    +----------+----------+----------+----------------------+
                    | 0x0B     | 1        | Reserved | Must be 0.           |
                    +----------+----------+----------+----------------------+
                    | 0x0C     | 2        | P        | Range of  X (between |
                    |          |          |          | 0 and P)             |
                    +----------+----------+----------+----------------------+
                    | 0x0E     | 2        | Q        | Range of  Y (between |
                    |          |          |          | 0 and Q)             |
                    +----------+----------+----------+----------------------+
                    | 0x10     | 1        | CP0      | Starting   character |
                    |          |          |          | code    within   PCS |
                    |          |          |          | (within the range of |
                    |          |          |          | 0x21 to 0xFE.)       |
                    +----------+----------+----------+----------------------+
                    | 0x11     | 1        | CPn      | The  last  character |
                    |          |          |          | code   within   this |
                    |          |          |          | PCS.   If CPn  is 0, |
                    |          |          |          | 0xFE   is   assumed. |
                    |          |          |          | CPn must not be less |
                    |          |          |          | than CP0.            |
                    +----------+----------+----------+----------------------+

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    +----------+----------+----------+----------------------+
                    | 0x12     | 2        | font     | The  value   of  the |
                    |          |          | baseline | font   baseline   in |
                    |          |          |          | pixels   in  the   Y |
                    |          |          |          | direction  from  the |
                    |          |          |          | bottom  line of  the |
                    |          |          |          | character.      This |
                    |          |          |          | value  is   used  in |
                    |          |          |          | conjunction with the |
                    |          |          |          | text alignment func- |
                    |          |          |          | tion.                |
                    +----------+----------+----------+----------------------+
                    | 0x14     | 2        | font     | The  value   of  the |
                    |          |          | capline  | font    capline   in |
                    |          |          |          | pixels   in  the   Y |
                    |          |          |          | direction  from  the |
                    |          |          |          | bottom  line of  the |
                    |          |          |          | character.      This |
                    |          |          |          | value  is   used  in |
                    |          |          |          | conjunction with the |
                    |          |          |          | text alignment func- |
                    |          |          |          | tion.                |
                    +----------+----------+----------+----------------------+
                    | 0x16     | 1        | Reserved |                      |
                    +----------+----------+----------+----------------------+
                    | 0x17     | 1        | Default  | This  is  the  char- |
                    |          |          | error    | acter   code  within |
                    |          |          | code     | this  PCS font  that |
                    |          |          | point    | specifies  the char- |
                    |          |          |          | acter  to   be  dis- |
                    |          |          |          | played    when    an |
                    |          |          |          | invalid    code   is |
                    |          |          |          | encountered  or  the |
                    |          |          |          | character  code does |
                    |          |          |          | not exist.           |
                    +----------+----------+----------+----------------------+
                    | 0x24     | var      | Char-    | This  field contains |
                    |          |          | acter    | 2-byte   offsets  to |
                    |          |          | Index    | each       character |
                    |          |          |          | description.    Each |
                    |          |          |          | offset  is from  the |
                    |          |          |          | beginning   of   the |
                    |          |          |          | descriptor record.   |
                    +----------+----------+----------+----------------------+
                    | var      | var      | Char-    | This  field contains |
                    |          |          | acter    | the  character defi- |
                    |          |          | Descripti|nnitions,   beginning |
                    |          |          |          | with code point CP0, |
                    |          |          |          | in ascending order.  |
                    +----------+----------+----------+----------------------+

P and  Q together define  the character box  within which a  normal character
will fit.   The values  of P  and Q  are defined  in device  coordinate space
(pixels) and  control spacing between  characters and new line  spacing.  The
bottom left corner of the box is 0,0  and the top right corner is P,Q.  Char-
acters can extend outside this box as P and Q control only the intercharacter

spacing.  You can override  the value of P specified in  the header by speci-
fying a character  inline spacing value greater than  0.  Undefined character
codes (outside the range CP0-CPn, or those with an index value of 0) are dis-
played as the default code point character.

Each character index value is the offset  from the start of the header record
to the actual character definition.  The  index must always be represented in
its  entirety, even  if not  all  of the  characters  in the  code range  are
defined.  For example,  the maximum length of the index,  if CP0 is specified
as 0x41 and CPn as 0xFF, is 191 multiplied by 2 bytes.  For undefined charac-
ters, the  index value  should contain  an offset to  the default  code defi-
nition.

Each character definition  begins with a 2-byte length  field which specifies
the length of the character definition including the length field.

RTFONT FILE FORMAT

The font  format described in  this section, known  as the rtfont  format, is
provided for use with X-Windows, Version  1.1 or higher and with the Advanced
Display Graphics  Support Library,  Version 2.2 or  higher.  An  rtfont defi-
nition file contains three major data structures in the following order:

1.  A header  structure, called  FONT_HEAD, which contains  information about
    the font in  general.  The header also contains offsets  to the following
    two structures.

2.  A character index array structure, called CHAR_INDEX, which contains mod-
    ifiers of  subsequent indices in the  form of character offsets  into the
    character data structure, also known  as the character glyphs.  The high-
    order four bits of each character index entry contain control information
    that defines how to interpret the 28 low-order bits of each entry.

3.  A character glyph structure, called  CHAR_GLYPH, which contains the char-
    acter image data and information unique to each character.

     Header Structure for rtfont Format

The header  is a  fixed-length structure  common to all  fonts in  the rtfont
format.  This structure, called FONT_HEAD,  is defined in the rtfont.h header
file, and it contains the following members:

                    +----------+----------+-------------------+-------------+
                    | Offset   | Length   |                   |             |
                    | in Bytes | in Bytes | Field             | Description |
                    |          |          |                   |             |
                    +----------+----------+-------------------+-------------+
                    | 0x00     | 16       | font_id           | The  ID  of |
                    |          |          |                   | the font.   |
                    +----------+----------+-------------------+-------------+
                    | 0x10     | 4        | off_to_index      | The  offset |
                    |          |          |                   | in    bytes |
                    |          |          |                   | from    the |
                    |          |          |                   | beginning   |
                    |          |          |                   | of the file |
                    |          |          |                   | to      the |
                    |          |          |                   | character   |
                    |          |          |                   | index       |
                    |          |          |                   | array.      |

                    +----------+----------+-------------------+-------------+

                    +----------+----------+-------------------+-------------+
                    | Offset   | Length   |                   |             |
                    | in Bytes | in Bytes | Field             | Description |
                    |          |          |                   |             |
                    +----------+----------+-------------------+-------------+
                    | 0x14     | 4        | off_to_glyphs     | The  offset |
                    |          |          |                   | in    bytes |
                    |          |          |                   | from    the |
                    |          |          |                   | beginning   |
                    |          |          |                   | of the file |
                    |          |          |                   | to      the |
                    |          |          |                   | character   |
                    |          |          |                   | glyphs.     |
                    +----------+----------+-------------------+-------------+
                    | 0x18     | 4        | glyph_format      | The  format |
                    |          |          |                   | of      the |
                    |          |          |                   | character   |
                    |          |          |                   | image data. |
                    +----------+----------+-------------------+-------------+
                    | 0x1C     | 4        | src_file_type     | The type of |
                    |          |          |                   | font   file |
                    |          |          |                   | from  which |
                    |          |          |                   | this   file |
                    |          |          |                   | was  gener- |
                    |          |          |                   | ated.       |
                    +----------+----------+-------------------+-------------+
                    | 0x20     | 4        | design_size       | The  design |
                    |          |          |                   | size     in |
                    |          |          |                   | (1/2)**16   |
                    |          |          |                   | points.     |
                    |          |          |                   | This  field |
                    |          |          |                   | is  for use |
                    |          |          |                   | by T[E]X, a |
                    |          |          |                   | typesetting |
                    |          |          |                   | system      |
                    |          |          |                   | described   |
                    |          |          |                   | in      The |
                    |          |          |                   | T[E]Xbook,  |
                    |          |          |                   | Donald   E. |
                    |          |          |                   | Knuth,      |
                    |          |          |                   | Addison     |
                    |          |          |                   | Wesley Pub- |
                    |          |          |                   | lishing     |
                    |          |          |                   | Company,    |
                    |          |          |                   | 1986.  (See |
                    |          |          |                   | Note 1.)    |
                    +----------+----------+-------------------+-------------+
                    | 0x24     | 4        | check_sum         | The         |
                    |          |          |                   | checksum    |
                    |          |          |                   | (T[E]X).    |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x28     | 4        | hppp              | The  number |
                    |          |          |                   | of    hori- |
                    |          |          |                   | zontal      |
                    |          |          |                   | pixels  per |
                    |          |          |                   | point     x |
                    |          |          |                   | 2**16.      |
                    |          |          |                   | (See   Note |

                    1.)         | |          |          |                   |
                    +----------+----------+-------------------+-------------+
                    | 0x2C     | 4        | vppp              | The  number |
                    |          |          |                   | of vertical |
                    |          |          |                   | pixels  per |
                    |          |          |                   | point     x |
                    |          |          |                   | 2**16.      |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x30     | 4        | fiFlags           | The   flags |
                    |          |          |                   | field bits. |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x34     | 4        | firstCol          | Reserved    |
                    |          |          |                   | (set to 0). |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x38     | 4        | lastCol           | Reserved    |
                    |          |          |                   | (set to 0). |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x3C     | 4        | firstRow          | Reserved    |
                    |          |          |                   | (set to 0). |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x40     | 4        | lastRow           | Reserved    |
                    |          |          |                   | (set to 0). |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x44     | 4        | nProps            | The  number |
                    |          |          |                   | of  proper- |
                    |          |          |                   | ties.  (See |
                    |          |          |                   | Note 1.)    |
                    +----------+----------+-------------------+-------------+
                    | 0x48     | 4        | chDefault         | The default |
                    |          |          |                   | character.  |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x4C     | 4        | font_Descent      | Extent      |
                    |          |          |                   | below       |
                    |          |          |                   | baseline    |
                    |          |          |                   | for         |
                    |          |          |                   | spacing.    |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+

                    +----------+----------+-------------------+-------------+
                    | Offset   | Length   |                   |             |
                    | in Bytes | in Bytes | Field             | Description |
                    |          |          |                   |             |
                    +----------+----------+-------------------+-------------+
                    | 0x50     | 4        | font_Ascent       | The  extent |
                    |          |          |                   | above       |
                    |          |          |                   | baseline    |
                    |          |          |                   | for         |
                    |          |          |                   | spacing.    |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x54     | 20       | minbounds         | The minimum |
                    |          |          |                   | glyph       |
                    |          |          |                   | metrics     |
                    |          |          |                   | over    all |
                    |          |          |                   | characters  |
                    |          |          |                   | in font.    |
                    +----------+----------+-------------------+-------------+
                    | 0x68     | 20       | maxbounds         | The maximum |
                    |          |          |                   | glyph       |
                    |          |          |                   | metrics     |
                    |          |          |                   | over    all |
                    |          |          |                   | characters  |
                    |          |          |                   | in font.    |
                    +----------+----------+-------------------+-------------+
                    | 0x7C     | 4        | pixDepth          | The  number |
                    |          |          |                   | of   inten- |
                    |          |          |                   | sity   bits |
                    |          |          |                   | per  pixel. |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x80     | 4        | glyphSets         | The  number |
                    |          |          |                   | of  sets of |
                    |          |          |                   | glyphs.     |
                    |          |          |                   | (See   Note |
                    |          |          |                   | 1.)         |
                    +----------+----------+-------------------+-------------+
                    | 0x84     | 4        | raster_align      | The         |
                    |          |          |                   | scanline    |
                    |          |          |                   | alignment   |
                    |          |          |                   | for glyphs. |
                    +----------+----------+-------------------+-------------+
                    | 0x88     | 4        | index_width       | The   width |
                    |          |          |                   | of     each |
                    |          |          |                   | entry    in |
                    |          |          |                   | the   char- |
                    |          |          |                   | acter index |
                    |          |          |                   | array.      |
                    +----------+----------+-------------------+-------------+
                    | 0x8C     | 4        | char_width        | Fixed width |
                    |          |          |                   | of     each |
                    |          |          |                   | character.  |
                    |          |          |                   | (If  set to |
                    |          |          |                   | 0,  charac- |
                    |          |          |                   | ters    are |
                    |          |          |                   | variable    |
                    |          |          |                   | width.)     |

                    +----------+----------+-------------------+-------------+

                    +----------+----------+-------------------+-------------+
                    | Offset   | Length   |                   |             |
                    | in Bytes | in Bytes | Field             | Description |
                    |          |          |                   |             |
                    +----------+----------+-------------------+-------------+
                    | 0x90     | 4        | char_height       | Fixed       |
                    |          |          |                   | height   of |
                    |          |          |                   | each  char- |
                    |          |          |                   | acter.  (If |
                    |          |          |                   | set  to  0, |
                    |          |          |                   | characters  |
                    |          |          |                   | are   vari- |
                    |          |          |                   | able        |
                    |          |          |                   | height.)    |
                    +----------+----------+-------------------+-------------+
                    | 0x94     | 4        | last_index        | The    last |
                    |          |          |                   | character   |
                    |          |          |                   | index    in |
                    |          |          |                   | the font.   |
                    +----------+----------+-------------------+-------------+
                    | 0x98     | 4        | codepoints_less_1 | The  number |
                    |          |          |                   | of     code |
                    |          |          |                   | points      |
                    |          |          |                   | minus 1.    |
                    +----------+----------+-------------------+-------------+
                    | 0x9C     | 16       | app_var           | For  appli- |
                    |          |          |                   | cation use. |
                    +----------+----------+-------------------+-------------+
                    | 0xAC     | 64       | pad               | Reserved    |
                    |          |          |                   | (set to 0). |
                    +----------+----------+-------------------+-------------+

     Notes:

     1.  This value  is not supported by  the Advanced Display
         Graphics Support Library or  by the X-Windows Version
         1.1 program.

     2.  This value is not  supported by the X-Windows Version
         1.1 program.

     Some  of  the  fields  in the  header  structure  require
     special values, as explained in the following list.

     glyph_format   This field has two possible values:

                    RASTER_DATA   All  glyphs  are  in  raster
                                  format bit image.

                    PK_DATA       All glyphs are in PK format.
                                  (See Note 1.)

     src_file_type  This  field  has   one  of  the  following
                    values:

                    VRM_SRC_FILE   The  origin  of  this  font
                                   file was a  VRM fonts file,
                                   provided with the AIX Oper-
                                   ating System.

                    PK_SRC_FILE    The  origin  of  this  font
                                   file was a  PK font file, a
                                   font structure generated by
                                   the    METAFONT   compiler.
                                   METAFONT  is  described  in
                                   The METAFONTbook, Donald E.
                                   Knuth, Addison  Wesley Pub-
                                   lishing Company, 1986.  For
                                   details    on    developing
                                   various  font   styles  and
                                   sizes with  METAFONT, refer
                                   to      Computer     Modern
                                   Typefaces, Donald E. Knuth,
                                   Addison  Wesley  Publishing
                                   Company, 1986.

                    X10_SRC_FILE   The  origin  of  this  font
                                   file was an  X10 font file,
                                   distributed     with    the
                                   Massachusetts  Institute of
                                   Technology        X-Windows
                                   program, Version 10.4.

                    X11_SRC_FILE   The  origin  of  this  font
                                   file was an  X11 font file,
                                   distributed     with    the
                                   Massachusetts  Institute of
                                   Technology        X-Windows
                                   program, Version 11.

                    ORIG_SRC_FILE  This is the original source
                                   file for this font.

     raster_align   Raster format glyphs  are stored beginning
                    on a 32-bit boundary with scanlines packed
                    from end to beginning.  The first scanline
                    of a  raster format  glyph is always  on a
                    32-bit boundary.  The significant scanline
                    bits begin at the boundary of the scanline
                    and continue  for the  width of  the char-
                    acter.    The   boundary  for   subsequent
                    scanlines is  defined by  the raster_align
                    field as follows:

                    NO_ALIGN     The  first scanline  is on  a
                                 32-bit  boundary  and  subse-
                                 quent   scanlines  for   this
                                 character  are   bit  packed.
                                 That is,  the second scanline
                                 begins  in the  bit following
                                 the  last  bit of  the  first
                                 scanline, the  third scanline
                                 follows the  last bit  of the
                                 second, and so on.  (See Note
                                 1.)

                    BYTE_ALIGN   The  first scanline  is on  a
                                 32-bit  boundary  and  subse-
                                 quent   scanlines  for   this
                                 character  begin on  the next

                                 8-bit boundary  following the
                                 last  bit   of  the  previous
                                 scanline.  (See Note 1.)

                    HWD_ALIGN    The  first scanline  is on  a
                                 32-bit  boundary  and  subse-
                                 quent   scanlines  for   this
                                 character  begin on  the next
                                 16-bit boundary following the
                                 last  bit   of  the  previous
                                 scanline.

                    FWD_ALIGN    The  first scanline  is on  a
                                 32-bit  boundary  and  subse-
                                 quent   scanlines  for   this
                                 character  begin on  the next
                                 32-bit boundary following the
                                 last  bit   of  the  previous
                                 scanline.  (See Note 2.)

     minbounds, maxbounds
                    These  fields  contain   the  maximum  and
                    minimum values  of each  individual BOUNDS
                    structure for all  characters in the font,
                    as explained  in the following  section on
                    the     CHAR_GLYPH     structure.      The
                    minbounds.rbearing  value,  for  instance,
                    must  exist  in  at least  one  individual
                    BOUNDS structure and the rbearing field in
                    any other individual BOUNDS structure must
                    be greater than or equal to this value.

     Character Index Array for rtfont Format

     Since the data  bytes within the data stream  are used to
     access the character index  array, the array must contain
     at least 256  entries.  Entries for which  a character is
     not defined should be set to the offset values of a valid
     default character.  One such valid offset is zero.  Since
     each font  has at least  one character defined,  there is
     always a first  character pointed to by  offset zero, the
     first character in the glyph structure.

     The  character  index  information is  contained  in  the
     CHAR_INDEX array, as defined in the rtfont.h header file.
     This structure contains the following elements:

                    +----------+----------+----------------+----------------+
                    | Offset   | Length   |                |                |
                    | in Bytes | in Bytes | Field          | Description    |
                    |          |          |                |                |
                    +----------+----------+----------------+----------------+
                    | 0x00     | 4        | CHAR_INDEX     | Character      |
                    |          |          |                | glyph   offset |
                    |          |          |                | or index modi- |
                    |          |          |                | fier.          |
                    +----------+----------+----------------+----------------+

     The low-order 28  bits of a character index  array can be
     either an offset into the  character glyph structure or a
     modifier  value that  modifies the  next offset  into the
     character index array.  The  high-order four bits of each
     entry define  how the low-order 28  bits are interpreted.
     The value of the  CHAR_INDEX field, when logically AND-ed
     with the following values, is  used to interpret the low-
     order 28 bits.

     INDBASE   Specifies a  base modifier,  such as  ANSI SG0,
               SG1, and so on.  (See Note 1.)
     INDMOD    Specifies an index modifier,  such as ANSI SS1,
               SS2, and so on.
     INDCPT    Indicates that  the data stream source  byte is
               not a code point.
     INDMASK   Specifies  an  offset  to a  glyph  whose  data
               stream source byte is a code point.

     If the data source byte is  not a code point and the low-
     order 28 bits  do not indicate a base  or index modifier,
     those bits must  be a valid offset into  the glyph struc-
     ture.

Character Index Example

     A sample data stream processing algorithm follows:

       unsigned base_modifier, index_modifier, value, n;
          Both base_modifier and index_modifier are to be initialized
          to 0 for each independent character stream to be processed;

       if  ( (n=data_stream+index_modifier+base_modifier
       )<=FONT_HEAD.last_index)
       {
          index_modifier=0;
          value=CHAR_INDEX[n|
          if  (value & INDBASEUcl.
          {
             base_modifier=value & !INDMASK
             process next character in data stream
          }
          else if  (value & INDMOD)
          {
             index_modifier=value & !INDMASK
             process next character in data stream
          }
          else
          {
             glyph_offset=value & !INDMASK
             process glyph
             process next character in data stream
          }
       }
       else
          offset into CHAR_INDEX is in error

     Character Glyph Structure for rtfont Format

     The character glyph structure contains information perti-
     nent to each character in  the font.  The information per
     character  is defined  via the  CHAR_GLYPH structure,  as
     defined in the rtfont.h header file.  This structure con-
     tains the following members:

                    +----------+----------+----------------+----------------+
                    | Offset   | Length   |                |                |
                    | in Bytes | in Bytes | Field          | Description    |
                    |          |          |                |                |
                    +----------+----------+----------------+----------------+
                    | 0x00     | 1        | pk_format_flag | METAFONT       |
                    |          |          |                | information.   |
                    |          |          |                | (See Note 1.)  |
                    +----------+----------+----------------+----------------+
                    | 0x01     | 3        | resv           | Reserved field |
                    |          |          |                | (set to 0.     |
                    +----------+----------+----------------+----------------+
                    | 0x04     | 4        | tfm            | T[E]X     font |
                    |          |          |                | metric  infor- |
                    |          |          |                | mation.   (See |
                    |          |          |                | Note 1.)       |
                    +----------+----------+----------------+----------------+

                    +----------+----------+----------------+----------------+
                    | Offset   | Length   |                |                |
                    | in Bytes | in Bytes | Field          | Description    |
                    |          |          |                |                |
                    +----------+----------+----------------+----------------+
                    | 0x08     | 20       | char_bounds    | Character      |
                    |          |          |                | BOUNDS  struc- |
                    |          |          |                | ture,  defined |
                    |          |          |                | below.         |
                    +----------+----------+----------------+----------------+
                    | 0x1C     | var      | char_bits      | Character      |
                    |          |          |                | image.         |
                    +----------+----------+----------------+----------------+

     Bounds Structure for rtfont Format

     The BOUNDS structure, referenced by the CHAR_GLYPH struc-
     ture above, is  defined in the rtfont.h  header file, and
     it contains the following members:

                    +----------+----------+----------+----------------------+
                    | Offset   | Length   |          |                      |
                    | in Bytes | in Bytes | Field    | Description          |
                    |          |          |          |                      |
                    +----------+----------+----------+----------------------+
                    | 0x00     | 4        | rbearing | Character  origin to |
                    |          |          |          | right     edge    of |
                    |          |          |          | raster.   (See  Note |
                    |          |          |          | 2.)                  |
                    +----------+----------+----------+----------------------+
                    | 0x04     | 4        | lbearing | Character  origin to |
                    |          |          |          | left edge of raster. |
                    |          |          |          | (See Note 2.)        |
                    +----------+----------+----------+----------------------+
                    | 0x08     | 4        | descent  | Baseline  to  bottom |
                    |          |          |          | edge    of   raster. |
                    |          |          |          | (See Note 2.)        |
                    +----------+----------+----------+----------------------+
                    | 0x0C     | 4        | ascent   | Baseline to top edge |
                    |          |          |          | of   raster.    (See |
                    |          |          |          | Note 2.)             |
                    +----------+----------+----------+----------------------+
                    | 0x10     | 4        | width    | Advance    to   next |
                    |          |          |          | character origin.    |
                    +----------+----------+----------+----------------------+

     The glyph,  or character data,  can be drawn  relative to
     any point  in a  given x,y  coordinate system.   The fol-
     lowing description  of the  BOUNDS variables  assumes the
     x,y position is on the  baseline of the character.  Coor-
     dinates are  positive to  the right  and positive  in the
     downward direction.   The pel box  is the area  where the
     glyph  is positioned  on the  screen when  the rtfont  is
     used.

     The following  diagram graphically  portrays each  of the
     fields in the BOUNDS structure and shows how these fields
     define the pel box, relative  to the coordinates x and y.
     In this example:

     1.  The left vertical  edge of the pel box  is located at
         "x + lbearing".

     2.  The right vertical edge of  the pel box is located at
         "x + rbearing".

     3.  The upper horizontal  edge of the pel  box is located
         at "y - ascent".

     4.  The lower horizontal  edge of the pel  box is located
         at "y + descent".

     5.  The origin  for the  next character  is at  the point
         "(x + width, y)".

     6.  The width of the pel box, which defines the number of
         scan columns, is "rbearing - lbearing + 1".

     7.  The height of  the pel box, which  defines the number
         of scan lines, is "ascent + descent + 1".

                                   ol807227

Figure  5-3.  Example of an rtfont Pel Box
(x,y) is the position from which this character's pel box is referenced.
(x1,y1) is the position for the next character's pel box reference point.

Files

/usr/include/rtfont.h         Header file for the rtfont format.

/usr/bin/vrm2rtfont           Font conversion command.

Related Information

In  this book:   "master,"  "data  stream,"  "display  symbols," "Reconfigure
(HFRCONF),"   "gsgtat,"    "gsgtxt,"  "gstatt,"   "gstext,"    "gsxtat,"  and
"gsxtxt."

The display command in AIX Operating System Commands Reference.

The discussion  of the TOC object  module format in Virtual  Resource Manager
Technical Reference.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026