[comp.lang.postscript] generating afm files

donley@milton.u.washington.edu (Erik Olson) (04/26/91)

I've been reading this group for a couple months now, and have seen the
regular-as-clockwork postings for:
    - "Where can I get an HPGL->PS converter?"
    - "What's that silly binary code doing on the PFB files at [archive]?"
    - "How do I make PFB files work on a postscript printer?"
    - "How do I get a PFM file -> AFM file converter?"

Rather than post the same questions, I chose to research the answers myself...
Well, I managed to figure out the answers to all of these on my own through
careful back-reading of articles, but have definitely hit a snag on the
fourth, most puzzling, problem.  From all of your info, I understand that
the PFB files do not contain all of the info as the AFM's.  I could write
some sort of converter to get a minimum amount of information back into
an AFM file, but I was thinking of another possibility:  What about
reconstructing the AFM file from the postscript font itself?  Assuming
one has a decoded type-1 or type-3 font, is this possible?  Furthermore, is
it simple, or should I spend 3 months reading Adobe font documents before
attempting this?

Oh, for the record, I am interested in doing this because I would like to
use programs such as TeX (which like afm files) with the seemingly endless
archive of PD & Shareware fonts that appear to be tailored to ATM.  Thanks
in advance for any pointers.

   Erik
-- 
Erik D. Olson					 donley@milton.u.washington.edu

	Quoth the raven... "Eat my shorts!"  "BART!!!"

jlr1801@aim1.tamu.edu (Jeff Rife) (04/29/91)

In article <1991Apr25.175643.25619@milton.u.washington.edu> donley@milton.u.washington.edu (Erik Olson) writes:
>I've been reading this group for a couple months now, and have seen the
>regular-as-clockwork postings for:
>    - "Where can I get an HPGL->PS converter?"

Try Corel Draw on a PC running under Windows 3.0.

>    - "What's that silly binary code doing on the PFB files at [archive]?"

That's part of the encoding of an Adobe Type 1 font.  It's documented.

>    - "How do I make PFB files work on a postscript printer?"

Any *real* PostScript printer should be able to use them just fine, assuming
a new enough version of the PostScript interpreter.

>    - "How do I get a PFM file -> AFM file converter?"
>
>Rather than post the same questions, I chose to research the answers myself...
>Well, I managed to figure out the answers to all of these on my own through
>careful back-reading of articles, but have definitely hit a snag on the
>fourth, most puzzling, problem.  From all of your info, I understand that
>the PFB files do not contain all of the info as the AFM's.  I could write
>some sort of converter to get a minimum amount of information back into
>an AFM file, but I was thinking of another possibility:  What about
>reconstructing the AFM file from the postscript font itself?  Assuming
>one has a decoded type-1 or type-3 font, is this possible?  Furthermore, is
>it simple, or should I spend 3 months reading Adobe font documents before
>attempting this?
>

You can't ever get all the info from the PostScript font, whether it be Type 1
or Type 3.  Unless it is explicitly added by the creator, the PostScript
font file alone does not contain any kerning information.  This is the
primary reason for Adobe Font Metrics files (created by Adobe Systems, Inc.)
and Printer Font Metric files (standard created by Hewlett-Packard, with
revisions by somebody (?) to include PostScript).

These files contain information on character widths, kerning information,
font family, font weight, italic status and angle, and other things that
applications need to know about the font.  (Let's face it, MacWrite,
FrameMaker, PageMaker, etc., couldn't care less what the letter 'A' looks
like--they just want to know how wide it is and how to kern it with a 'W'.)

It is possible to reverse engineer this stuff, but I think the best thing to
do would be to ask the designers of these file formats what they contain.
Adobe gives away the specifications to AFM and Type 1 fonts--just ask.  I
don't know about the PFM format, but I guess asking HP would work.  Once you
have the correct formats, the program would still have to use some pretty
good heuristics for the tough questions, like what if the PFM file says the
font is italic, but the PFB has "/IsItalic false def" in it?  And what if
that same PFB says "/fontname Foobar-Italic def"?

Just my $.02.

--
Jeff Rife   P.O. Box 3836   |   "Because he was human; because he had goodness;
College Station, TX 77844   |    because he was moral they called him insane.
(409) 823-2710              |    Delusions of grandeur; visons of splendor;
jlr1801@aim1.tamu.edu       |    A manic-depressive, he walks in the rain."