[comp.lang.postscript] How to convert Adbobe binary fonts into ASCII

ted@mitre-bedford.ARPA (Edward J. Ede) (01/14/88)

I wanted to download fonts from our VAX running VMS and got the same
run-around from Adobe.  Their technical support was less than helpful,
saying "We do not support that environment", and they offered to return
our money.  I then spoke with a friend who had a copy of Adobe's
internal document "Supporting Downloadable PostScript Fonts" (G. Reid
8/14/87).  It contains info on how to manage multiple fonts (they eat
a lot of memory) and the format of the font file.

The new Adobe fonts are stored on disk in a part-binary/part-ascii
format.  They need to be converted to full ascii to be downloaded via
serial lines.

The data for the font is (generally, see below) kept in the resource
fork of the file.  The resources are of type 'POST' and their ids
begin with 501 and increse by 1.  The first (16 bit) word of each
resource is a tag.  The rest of the resource is the data.  The tag can
have the following 6 values.

Value    Description
-----    -----------
  0  	 Comment 	Can be ignored.
  1	 ASCII text 	Just copy the rest of the resource, less the tag,
		     	to the output file.
  2      Binary, eight-bit data.  Rest of resource needs to be hexified**.
  3 	 End of file 
  4      the font is in the data fork of the file 
  5      End of font

** To hexify data take an eight bit byte and convert it to its two
hexadecimal characters.  (E.g.  10100001 = 161 = 'A1' = 65||49)
(Note: To keep record lengths manageable, after hexifying 40 bytes into
80 characters, we wrote a carriage return to the file.)

In general, resource 501 is ASCII and contains the font dictionaries.
Resources 502 through 5nn-2 contain binary data (usually 2048 bytes).
Resource 5nn-1 is ASCII and contains a bunch of zeros  (character 48)
and a few line of postscript.  Resource 5nn contains the tag 5.

We wrote a quick and dirty lightspeed pascal program to do this.  (The
hexification code was done in assembler for speed.)  The file uploaded
easily using kermit, and works like a charm.  It takes a while to send
80k of font data to the printer at 9600 baud though...

I will try to get permission from the powers that be to release this
utility to the general public. 

#include 'std_disclaimer.h'

Ted Ede -- ted@mitre-bedford.arpa -- The MITRE Corporation -- Burlington Road  
|        -- Bedford MA, 01730 -- Mail Stop B015 -- (617) 271-2524 --        |
|                   - this line intentionally left blank -                  |
+---------------------------------------------------------------------------+