| 1 |
lars |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<title>html2ps/html2pdf FAQ</title>
|
|
|
4 |
<link rel="stylesheet" type="text/css" medial="all" title="Default" href="css/help.css"/>
|
|
|
5 |
</head>
|
|
|
6 |
<body>
|
|
|
7 |
<h1>HOWTO: Install custom fonts</h1>
|
|
|
8 |
<p><a href="index.html">Back to table of contents</a></p>
|
|
|
9 |
|
|
|
10 |
<div>
|
|
|
11 |
Keep in mind that most likely you will be using FPDF output method, as it covers 90% of your needs.
|
|
|
12 |
Installing fonts for PDFLIB and Postscript output methods is required only if you're using
|
|
|
13 |
non-default output driver.
|
|
|
14 |
</div>
|
|
|
15 |
|
|
|
16 |
<ol>
|
|
|
17 |
<li><a href="#fpdf">FPDF</a>
|
|
|
18 |
<li><a href="#postscript">Postscript</a></li>
|
|
|
19 |
<li><a href="#ps2pdf">Postscript (PS2PDF)</a></li>
|
|
|
20 |
<li><a href="#pdflib">PDFLIB</a>
|
|
|
21 |
</ol>
|
|
|
22 |
|
|
|
23 |
<h2 id="fpdf">FPDF output method</h2>
|
|
|
24 |
Let's assume that you're going to install Trebuchet MS for the FPDF output method.
|
|
|
25 |
<ol>
|
|
|
26 |
<li>Copy font files (<tt>trebuc.ttf</tt>, <tt>treducdb.ttf</tt>, <tt>trebucbi.ttf</tt> and <tt>trebucit.ttf</tt>)
|
|
|
27 |
to TTF_FONTS_REPOSITORY directory (by default it points to 'fonts' subdirectory)</li>
|
|
|
28 |
<li><a title="How to get AFM files?" href="howto_afm.html">Generate font metrics file</a> for these fonts files
|
|
|
29 |
and put it into the same directory. Note that metrics file should have the same name as font file and
|
|
|
30 |
extension <tt>.afm</tt> (this step is optional if you're using a html2ps version more recent than 1.9.4)</li>
|
|
|
31 |
<li>Register new font family in html2ps.config: add the following lines to <tt>html2ps.config</tt> in
|
|
|
32 |
the FONTS-PDF section (between <tt><fonts-pdf></tt> and <tt></fonts-pdf></tt> tags):
|
|
|
33 |
<pre>
|
|
|
34 |
<family name="Trebuchet MS">
|
|
|
35 |
<normal normal="TrebuchetMS" italic="TrebuchetMS-Italic" oblique="TrebuchetMS-Italic"/>
|
|
|
36 |
<bold normal="TrebuchetMS-Bold" italic="TrebuchetMS-Bold-Italic" oblique="TrebuchetMS-Bold-Italic"/>
|
|
|
37 |
</family>
|
|
|
38 |
</pre>
|
|
|
39 |
<li>
|
|
|
40 |
Register font files: add the following to the FONTS-PDF section:
|
|
|
41 |
<pre>
|
|
|
42 |
<ttf typeface="TrebuchetMS" embed="0" file="trebuc.ttf"/>
|
|
|
43 |
<ttf typeface="TrebuchetMS-Bold" embed="0" file="trebucbd.ttf"/>
|
|
|
44 |
<ttf typeface="TrebuchetMS-Italic" embed="0" file="trebucit.ttf"/>
|
|
|
45 |
<ttf typeface="TrebuchetMS-Bold-Italic" embed="0" file="trebucbi.ttf"/>
|
|
|
46 |
</pre>
|
|
|
47 |
Note that you may want to replace <tt>embed="0"</tt> with <tt>embed="1"</tt> if you intend
|
|
|
48 |
to distribute generated PDF to users without Trebuchet MS font installed in their machines.
|
|
|
49 |
</li>
|
|
|
50 |
</ol>
|
|
|
51 |
|
|
|
52 |
<h2 id="postscript">Postscript output method</h2>
|
|
|
53 |
Say you want to see the fancy "Trebuchet MS" font in your generated
|
|
|
54 |
postscript...
|
|
|
55 |
<ol>
|
|
|
56 |
<li> First of all, TrueType-compatible Ghostscript is a must. Most Ghostscipt
|
|
|
57 |
distributions are TrueType compatible. If you're not sure, ask your system
|
|
|
58 |
administrator. If your GS is not True-Type compatible, consider building from
|
|
|
59 |
source using require options. <br>
|
|
|
60 |
<br>
|
|
|
61 |
</li>
|
|
|
62 |
<li> Find the file coresponding to "Trebuchet MS". Assuming you're
|
|
|
63 |
using some version of Windows on your home machine, you can do it by opening
|
|
|
64 |
"Control Panel ... Fonts" and checking the properties of the chosen
|
|
|
65 |
font. At the top of the property page you'll see the file name - <tt>trebuc.ttf</tt>,
|
|
|
66 |
in our case. <br>
|
|
|
67 |
<br>
|
|
|
68 |
</li>
|
|
|
69 |
<li> Find the font files corresponding to the bold, italic and bold italic versions
|
|
|
70 |
of this font. Probably, it will be:<br/>
|
|
|
71 |
"Trebuchet MS Bold" -- <tt>trebucbd.ttf</tt>,<br/>
|
|
|
72 |
"Trebuchet MS Italic" -- <tt>trebucit.ttf</tt>,<br/>
|
|
|
73 |
"Trebuchet MS Bold Italic" -- <tt>trebucbi.ttf</tt><br>
|
|
|
74 |
<br/>
|
|
|
75 |
</li>
|
|
|
76 |
<li>Copy these files from the Windows fonts directory (probably C:\Windows\Fonts)
|
|
|
77 |
to the Ghostscript fonts directory (probably C:\gs\fonts). <br>
|
|
|
78 |
<br>
|
|
|
79 |
</li>
|
|
|
80 |
<li>Modify the Ghostscript fontmap file (probably C:\gs\gs8.51\lib\Fontmap,
|
|
|
81 |
assuming you're using Ghostscript version 8.51), adding the folowing lines:
|
|
|
82 |
<pre>
|
|
|
83 |
/TrebuchetMS (trebuc.ttf) ;
|
|
|
84 |
/TrebuchetMS-Italic (trebucit.ttf) ;
|
|
|
85 |
/TrebuchetMS-Bold (trebucbd.ttf) ;
|
|
|
86 |
/TrebuchetMS-Bold-Italic (trebucbi.ttf) ;
|
|
|
87 |
</pre>
|
|
|
88 |
Note you can write almost anything after the / assuming it won't interfere
|
|
|
89 |
with other font names. Say:
|
|
|
90 |
<pre>
|
|
|
91 |
/MyCoolFont1 (trebuc.ttf) ;
|
|
|
92 |
/MyCoolFont2 (trebucit.ttf) ;
|
|
|
93 |
/MyCoolFont3 (trebucbd.ttf) ;
|
|
|
94 |
/MyCoolFont4 (trebucbi.ttf) ;
|
|
|
95 |
</pre>
|
|
|
96 |
</li>
|
|
|
97 |
<li>Register the above font names in the script config file. Add the following
|
|
|
98 |
lines to <tt>html2ps.config</tt> in the FONTS section (between <tt><fonts></tt>
|
|
|
99 |
and <tt></fonts></tt> tags)
|
|
|
100 |
<pre>
|
|
|
101 |
<family name="Trebuchet MS">
|
|
|
102 |
<normal normal="TrebuchetMS" italic="TrebuchetMS-Italic" oblique="TrebuchetMS-Italic"/>
|
|
|
103 |
<bold normal="TrebuchetMS-Bold" italic="TrebuchetMS-Bold-Italic" oblique="TrebuchetMS-Bold-Italic"/>
|
|
|
104 |
</family>
|
|
|
105 |
</pre>
|
|
|
106 |
Of course, the modified file should be uploaded to the server where the working
|
|
|
107 |
script reside. <br>
|
|
|
108 |
<br>
|
|
|
109 |
<li>Register the metric files of the new TrueType fonts. To do it, add the following to the FONT section:
|
|
|
110 |
<pre>
|
|
|
111 |
<metrics typeface="TrebuchetMS" file="trebuc"/>
|
|
|
112 |
<metrics typeface="TrebuchetMS-Italic" file="trebucit"/>
|
|
|
113 |
<metrics typeface="TrebuchetMS-Bold" file="trebucbd"/>
|
|
|
114 |
<metrics typeface="TrebuchetMS-BoldItalic" file="trebucbi"/>
|
|
|
115 |
</pre>
|
|
|
116 |
In this case, the "file" value refers to the name of the font metric file (.afm) you've
|
|
|
117 |
<a title="How to get AFM files?" href="howto_afm.html">generated</a>. The ".afm" extension
|
|
|
118 |
as appended automatically; files are searched in the directory specified by TYPE1_FONTS_REPOSITORY configuration
|
|
|
119 |
constant (see your config.inc.php file).
|
|
|
120 |
</li>
|
|
|
121 |
<li> Now, the following example should be rendered using Trebuchet MS font:
|
|
|
122 |
<pre>
|
|
|
123 |
<BIG style="font-family: 'Trebuchet MS'">ABCDEFGH</BIG><br>
|
|
|
124 |
<BIG style="font-family: 'Trebuchet MS'; font-weight: bold;">ABCDEFGH</BIG><br>
|
|
|
125 |
<BIG style="font-family: 'Trebuchet MS'; font-style: italic;">ABCDEFGH</BIG><br>
|
|
|
126 |
<BIG style="font-family: 'Trebuchet MS'; font-weight: bold; font-style: italic;">ABCDEFGH</BIG><br>
|
|
|
127 |
</pre>
|
|
|
128 |
</li>
|
|
|
129 |
</ol>
|
|
|
130 |
|
|
|
131 |
<h2 id="ps2pdf">PS2PDF output method</h2>
|
|
|
132 |
|
|
|
133 |
<p>Take the steps described above with only this difference: all Ghostscript-related
|
|
|
134 |
directories are on your server where the script resides. Ask your hoster/system
|
|
|
135 |
administrator about the exact location of Ghostscript.</p>
|
|
|
136 |
|
|
|
137 |
<h2 id="pdflib">PDFLIB output method</h2>
|
|
|
138 |
<p>Please refer to PDFLib Documentation.</p>
|
|
|
139 |
|
|
|
140 |
</body>
|
|
|
141 |
</html>
|