Path

ez.no / ezpublish / documentation / incoming / truetype font in pdf


Truetype font in PDF

These documentation pages are no longer maintained. Please visit the new documentation site.

The aim of this document is to provide a complete description on how to embed custom fonts into a PDF document.

Requirements

- ttf2afm - available in the PDFTex utils http://www.tug.org/applications/pdftex/.
- afm2font.php - script made by eZ systems

afm2font

Installing custom font

  1. Create an empty directory and copy your true type font and the script afm2font.php into it.
  2. Run ttf2afm on the truetype font.
  3. Inspect the created .afm file :

The lines describing the character should look something like this :

C 67 ; WX 537 ; N C ; B 50 -11 524 701 ;

C 68 ; WX 574 ; N D ; B 84 0 522 689 ;

If all the lines start with C -1 you need to manually replace the -1 with the character offset.

Running afm2font.php

Run afm2font.php with the font name as the only parameter. Example:

php afm2font.php Times-Roman

A file calles php_Times-Roman.php should now have been created.

Installing the font

Copy the .ttf and the .font file created into lib/ezpdf/classes/fonts/.
The Font is now available for usage, and will automaticly be embeded in the PDF document.

Comments

I cannot find ttf2afm

I see "ttf2afm - available in the PDFTex utils http://www.tug.org/applications/pdftex/."
I cannot find anything like "ttf2afm".
The document was old?

Install new fonts?