|
10 | 10 | */
|
11 | 11 | namespace wcmf\lib\pdf;
|
12 | 12 |
|
13 |
| -use setasign\Fpdi\Fpdi; |
| 13 | +use setasign\Fpdi\Tfpdf\Fpdi; |
14 | 14 |
|
15 |
| -if (!class_exists('setasign\Fpdi\Fpdi')) { |
| 15 | +if (!class_exists('setasign\Fpdi\Tfpdf\Fpdi')) { |
16 | 16 | throw new \wcmf\lib\config\ConfigurationException(
|
17 | 17 | 'wcmf\lib\pdf\PDF requires '.
|
18 |
| - 'Fpdi. If you are using composer, add setasign/fpdf and setasign/fpdi '. |
| 18 | + 'Fpdi. If you are using composer, add setasign/tfpdf and setasign/fpdi '. |
19 | 19 | 'as dependency to your project');
|
20 | 20 | }
|
21 | 21 |
|
22 | 22 | /**
|
23 |
| - * PDF extends setasign\Fpdi\Fpdi. |
| 23 | + * NOTE ON USING FONTS |
| 24 | + * |
| 25 | + * If tFPDF (https://github.com/Setasign/tFPDF) is used as base class, proceed as follows: |
| 26 | + * |
| 27 | + * 1. Create a fonts directory and set FPDF_FONTPATH accordingly: |
| 28 | + * |
| 29 | + * define('FPDF_FONTPATH', dirname(__FILE__).'/fonts/'); |
| 30 | + * |
| 31 | + * 2. Create a unifont directory inside the font directory and put ttfonts.php from the tFPDF package inside |
| 32 | + * 3. Put *.ttf fonts inside the unifont directory (no need for any conversion) and add them to the PDF instance: |
| 33 | + * |
| 34 | + * $this->AddFont('Roboto-Regular', '', 'Roboto-Regular.ttf', true); |
| 35 | + * |
| 36 | + * (NOTE the 3rd parameter holds the font file name and the 4th parameter is set to true) |
| 37 | + */ |
| 38 | + |
| 39 | + |
| 40 | +/** |
| 41 | + * PDF extends setasign\Fpdi\Tfpdf\Fpdi. |
24 | 42 | *
|
25 |
| - * @note This class requires setasign\Fpdi\Fpdi |
| 43 | + * @note This class requires setasign\Fpdi\Tfpdf\Fpdi |
26 | 44 | *
|
27 | 45 | * @author ingo herwig <[email protected]>
|
28 | 46 | */
|
@@ -157,7 +175,7 @@ public function NbLines($w, $txt) {
|
157 | 175 | if($c==' ') {
|
158 | 176 | $sep=$i;
|
159 | 177 | }
|
160 |
| - $l+=$cw[$c]; |
| 178 | + $l+=isset($cw[$c]) ? intval($cw[$c]) : 0; |
161 | 179 | if($l>$wmax) {
|
162 | 180 | if($sep==-1) {
|
163 | 181 | if($i==$j) {
|
|
0 commit comments