M.I.T. FONT FILES: THE KST FORMAT Each KST font file (usually has "KST" as its second filename) has the following general format, regardless of type style or size: a two-word header ("word" means 36-bit PDP-10 word) an arbitrary number of character blocks (up to 128.), of a variable number of words each an end-of-file flag, the number -1 (77777777777777777777 octal) (however, there have always been two such flags at the end of all KST font files, and should continue that way). THE HEADER The first word is the "KSTID", which is ignored by all programs at M.I.T. It is normally zero. The second word contains the Column Position Adjust (CPA), which is 0 for all of our files, the baseline (BL) of the font, and the height (HT) of the font. Arrangment is as 0 8 9 17 18 35 ------------------------------------------ | CPA | BL | HT | ------------------------------------------ The height is the total number of scan lines required by any character in the font, and is the number of scan lines contained in each character block which follows. The basseline gives the number of scan lines ABOVE the baseline for every character in the font. THE CHARACTER BLOCK Each character block has a three-word header. The first word is a 1, which serves as a convenient separator between character blocks. [This is because only the high 32. bits of each raster word are used, with the low 4 being zero.] The second word contains the left kern (LK) for the character, and the Ascii code: 0 17 18 35 ------------------------------------------ | LK | Ascii char code | ------------------------------------------ The third word contains the raster width (RW) for the character, and its character width (CW): 0 17 18 35 ------------------------------------------ | RW | CW | ------------------------------------------ The left kern gives the number of units (XGP points) to start the actual raster display to the LEFT of the current character position. A negative number means to start the raster to the right of the current position abs(LK) units. The raster width gives the number of bits which occur in each line of the following raster array for the character. The character width is the number of units to advance the current position after the character is printed. NOTE: CW is not measured from where the raster actually is placed, but from the current character position; that is, the LK is totally ignored when advancing the current position. This means that, in general, adjusting the left kern of a character requires changing its CW as well. After this three-word header comes the actual raster display. There are HT lines, each of RW bits. The bits are grouped into 8-bit bytes, with four bytes per PDP-10 word. The low 4 bits of each word in the raster display MUST be zero. The bytes in each word correspond left to right with bits from the raster matrix (that is, bytes are used left to right in printing each line of the character). However, within each byte the bits are REVERSED, so are used right to left within the byte. This is an artifact of the way the bytes are shipped to the PDP-11 running the XGP. If RW is not a multiple of 8 bits, the remaining bits in the last byte of each scan line are zero. Each scan line begins on a new 8-bit byte. After the last scan line, remaining bytes in the word are zero. The next word after the last scan line will be either a 1, signalling the next character block, or -1 for the end-of-file (followed by another -1). NOTES * The order of the character blocks within the file is not significant (that is, they don't have to be in "alphabetical" order). * The low order bits in each raster display word must be zero; unused bits in scan line raster must be zero. * Not all 128. Ascii characters need to be defined in the file. * Each raster display must have HT lines, even if those below the baseline are zero (unlike the AST files in this respect).