views:

365

answers:

4

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.

A: 

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.

Mark Ransom
+1  A: 

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”.

Arthur Reutenauer
A: 

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.

Susan
A: 

have you run the winbuild.bat in ttf2pt1 folder? Make sure you have C++ on Win machine. Which version of ttf2ptt1 you are using?

ppant