Chris@909
|
1 To embed TrueType fonts (.TTF) files, you need to extract the font metrics and
|
Chris@909
|
2 build the required tables using the provided utility (/fonts/ttf2ufm).
|
Chris@909
|
3
|
Chris@909
|
4 TTF2UFM is a modified version of Mark Heath's TTF 2 PT1 converter
|
Chris@909
|
5 (http://ttf2pt1.sourceforge.net/) by Steven Wittens <steven@acko.net>
|
Chris@909
|
6 (http://www.acko.net/blog/ufpdf). ttf2ufm, is included in /ttf2ufm-src.
|
Chris@909
|
7 The /fonts/ttf2ufm folder contains a compiled Windows binary.
|
Chris@909
|
8 TTF 2 UFM is identical to TTF 2 PT1 except that it also generates a .ufm file
|
Chris@909
|
9 for usage with makefontuni.php or makefontuni.rb.
|
Chris@909
|
10
|
Chris@909
|
11
|
Chris@909
|
12 Setting up a Truetype font for usage with UFPDF:
|
Chris@909
|
13 1) Generate the font's .ufm metrics file by processing it with the provided
|
Chris@909
|
14 ttf2ufm program (modified ttf2pt1). For example:
|
Chris@909
|
15 $ ttf2ufm -a -F myfont.ttf
|
Chris@909
|
16
|
Chris@909
|
17 2) Run makefontuni_ruby.php with the .ttf and .ufm filenames as argument:
|
Chris@909
|
18 $ php -q makefontuni_ruby.php myfont.ttf myfont.ufm
|
Chris@909
|
19
|
Chris@909
|
20 3) Copy the resulting .rb, .z and .ctg.z file to the TCPDF font directory.
|
Chris@909
|
21
|
Chris@909
|
22 4) Rename php font files variations for bold and italic using the following schema:
|
Chris@909
|
23 [basic-font-name]b.rb for bold variation
|
Chris@909
|
24 [basic-font-name]i.rb for oblique variation
|
Chris@909
|
25 [basic-font-name]bi.rb for bold oblique variation
|
Chris@909
|
26
|
Chris@909
|
27 5) Rename the name of the font in the first line of each .rb file:
|
Chris@909
|
28 TCPDFFontDescriptor.define('dtlargotitalic') do |font|
|
Chris@909
|
29 becomes:
|
Chris@909
|
30 TCPDFFontDescriptor.define('dtlargoti') do |font|
|