Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 2 years ago.
Improve this question
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.
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”.
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.
This question really belongs on superuser.com, but I'll answer it here anyway.
There's no need to install the program. You need to open a command window and type the command out there. You can probably find this under Programs->Accessories->Command Prompt.
have you run the winbuild.bat in ttf2pt1 folder? Make sure you have C++ on Win machine. Which version of ttf2ptt1 you are using?
Here is another page to generate an afm file from a ttf
TTF to AFM Converter
If you are on linux, you can download the .tgz, untar it, and then run make all
. It's pretty quick. Then, you can have a .afm file and a .pfa file by running
ttf2pt1 yourfont.ttf FontName
If you want a .pfb instead of a .pfa, you can run
ttf2pt1 -b yourfont.ttf FontName