Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame^] | 1 | <!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>
|
| 12 | Imports a TrueType, OpenType or Type1 font and makes it available. It is necessary to generate a font
|
| 13 | definition file first with the MakeFont utility.
|
| 14 | <br>
|
| 15 | <br>
|
| 16 | The 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>
|
| 22 | If 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>
|
| 27 | Font family. The name can be chosen arbitrarily. If it is a standard family name, it will
|
| 28 | override the corresponding font.
|
| 29 | </dd>
|
| 30 | <dt><code>style</code></dt>
|
| 31 | <dd>
|
| 32 | Font 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>
|
| 39 | The default value is regular.
|
| 40 | </dd>
|
| 41 | <dt><code>file</code></dt>
|
| 42 | <dd>
|
| 43 | The name of the font definition file.
|
| 44 | <br>
|
| 45 | By 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>
|
| 49 | The directory where to load the definition file.
|
| 50 | <br>
|
| 51 | If 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->AddFont('Comic', 'I');</code></pre>
|
| 57 | </div>
|
| 58 | is equivalent to:
|
| 59 | <div class="doc-source">
|
| 60 | <pre><code>$pdf->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>
|