Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating .afm from .ttf [closed]

I'm working with generating .pdf's from PHP using this library: http://www.fpdf.org/

I am currently hung up, though, on adding new fonts, specifically the step on generating the .afm file from a .ttf font file.

I'm following the instructions here: http://www.fpdf.org/en/tutorial/tuto7.htm Which state:

The first step for a TrueType consists in generating the AFM file. A utility exists to do this task: ttf2pt1. The Windows binary is available here. The command line to use is the following:

ttf2pt1 -a font.ttf font

For example, for Comic Sans MS Regular:

ttf2pt1 -a c:\windows\fonts\comic.ttf comic

Two files are created; the one we are interested in is comic.afm.

I can't - or am unsure how to - get ttf2pt1 to load. I'm on a mac but running Win XP via vmware... and when I run the ttf2pt1.exe file over in Windows it loads command line and then quickly closes. Is there some procedure I need to do to install it? I'm not well versed in Win command line.

like image 565
sbuck Avatar asked Nov 04 '09 20:11

sbuck


People also ask

How do I open a TTF file?

You can open a TTF file in Microsoft Windows Font Viewer (Windows), Apple Font Book (Mac), or iFont (iOS, Android). Before opening a TTF file in Windows Font Viewer, you must place the file in the C:/​Windows/​Fonts directory. Otherwise, Windows will not recognize the file as a valid font file.


2 Answers

FontForge worked, but then I also realized I didn't need to through any of this work. http://fpdf.fruit-lab.de/ will generate all the necessary files.

like image 175
sbuck Avatar answered Oct 21 '22 10:10

sbuck


You can also do that using FontForge. It's a full-fledged font editor, that lets you convert between many formats. If you open your TrueType font in it, you can generate an AFM file by using Generate Font and choosing PFA or PFB, and checking “generate AFM”.

like image 44
Arthur Reutenauer Avatar answered Oct 21 '22 09:10

Arthur Reutenauer