PostScript Outline Font Downloader 
by Glynn Clements

Note: This program requires System resources. You must ensure that !System has been 'seen' before running this program. The program also requires Font Manager 2.42 or later, and a copy of the PostScript printer driver PrinterPS.

This program generates PostScript code to define a font from the definition contained in the Outlines file of a RISC OS outline font. Inclusion of the resulting code into a PostScript program results in the font being defined on the printer under its RISC OS name. As the downloaded font definition is not scaffolded or hinted, the quality will be lower than that of the built in fonts at small sizes (less than 20 point), and so the font will be more useful for headings than for large amounts of text.

When run, the program adds an icon to the icon bar. Clicking Menu over this icon displays a menu containing the usual Info and Quit options. Dragging a font file (filetype &FF6) to the icon results in a 'Save as:' dialogue box being displayed allowing the resulting PostScript file to be saved. The PostScript code is generated once the file has been saved. Note that the font must be currently available (i.e. *FontCat should list the font), otherwise the IntMetrics file will not be found.

The resulting PostScript code should be prefixed by the prolog file !FontRead.PrologF, then inserted into the PostScript file to be printed after the contents of PSProlog and PSProlog2 but before the start of the main program code. Any number of font definitions may follow the prolog file. Note that the PSProlog file should NOT map the font to be used to another font.

It should be understood that the definitions consume a large amount of the printer's memory, and so it is quite possible for a VMError to occur. There are a number of ways around this problem. The first is to delete definitions for any characters which are not required. This requires editing the file in three places. The character name contained in the encoding vector must be changed to '.notdef', The character definition must be removed from the CharDefs dictionary, and its width removed from the CharWidths dictionary.

Unfortnately the above requires a willingness to edit PostScript programs using Edit. The alternative is to use a compressed font definition. For this, the !FontRead.!RunImage file must be replaced by the file !FontRead.!RunImageC. The resulting code must be prefixed by the prolog file !FontRead.PrologC. The resulting definition will occupy less memory, but will be slower in execution.

The names by which the characters are referred to in the font definition are obtained by the following algorithm: If a character has no definition in the Outlines file, it is defined as the null character .notdef in the encoding vector. If the character is defined in the Outlines file, the character's ASCII code is used as an index into the file !FontRead.Encoding. If the entry is a valid name, it is used. If the entry is .notdef, then the name used is UnknownXXX, where XXX is the ASCII code of the character in decimal.

If for any reason the file !FontRead.Encoding is to be edited, the format must be preserved. That is there must be 256 names, each separated from the next by a single space or linefeed character.

The C source code for the program is saved as !FontRead.C_Source. The constant COMPRESS should be #defined to compile a program to use compressed definitions.
