Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fonts(5) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

master

data stream

display symbols

gsgtat

gsgtxt

gstatt

gstext

gsxtat

gsxtxt

display



FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



-------------------------------------------------------------------------------
fonts



PURPOSE

Defines annotated and geometric character fonts (AIX PS/2 only).

DESCRIPTION

IBM supplies precompiled annotated text fonts with the AIX Operating System.

The system console provided by the /dev/hft device driver does not use fonts
that can be modified by the user.  The display command can be used to choose
between either a hardware-generated font which displays code page P0 or a
software-generated font which displays all the symbols in code pages P0, P1,
and P2.  See "display symbols."

The GSL-supported devices also recognize one geometric text font format that
allows you to design your own set of characters.  A geometric text font is also
known as a programmable character set (PCS) font.  The PCS font can be used on
all GSL-supported devices.

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

  o Look-up table entries are 32 bits and each describes the start of its
    raster mosaics entry, its width, and the whitespace compressed from the top
    and bottom of its raster mosaics entry.

Annotated Text Font Header

The annotated text font header is a fixed-length structure common to all
annotated text fonts for all displays.  The information in header fields are
shown in the following table.








Processed November 7, 1990        FONTS(5,F)                                  1





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+----------+---------------------------------------------+
|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                        |
|         |          |          |                                             |
+---------+----------+----------+---------------------------------------------+
|0x06     | 2        | fntid    | The name an application uses to identify 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 character 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.         |
+---------+----------+----------+---------------------------------------------+






Processed November 7, 1990        FONTS(5,F)                                  2





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+----------+---------------------------------------------+
|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

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 on         4.

Annotated Text Font Look-up Table

The look-up table immediately follows the raster mosaic.  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 (whitespace).        |
+---------+----------+----------+---------------------------------------------+
|5        | 5        | lkup_bot | The number of blank scan lines that have    |
|         |          |          | been eliminated from the bottom of this     |
|         |          |          | character raster image (whitespace).        |
+---------+----------+----------+---------------------------------------------+




Processed November 7, 1990        FONTS(5,F)                                  3





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+----------+---------------------------------------------+
|Offset   | Length   |          |                                             |
|in Bits  | in Bits  | Field    | Description                                 |
+---------+----------+----------+---------------------------------------------+
|10       | 6        | lkup_widt| Contains the width in pels of this          |
|         |          |          | particular character.                       |
+---------+----------+----------+---------------------------------------------+
|16       | 16       | lkup_ref | Byte offset from the start of the raster    |
|         |          |          | mosaics of the first scanline of the        |
|         |          |          | character's raster image.                   |
+---------+----------+----------+---------------------------------------------+

ANNOTATED TEXT EXAMPLE ONE

See Figure 3 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 character.
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 represent 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.

+-----------------------------------------------------------------------------+
|           This figure cannot be displayed properly on the screen.           |
|                      Please refer to the printed book.                      |
+-----------------------------------------------------------------------------+

Figure 3. Example of Annotated Text Font Storage

If this font is defined in a file named /usr/lpp/gsl/font_src/nrm1.9x20.s, then
compile it using the following commands:

     cd      /usr/lpp/gsl
     cc      font_src/nrm1.9x20.s  -o fonts/nrm1.9x20

Annotated Text Font Files

/usr/lpp/gsl/fonts/nrm1.4x8
                       Normal 4 by 8 micro font, compiled



Processed November 7, 1990        FONTS(5,F)                                  4





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



/usr/lpp/gsl/fonts/nrm1.6x9
                       Normal 6 by 9 font, compiled
/usr/lpp/gsl/fonts/nrm1.6x11
                       Normal 6 by 11 font, compiled
/usr/lpp/gsl/fonts/nrm1.7x15
                       Normal 7 by 15 font, compiled
/usr/lpp/gsl/fonts/nrm1.7x22
                       Normal 7 by 22 font, compiled
/usr/lpp/gsl/fonts/nrm1.8x14
                       Normal 8 by 14 font, compiled
/usr/lpp/gsl/fonts/bld1.9x20
                       Bold 9 by 20 font, compiled
/usr/lpp/gsl/fonts/erg1.9x20
                       Ergonomic 9 by 20 font, compiled
