Last change
on this file since 398 was 347, checked in by roby, 3 years ago |
Aggiornamento per compatibilità con php7.4
|
File size:
1.3 KB
|
Rev | Line | |
---|
[347] | 1 | # Font
|
---|
| 2 |
|
---|
| 3 | [back](./README.md)
|
---|
| 4 |
|
---|
| 5 | ## Creating new Font
|
---|
| 6 |
|
---|
| 7 | To create new font, you should use this tutorial from TCPDF:
|
---|
| 8 |
|
---|
| 9 | https://tcpdf.org/docs/fonts/
|
---|
| 10 |
|
---|
| 11 | ## Adding new font
|
---|
| 12 |
|
---|
| 13 | To use this new font, you must add it to Html2Pdf, by using the following method:
|
---|
| 14 |
|
---|
| 15 | ```php
|
---|
| 16 | $html2pdf->addFont($family, $style, $file);
|
---|
| 17 | ```
|
---|
| 18 |
|
---|
| 19 | The parameters are:
|
---|
| 20 |
|
---|
| 21 | Parameter| Default | Description
|
---|
| 22 | ---------|---------|-------------
|
---|
| 23 | $family | | Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
|
---|
| 24 | $style | | Font style. Possible values are (case insensitive):<ul><li>empty string: regular (default)</li><li>B: bold</li><li>I: italic</li><li>BI or IB: bold italic</li></ul>
|
---|
| 25 | $file | | The font definition file. By default, the name is built from the family and style, in lower case with no spaces.
|
---|
| 26 |
|
---|
| 27 | If you want to add font for normal and for bold style, you must call the `addFont` method twice, one for each font file.
|
---|
| 28 |
|
---|
| 29 | **WARNING**:
|
---|
| 30 | In 4em parameter constructor of Html2pdf, you must specify whether you use a Unicode font (true) or an old font (false).
|
---|
| 31 |
|
---|
| 32 | ## Using new font
|
---|
| 33 |
|
---|
| 34 | You have just to se the new font family name in your css.
|
---|
| 35 |
|
---|
| 36 | ## Setting the default font
|
---|
| 37 |
|
---|
| 38 | You can set the default font to use with the following method:
|
---|
| 39 |
|
---|
| 40 | ```php
|
---|
| 41 | $html2pdf->setDefaultFont($default);
|
---|
| 42 | ```
|
---|
| 43 |
|
---|
| 44 | [back](./README.md)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.