blob: 1ce0505ed2402d6479d45f58b0bc97de4ebc5406 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>AddFont</title>
6<link type="text/css" rel="stylesheet" href="../fpdf.css">
7</head>
8<body>
9<h1>AddFont</h1>
10<code>AddFont(<b>string</b> family [, <b>string</b> style [, <b>string</b> file [, <b>string</b> dir]]])</code>
11<h2>Description</h2>
12Imports a TrueType, OpenType or Type1 font and makes it available. It is necessary to generate a font
13definition file first with the MakeFont utility.
14<br>
15<br>
16The definition file (and the font file itself in case of embedding) must be present in:
17<ul>
18<li>The directory indicated by the 4th parameter (if that parameter is set)</li>
19<li>The directory indicated by the <code>FPDF_FONTPATH</code> constant (if that constant is defined)</li>
20<li>The <code>font</code> directory located in the same directory as <code>fpdf.php</code></li>
21</ul>
22If the file is not found, the error "Could not include font definition file" is raised.
23<h2>Parameters</h2>
24<dl class="param">
25<dt><code>family</code></dt>
26<dd>
27Font family. The name can be chosen arbitrarily. If it is a standard family name, it will
28override the corresponding font.
29</dd>
30<dt><code>style</code></dt>
31<dd>
32Font style. Possible values are (case insensitive):
33<ul>
34<li>empty string: regular</li>
35<li><code>B</code>: bold</li>
36<li><code>I</code>: italic</li>
37<li><code>BI</code> or <code>IB</code>: bold italic</li>
38</ul>
39The default value is regular.
40</dd>
41<dt><code>file</code></dt>
42<dd>
43The name of the font definition file.
44<br>
45By default, it is built from the family and style, in lower case with no space.
46</dd>
47<dt><code>dir</code></dt>
48<dd>
49The directory where to load the definition file.
50<br>
51If not specified, the default directory will be used.
52</dd>
53</dl>
54<h2>Example</h2>
55<div class="doc-source">
56<pre><code>$pdf-&gt;AddFont('Comic', 'I');</code></pre>
57</div>
58is equivalent to:
59<div class="doc-source">
60<pre><code>$pdf-&gt;AddFont('Comic', 'I', 'comici.php');</code></pre>
61</div>
62<h2>See also</h2>
63<a href="setfont.htm">SetFont</a>
64<hr style="margin-top:1.5em">
65<div style="text-align:center"><a href="index.htm">Index</a></div>
66</body>
67</html>