/usr/lpp/gsl/fonts/itl1.9x20
                       Italic 9 by 20 font, compiled
/usr/lpp/gsl/fonts/nrm1.9x20
                       Normal 9 by 20 font, compiled
/usr/lpp/gsl/fonts/bld1.11x23
                       Bold 11 by 23 font, compiled
/usr/lpp/gsl/fonts/nrm1.11x23
                       Normal 11 by 23 font, compiled
/usr/lpp/gsl/fonts/nrm1.12x30
                       Normal 12 by 30 font, compiled
/usr/lpp/gsl/fonts/nrm1.18x40
                       Normal 18 by 40 title font, compiled

Many of the fonts are also supplied in rotated versions (for instance,
nrm1.9x20.90 is the 90degree rotated version of nrm1.9x20).

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













Processed November 7, 1990        FONTS(5,F)                                  5





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)





          Length of definition         2 bytes
          sXXXXXX 1  sYYYYYY b         2 bytes
          sXXXXXX 1  sYYYYYY b         2 bytes
          sXXXXXX 1  sYYYYYY b         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                                  |
+---------+----------+----------+---------------------------------------------+








Processed November 7, 1990        FONTS(5,F)                                  6





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+----------+---------------------------------------------+
|Offset   | Length   |          |                                             |
|in Bytes | in Bytes | Field    | Description                                 |
+---------+----------+----------+---------------------------------------------+
|0x06     | 1        |          |                                             |
|         |          |          |   Bit  1   = 0 - EBCDIC                     |
|         |          |          |              = 1 - ASCII                    |
|         |          |          |   Bits 1-2 = Reserved                       |
|         |          |          |   Bits 3-7 = (Type) specifies the data forma|
|         |          |          |              definition for programmable    |
|         |          |          |              characters.  One is defined:   |
|         |          |          |                 '00001'B = Type 1           |
|         |          |          |                                             |
+---------+----------+----------+---------------------------------------------+
|0x07     | 1        | Reserved | Must be 0.                                  |
+---------+----------+----------+---------------------------------------------+
|0x08     | 2        | fontid   | This field identifies the programmable      |
|         |          |          | 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        | segmented| For 2-byte character sets, this byte        |
|         |          |          | contains the first byte of the 2-byte       |
|         |          |          | character 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.                           |
+---------+----------+----------+---------------------------------------------+
|0x12     | 2        | font     | The value of the font baseline in pixels in |
|         |          | baseline | the Y direction from the bottom line of the |
|         |          |          | character.  This value is used in           |
|         |          |          | conjunction with the text alignment         |
|         |          |          | function.                                   |
+---------+----------+----------+---------------------------------------------+
|0x14     | 2        | font     | The value of the font capline in pixels in  |
|         |          | capline  | the Y direction from the bottom line of the |
|         |          |          | character.  This value is used in           |
|         |          |          | conjunction with the text alignment         |
|         |          |          | function.                                   |
+---------+----------+----------+---------------------------------------------+



Processed November 7, 1990        FONTS(5,F)                                  7





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+----------+---------------------------------------------+
|Offset   | Length   |          |                                             |
|in Bytes | in Bytes | Field    | Description                                 |
+---------+----------+----------+---------------------------------------------+
|0x16     | 1        | Reserved |                                             |
+---------+----------+----------+---------------------------------------------+
|0x17     | 1        | Default  | This is the character code within this PCS  |
|         |          | error    | font that specifies the character to be     |
|         |          | code     | displayed when an invalid code is           |
|         |          | point    | encountered or the character code does not  |
|         |          |          | exist.                                      |
+---------+----------+----------+---------------------------------------------+
|0x18     | var      | Character| This field contains 2-byte offsets to each  |
|         |          | Index    | character description.  Each offset is from |
|         |          |          | the beginning of the descriptor record.     |
+---------+----------+----------+---------------------------------------------+
|var      | var      | Character| This field contains the character           |
|         |          | Descripti|ndefinitions, 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.  Characters 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 specifying 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 displayed 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 characters, the index
value should contain an offset to the default code definition.

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




