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

    From dougLas.L.mc...@maiL.mil@dougLas.L.mcaLLaster.civ@mail.mil to comp.lang.postscript on Sat Jan 16 04:03:08 2021
    From Newsgroup: comp.lang.postscript

    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.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From luser droog@luser.droog@gmail.com to comp.lang.postscript on Sun Jan 17 09:34:39 2021
    From Newsgroup: comp.lang.postscript

    On Saturday, January 16, 2021 at 6:03:09 AM UTC-6, dougLas.L.mc...@maiL.mil wrote:
    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.

    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).
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From dougLas.L.mc...@maiL.mil@dougLas.L.mcaLLaster.civ@mail.mil to comp.lang.postscript on Sun Jan 17 15:06:10 2021
    From Newsgroup: comp.lang.postscript

    On Sunday, January 17, 2021 at 12:34:40 PM UTC-5, luser droog wrote:
    On Saturday, January 16, 2021 at 6:03:09 AM UTC-6, dougLas.L.mc...@maiL.mil wrote:
    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.
    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).
    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.


    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From jdh3@inspironwuxga@gmail.com to comp.lang.postscript on Sun Jan 17 16:25:40 2021
    From Newsgroup: comp.lang.postscript

    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.
    --- Synchronet 3.21d-Linux NewsLink 1.2