Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

true type font (TTF) to adobe font metric(AFM) -- postscript program needed

23 views
Skip to first unread message

dougLas.L.mc...@maiL.mil

unread,
Jan 16, 2021, 7:03:09 AM1/16/21
to
Folks,

I use a document system (Lout) which requires an AFM.
(Lout is a wonderful program for generating postscript.)

I found a ttf2afm.exe, as part of the TexLive distribution.
It works for most TTFs; however, it does not work for some google TTFs.
(And TexLive is a very heavy footprint!)

Thus, I need a postscript program which takes a fontname
and outputs the AFM file for that font (or at least puts the requisite info to the postscript log).

I am a total neophyte on this postscript, so please be gentle.

luser droog

unread,
Jan 17, 2021, 12:34:40 PM1/17/21
to
I think this is going to be nearly impossible to do from within a PostScript
program. If you search the group for my thread "Interrogating a font" it goes
into the kind of font information you can gather from PostScript.

You can get a good guess for certain metrics like baseline and cap height,
but others will be harder. I was trying to generate a PDF font descriptor
and stuff like 'isItalic' (boolean) was really hard to determine just by analyzing
the glyphs (at least for me).

So, probably a better course would be a language that has bindings
for fontconfig and freetype libraries. Fontconfig helps you search the
operating system for fonts using a standardized query facility, and
freetype lets you pick apart the font for any info you might need.

This may involve some hackery to heuristically convert a PostScript
font name into the format that fontconfig wants. If needed I can dig up
some C code from xpost that does this (or at least attempts it).

dougLas.L.mc...@maiL.mil

unread,
Jan 17, 2021, 6:06:11 PM1/17/21
to
Thx,

I found a ttf2ufm.exe at http://wxcode.sourceforge.net/docs/wxpdfdoc/makefont.html
It is a stand alone exe for windows and, thus, fully meets my need.
(And it worked on the goggle font for which the ttf2afm.exe failed.)

It does include the source code for folks on linux.
It is an extension of an original program ttf2pt1.exe.


jdh3

unread,
Jan 17, 2021, 7:25:41 PM1/17/21
to
There is a script in ghostscript called printafm that also works with TTF fonts under ghostscript according to my tests.

The script calls printafm.ps in the ghostscript 9.53.3 dist that might possibly work with distiller with some modification if ghostscript is not installed. The script needs the fonts to be installed in the ghostscript search path or could be edited to relax that limitation. Or without the script do "gs -P -- printafm.ps MyFont.TTF > MyFont.AFM" for example or equivalent for Windos.
0 new messages