Processed November 7, 1990        FONTS(5,F)                                  8





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



  2. A character index array structure, called CHAR_INDEX, which contains
    modifiers 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
    character 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.             |
+---------+----------+-------------------+------------------------------------+
|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 generated.           |
+---------+----------+-------------------+------------------------------------+
|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           |
|         |          |                   | Publishing Company, 1986.  (See    |
|         |          |                   | Note 1.)                           |
+---------+----------+-------------------+------------------------------------+
|0x24     | 4        | check_sum         | The checksum (T[E]X).  (See Note   |
|         |          |                   | 1.)                                |
+---------+----------+-------------------+------------------------------------+
|0x28     | 4        | hppp              | The number of horizontal pixels    |
|         |          |                   | per point x 2**16.  (See Note 1.)  |
+---------+----------+-------------------+------------------------------------+





Processed November 7, 1990        FONTS(5,F)                                  9





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+-------------------+------------------------------------+
|Offset   | Length   |                   |                                    |
|in Bytes | in Bytes | Field             | Description                        |
+---------+----------+-------------------+------------------------------------+
|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 properties.  (See    |
|         |          |                   | Note 1.)                           |
+---------+----------+-------------------+------------------------------------+
|0x48     | 4        | chDefault         | The default character.  (See Note  |
|         |          |                   | 1.)                                |
+---------+----------+-------------------+------------------------------------+
|0x4C     | 4        | font_Descent      | Extent below baseline for spacing. |
|         |          |                   | (See Note 1.)                      |
+---------+----------+-------------------+------------------------------------+
|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 intensity 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     |
|         |          |                   | character index array.             |
+---------+----------+-------------------+------------------------------------+




Processed November 7, 1990        FONTS(5,F)                                 10





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+-------------------+------------------------------------+
|Offset   | Length   |                   |                                    |
|in Bytes | in Bytes | Field             | Description                        |
+---------+----------+-------------------+------------------------------------+
|0x8C     | 4        | char_width        | Fixed width of each character.     |
|         |          |                   | (If set to 0, characters are       |
|         |          |                   | variable width.)                   |
+---------+----------+-------------------+------------------------------------+
|0x90     | 4        | char_height       | Fixed height of each character.    |
|         |          |                   | (If set to 0, characters are       |
|         |          |                   | variable 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 application 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 Operating 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 METAFONT Book, Donald
                            E. Knuth, Addison Wesley Publishing 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.




Processed November 7, 1990        FONTS(5,F)                                 11





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



              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 character.  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
                          subsequent 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
                          subsequent 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
                          subsequent 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
                          subsequent 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





Processed November 7, 1990        FONTS(5,F)                                 12





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



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       |
|         |          |                | modifier.                             |
+---------+----------+----------------+---------------------------------------+

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 ANDed 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 structure.

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 & INDBASEU)
     {
        base_modifier=value & !INDMASK



Processed November 7, 1990        FONTS(5,F)                                 13





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



        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 pertinent 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 contains 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 information.  (See  |
|         |          |                | Note 1.)                              |
+---------+----------+----------------+---------------------------------------+
|0x08     | 20       | char_bounds    | Character BOUNDS structure, defined   |
|         |          |                | below.                                |
+---------+----------+----------------+---------------------------------------+
|0x1C     | var      | char_bits      | Character image.                      |
+---------+----------+----------------+---------------------------------------+

Bounds Structure for rtfont Format

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










Processed November 7, 1990        FONTS(5,F)                                 14





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)



+---------+----------+----------+---------------------------------------------+
|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 following description of the BOUNDS variables assumes
the x,y position is on the baseline of the character.  Coordinates 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".


+-----------------------------------------------------------------------------+
|           This figure cannot be displayed properly on the screen.           |
|                      Please refer to the printed book.                      |
+-----------------------------------------------------------------------------+

Figure 4. Example of an Rtfont Pel Box



Processed November 7, 1990        FONTS(5,F)                                 15





FONTS(5,F)                  AIX Technical Reference                  FONTS(5,F)




(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," "gsgtat,"
"gsgtxt," "gstatt,"  "gstext,"  "gsxtat," and "gsxtxt."

The display command in AIX Operating System Commands Reference.







































Processed November 7, 1990        FONTS(5,F)                                 16



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