CAVEAT: Several bugs in the description of KST format have been fixed, by EBM, 11/10/79. I looked carefully at the source code for FED and XGPSPL, and tested things out to verify the fixes, but naturally cannot take complete responsibility since I did not write the programs. Massachusetts Institute of Technology Artificial Intelligence Laboratory WORKING PAPER #78 (revision 1) 8 October, 1975 FED, the Font "EDitor" and Font Formats by Joseph D. Cohen and J. Pitts Jarvis Abstract This memo describes FED, a program used for compiling and inspecting fonts; AST font format, a text format which can be used to create and edit fonts; and KST font format, the binary format used by SCRIMP, TJ6, PUB, R, and SCRIBE. Work reported herein was conducted at the Artificial Intelligence Laboratory, a Massachusetts Institute of Technology research program supported in part by the Advanced Research Projects Agency of the Department of Defense and monitored by the Office of Naval Research under Contact number N00014-70-A-0362-0005. Working Papers are informal papers intended primarily for internal use. FED and Font Formats________________2__Font Editor and Console Operation. FED, the Font "EDitor" FED is a program used for compiling and inspecting fonts. FED understands the following font formats: AST -- text format which can be used to create and edit fonts in TECO; KST -- MITAI and CMU compiled font format, used by programs like SCRIMP, TJ6, and PUB; CMU -- a newer compiled CMU format; CU -- the newest compiled CMU format; FNT -- SAIL compiled font format; and XH -- Xerox PARC compiled font format. FED reads all formats, but writes only AST and KST. FED asks for an input file name. If the second name is AST, KST, FNT, or XH, FED assumes the input file to be in the appropriate format. If the second name is something else, FED asks what FORMAT the input file is in. If the file name is blank, FED kills itself. FED reads the file and types out various decimal data. A FIXED width font is one in which the CHARACTER WIDTH of all defined characters is the same as the CHARACTER WIDTH of a space. FED calls all other fonts VARIABLE width. FED tries to display the font on the user's terminal, if it's a TV display; or on the 340, if the user is near there, and the 340 and PDP6 are available. FED displays as though one XGP dot equals one display dot, so the size and proportion of the font will be distorted. (200 horizontal XGP dots = 1 inch, 192 vertical dots = 1 inch. ~108 horizontal 340 dots = ~108 vertical 340 dots = 1 inch. ~58 horizontal TV display dots = 1 inch. ~57 vertical TV display dots = 1 inch. A TV font display will therefore be enlarged 4 diameters over the same font on the XGP.) FED then offers to write out the font. If you type N, FED restarts itself; if you type Y, it asks for the output file name; and if anything else is typed, it repeats its offer. If you write the file, FED will offer to compact the raster. (This is a horizontal compaction accomplished by eliminating leading and trailing blank columns.) If you type Y, FED will compact the raster as much as possible, and tell you how many words the compaction will save in the XGP's PDP11. When compacting, FED will also let you know if there are any characters whose raster is wider than the defined raster width. The input default system name is FONTS, the output default system name is the job's SNAME. Input and output default second file name is KST. Please do not write new fonts onto the FONTS directory -- it is almost full. Absolutely do not modify fonts on the FONTS directory. All concerned programs are perfectly capable of reading fonts from your very own directory. The reason for this injunction is that it has been determined, after much experimentation, that the definition of "improvement" is consistently a local variable. Please keep your "improvements" to yourself. A typical FED console session looks as follows: (User typein is underlined, is a carriage return.) :fed FED 119 INPUT: jdc;ast > FORMAT: kst READING: DSK:JDC;AST 25 142 DUPLICATE CHARACTER FILE: DSK:JDC;AST 25 KSTID: 0 CHARACTERS READ: 128 HEIGHT: 25 WIDTH: (VARIABLE)10 WRITE? (Y OR N)y FILE: ast kst FILE ALREADY EXISTS. CLOBBER? (Y OR N)y WRITING: DSK:JDC;AST KST COMPACT RASTER? (Y OR N)y 2032 (OCTAL) PDP11 WORDS SAVED INPUT: :KILL AST Font Format The AST font format is a text format which can be used to create and edit fonts in TECO. An AST file has one page of font data, followed by one page of character data for each defined character. All numbers except CHARACTER CODE are decimal. It is the order of the numbers, rather than the text identification after them, that FED looks at. The identification is merely a convenience. The file's first page is font data and looks like: n KSTID dev:dir;file name n HEIGHT n BASE LINE n COLUMN POSITION ADJUSTMENT KSTID is a currently unimplemented feature. It is intended to be a unique number for each font so that PDP11 will know which fonts are loaded, and not do unnecessary reloads. KSTID is used by CMU. (KSTID should be set to 0.) FED writes, on every page of the output AST file, the file name of the source font file. On input FED ignores the file name data in AST files. HEIGHT is the height of all characters in XGP raster lines. BASE LINE is the location of the character base line in XGP raster lines from the top of all characters. (The base line is used by the XGP underscore command. See Working Paper #72, XGP Font Catalog.) COLUMN POSITION ADJUSTMENT is an artifact. It is a number which is added to the LEFT KERN of each character to get its total left kern. To be SAIL compatible, COLUMN POSITION ADJUSTMENT should be 0, and all kerning sould be included in individual character data. The rest of the file is one page of character data for each defined character. Each page looks like: n CHARACTER CODE n RASTER WIDTH n CHARACTER WIDTH n LEFT KERN * * * * * * * * * CHARACTER CODE is the octal ASCII code of the character. RASTER WIDTH is the width of the raster in XGP dots. It is a good idea to make the raster width as small as possible, in order to save space in font files, and to allow the XGP PDP11 to store more fonts. A leading blank column can be flushed if RASTER WIDTH and LEFT KERN are decremented. Trailing blank columns can be flushed by simply decrementing RASTER WIDTH. (The FED compact feature does this automatically.) CHARACTER WIDTH is the amount, in XGP dots, that printing this character will advance the line postion. This number is completely independent of RASTER WIDTH, and LEFT KERN. For example, if CHARACTER WIDTHRASTER WIDTH, there will be extra blank columns in the character. How many appear on each side is determined by LEFT KERN. LEFT KERN (plus COLUMN POSITION ADJUSTMENT, if any) is the amount to move left from the logical left end of the character before printing the raster. (Positive left kern means move left; negative, move right.) * is any printing character used to define the CHARACTER RASTER. Each raster row is represented by a text line. If a space appears, the bit is off in the raster, if a printing character appears, the bit is on. Carriage return terminates the text row, and implies blanks for the rest of the raster row. Formfeed terminates the raster, and implies trailing blank raster lines. The first row is the top row. Information wider than RASTER WIDTH is ignored. KST Font Format KST is CMU's oldest and MITAI's only compiled binary font format. SCRIMP, TJ6, PUB, and other programs all use KST files as their font definitions. KST format is as follows: Word 0/ KSTID Word 1/ 9 bits COLUMN POSITION ADJUSTMENT, 9 bits BASE LINE,,HEIGHT The remainder of the file has one block of data for each character. Each block looks like: USER ID ;not currently used but low order bit is on. This bit can be used to find the beginning of a new block. The last block is followed by two -1's. LEFT KERN,,CHARACTER CODE RASTER WIDTH,,CHARACTER WIDTH CHARACTER MATRIX The character matrix is stored four 8-bit bytes per word, so that ILDBs with 8-bit byte size get successive bytes. The remaining four low order bits are 0. The bits are reversed in each byte (because of the way the XGP interface works) so that the high order (leftmost) bit of the character is the low order bit of the byte. The matrix is stored row by row; rows follow one another with no extra separating bytes. The last word is filled out with 0 bytes, if necessary. Note that HEIGHT rows are stored for each character, and (RASTER WIDTH + 7)/8 bytes are used for each row. Some old MIT KST files, and all CMU's KST files do not use the RASTER WIDTH variable. (All characters have RASTER WIDTH=CHARACTER WIDTH.) The third word of those files has 0 in the left half. Programs which directly examine KST files for RASTER WIDTH should therefore, if RASTER WIDTH=0, use CHARACTER WIDTH instead. (Note that this also means that while MITAI can use CMU's KST files, CMU cannot use MITAI KST files.) Since when RASTER WIDTH=0, MITAI programs substitute CHARACTER WIDTH, you should not write a program which will set RASTER WIDTH to zero. When FED finds a character with zero RASTER WIDTH, FED will write the character with RASTER WIDTH=1. This does not waste any space in the XGP's PDP11, since the PDP11 does a vertical compaction of rasters, eliminating top and bottom blank lines. Odds and End The KST, FNT, XH, and FED internal formats are listed in the extravagantly commented FED source file (stored on the SYSENG directory). FED also has extensive comments on programming the PDP10 to PDP11 interface. FED was written by Pitts Jarvis, with additions by Joe Cohen. Brian Harvey is responsible for SAIL font hackery, whose specifications and fonts we copied. Fonts are stored on the FONTS; directory, and are described in Working Paper #72, XGP Font Catalog, by Tom Knight. The source file for this memo is WP;FED 78Wn, where n is the revision number. THE END