103 |
- |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
// Optionally define a folder which contains TTF fonts
|
|
|
5 |
// mPDF will look here before looking in the usual _MPDF_TTFONTPATH
|
|
|
6 |
// Useful if you already have a folder for your fonts
|
|
|
7 |
// e.g. on Windows: define("_MPDF_SYSTEM_TTFONTS", 'C:/Windows/Fonts/');
|
|
|
8 |
// Leave undefined if not required
|
|
|
9 |
|
|
|
10 |
// define("_MPDF_SYSTEM_TTFONTS", '');
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
// Optionally set font(s) (names as defined below in $this->fontdata) to use for missing characters
|
|
|
14 |
// when using useSubstitutions. Use a font with wide coverage - dejavusanscondensed is a good start
|
|
|
15 |
// only works using subsets (otherwise would add very large file)
|
|
|
16 |
// doesn't do Indic or arabic
|
|
|
17 |
// More than 1 font can be specified but each will add to the processing time of the script
|
|
|
18 |
|
|
|
19 |
$this->backupSubsFont = array('dejavusanscondensed');
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
// Optionally set a font (name as defined below in $this->fontdata) to use for CJK characters
|
|
|
23 |
// in Plane 2 Unicode (> U+20000) when using useSubstitutions.
|
|
|
24 |
// Use a font like hannomb or sun-extb if available
|
|
|
25 |
// only works using subsets (otherwise would add very large file)
|
|
|
26 |
// Leave undefined or blank if not not required
|
|
|
27 |
|
|
|
28 |
// $this->backupSIPFont = 'sun-extb';
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
/*
|
|
|
32 |
This array defines translations from font-family in CSS or HTML
|
|
|
33 |
to the internal font-family name used in mPDF.
|
|
|
34 |
Can include as many as want, regardless of which fonts are installed.
|
|
|
35 |
By default mPDF will take a CSS/HTML font-family and remove spaces
|
|
|
36 |
and change to lowercase e.g. "Arial Unicode MS" will be recognised as
|
|
|
37 |
"arialunicodems"
|
|
|
38 |
You only need to define additional translations.
|
|
|
39 |
You can also use it to define specific substitutions e.g.
|
|
|
40 |
'frutiger55roman' => 'arial'
|
|
|
41 |
Generic substitutions (i.e. to a sans-serif or serif font) are set
|
|
|
42 |
by including the font-family in $this->sans_fonts below
|
|
|
43 |
To aid backwards compatability some are included:
|
|
|
44 |
*/
|
|
|
45 |
$this->fonttrans = array(
|
|
|
46 |
'helvetica' => 'arial',
|
|
|
47 |
'times' => 'timesnewroman',
|
|
|
48 |
'courier' => 'couriernew',
|
|
|
49 |
'trebuchet' => 'trebuchetms',
|
|
|
50 |
'comic' => 'comicsansms',
|
|
|
51 |
'franklin' => 'franklingothicbook',
|
|
|
52 |
'albertus' => 'albertusmedium',
|
|
|
53 |
'arialuni' => 'arialunicodems',
|
|
|
54 |
'zn_hannom_a' => 'hannoma',
|
|
|
55 |
'ocr-b' => 'ocrb',
|
|
|
56 |
'ocr-b10bt' => 'ocrb',
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
);
|
|
|
60 |
|
|
|
61 |
/*
|
|
|
62 |
This array lists the file names of the TrueType .ttf or .otf font files
|
|
|
63 |
for each variant of the (internal mPDF) font-family name.
|
|
|
64 |
['R'] = Regular (Normal), others are Bold, Italic, and Bold-Italic
|
|
|
65 |
Each entry must contain an ['R'] entry, but others are optional.
|
|
|
66 |
Only the font (files) entered here will be available to use in mPDF.
|
|
|
67 |
Put preferred default first in order.
|
|
|
68 |
This will be used if a named font cannot be found in any of
|
|
|
69 |
$this->sans_fonts, $this->serif_fonts or $this->mono_fonts
|
|
|
70 |
|
|
|
71 |
['indic'] = true; for special mPDF fonts containing Indic characters
|
|
|
72 |
['sip-ext'] = 'hannomb'; name a related font file containing SIP characters
|
|
|
73 |
|
|
|
74 |
If a .ttc TrueType collection file is referenced, the number of the font
|
|
|
75 |
within the collection is required. Fonts in the collection are numbered
|
|
|
76 |
starting at 1, as they appear in the .ttc file e.g.
|
|
|
77 |
"cambria" => array(
|
|
|
78 |
'R' => "cambria.ttc",
|
|
|
79 |
'B' => "cambriab.ttf",
|
|
|
80 |
'I' => "cambriai.ttf",
|
|
|
81 |
'BI' => "cambriaz.ttf",
|
|
|
82 |
'TTCfontID' => array(
|
|
|
83 |
'R' => 1,
|
|
|
84 |
),
|
|
|
85 |
),
|
|
|
86 |
"cambriamath" => array(
|
|
|
87 |
'R' => "cambria.ttc",
|
|
|
88 |
'TTCfontID' => array(
|
|
|
89 |
'R' => 2,
|
|
|
90 |
),
|
|
|
91 |
),
|
|
|
92 |
*/
|
|
|
93 |
|
|
|
94 |
$this->fontdata = array(
|
|
|
95 |
"dejavusanscondensed" => array(
|
|
|
96 |
'R' => "DejaVuSansCondensed.ttf",
|
|
|
97 |
'B' => "DejaVuSansCondensed-Bold.ttf",
|
|
|
98 |
'I' => "DejaVuSansCondensed-Oblique.ttf",
|
|
|
99 |
'BI' => "DejaVuSansCondensed-BoldOblique.ttf",
|
|
|
100 |
),
|
|
|
101 |
"dejavusans" => array(
|
|
|
102 |
'R' => "DejaVuSans.ttf",
|
|
|
103 |
'B' => "DejaVuSans-Bold.ttf",
|
|
|
104 |
'I' => "DejaVuSans-Oblique.ttf",
|
|
|
105 |
'BI' => "DejaVuSans-BoldOblique.ttf",
|
|
|
106 |
),
|
|
|
107 |
"dejavuserif" => array(
|
|
|
108 |
'R' => "DejaVuSerif.ttf",
|
|
|
109 |
'B' => "DejaVuSerif-Bold.ttf",
|
|
|
110 |
'I' => "DejaVuSerif-Italic.ttf",
|
|
|
111 |
'BI' => "DejaVuSerif-BoldItalic.ttf",
|
|
|
112 |
),
|
|
|
113 |
"dejavuserifcondensed" => array(
|
|
|
114 |
'R' => "DejaVuSerifCondensed.ttf",
|
|
|
115 |
'B' => "DejaVuSerifCondensed-Bold.ttf",
|
|
|
116 |
'I' => "DejaVuSerifCondensed-Italic.ttf",
|
|
|
117 |
'BI' => "DejaVuSerifCondensed-BoldItalic.ttf",
|
|
|
118 |
),
|
|
|
119 |
"dejavusansmono" => array(
|
|
|
120 |
'R' => "DejaVuSansMono.ttf",
|
|
|
121 |
'B' => "DejaVuSansMono-Bold.ttf",
|
|
|
122 |
'I' => "DejaVuSansMono-Oblique.ttf",
|
|
|
123 |
'BI' => "DejaVuSansMono-BoldOblique.ttf",
|
|
|
124 |
),
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
/* OCR-B font for Barcodes */
|
|
|
128 |
"ocrb" => array(
|
|
|
129 |
'R' => "ocrb10.ttf",
|
|
|
130 |
),
|
|
|
131 |
|
|
|
132 |
/* Thai fonts */
|
|
|
133 |
"garuda" => array(
|
|
|
134 |
'R' => "Garuda.ttf",
|
|
|
135 |
'B' => "Garuda-Bold.ttf",
|
|
|
136 |
'I' => "Garuda-Oblique.ttf",
|
|
|
137 |
'BI' => "Garuda-BoldOblique.ttf",
|
|
|
138 |
),
|
|
|
139 |
"norasi" => array(
|
|
|
140 |
'R' => "Norasi.ttf",
|
|
|
141 |
'B' => "Norasi-Bold.ttf",
|
|
|
142 |
'I' => "Norasi-Oblique.ttf",
|
|
|
143 |
'BI' => "Norasi-BoldOblique.ttf",
|
|
|
144 |
),
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
/* Indic fonts */
|
|
|
148 |
"ind_bn_1_001" => array(
|
|
|
149 |
'R' => "ind_bn_1_001.ttf",
|
|
|
150 |
'indic' => true,
|
|
|
151 |
),
|
|
|
152 |
"ind_hi_1_001" => array(
|
|
|
153 |
'R' => "ind_hi_1_001.ttf",
|
|
|
154 |
'indic' => true,
|
|
|
155 |
),
|
|
|
156 |
"ind_ml_1_001" => array(
|
|
|
157 |
'R' => "ind_ml_1_001.ttf",
|
|
|
158 |
'indic' => true,
|
|
|
159 |
),
|
|
|
160 |
"ind_kn_1_001" => array(
|
|
|
161 |
'R' => "ind_kn_1_001.ttf",
|
|
|
162 |
'indic' => true,
|
|
|
163 |
),
|
|
|
164 |
"ind_gu_1_001" => array(
|
|
|
165 |
'R' => "ind_gu_1_001.ttf",
|
|
|
166 |
'indic' => true,
|
|
|
167 |
),
|
|
|
168 |
"ind_or_1_001" => array(
|
|
|
169 |
'R' => "ind_or_1_001.ttf",
|
|
|
170 |
'indic' => true,
|
|
|
171 |
),
|
|
|
172 |
"ind_ta_1_001" => array(
|
|
|
173 |
'R' => "ind_ta_1_001.ttf",
|
|
|
174 |
'indic' => true,
|
|
|
175 |
),
|
|
|
176 |
"ind_te_1_001" => array(
|
|
|
177 |
'R' => "ind_te_1_001.ttf",
|
|
|
178 |
'indic' => true,
|
|
|
179 |
),
|
|
|
180 |
"ind_pa_1_001" => array(
|
|
|
181 |
'R' => "ind_pa_1_001.ttf",
|
|
|
182 |
'indic' => true,
|
|
|
183 |
),
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
/* XW Zar Arabic fonts */
|
|
|
187 |
"xbriyaz" => array(
|
|
|
188 |
'R' => "XB Riyaz.ttf",
|
|
|
189 |
'B' => "XB RiyazBd.ttf",
|
|
|
190 |
'I' => "XB RiyazIt.ttf",
|
|
|
191 |
'BI' => "XB RiyazBdIt.ttf",
|
|
|
192 |
'unAGlyphs' => true,
|
|
|
193 |
),
|
|
|
194 |
"xbzar" => array(
|
|
|
195 |
'R' => "XB Zar.ttf",
|
|
|
196 |
'B' => "XB Zar Bd.ttf",
|
|
|
197 |
'I' => "XB Zar It.ttf",
|
|
|
198 |
'BI' => "XB Zar BdIt.ttf",
|
|
|
199 |
'unAGlyphs' => true,
|
|
|
200 |
),
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
/* Examples of some CJK fonts */
|
|
|
206 |
/*
|
|
|
207 |
"unbatang_0613" => array(
|
|
|
208 |
'R' => "UnBatang_0613.ttf",
|
|
|
209 |
),
|
|
|
210 |
"sun-exta" => array(
|
|
|
211 |
'R' => "Sun-ExtA.ttf",
|
|
|
212 |
'sip-ext' => 'sun-extb',
|
|
|
213 |
),
|
|
|
214 |
"sun-extb" => array(
|
|
|
215 |
'R' => "Sun-ExtB.ttf",
|
|
|
216 |
),
|
|
|
217 |
"hannoma" => array(
|
|
|
218 |
'R' => "HAN NOM A.ttf",
|
|
|
219 |
'sip-ext' => 'hannomb',
|
|
|
220 |
),
|
|
|
221 |
"hannomb" => array(
|
|
|
222 |
'R' => "HAN NOM B.ttf",
|
|
|
223 |
),
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
'mingliu' => array (
|
|
|
227 |
'R' => 'mingliu.ttc',
|
|
|
228 |
'TTCfontID' => array (
|
|
|
229 |
'R' => 1,
|
|
|
230 |
),
|
|
|
231 |
'sip-ext' => 'mingliu-extb',
|
|
|
232 |
),
|
|
|
233 |
'pmingliu' => array (
|
|
|
234 |
'R' => 'mingliu.ttc',
|
|
|
235 |
'TTCfontID' => array (
|
|
|
236 |
'R' => 2,
|
|
|
237 |
),
|
|
|
238 |
'sip-ext' => 'pmingliu-extb',
|
|
|
239 |
),
|
|
|
240 |
'mingliu_hkscs' => array (
|
|
|
241 |
'R' => 'mingliu.ttc',
|
|
|
242 |
'TTCfontID' => array (
|
|
|
243 |
'R' => 3,
|
|
|
244 |
),
|
|
|
245 |
'sip-ext' => 'mingliu_hkscs-extb',
|
|
|
246 |
),
|
|
|
247 |
'mingliu-extb' => array (
|
|
|
248 |
'R' => 'mingliub.ttc',
|
|
|
249 |
'TTCfontID' => array (
|
|
|
250 |
'R' => 1,
|
|
|
251 |
),
|
|
|
252 |
),
|
|
|
253 |
'pmingliu-extb' => array (
|
|
|
254 |
'R' => 'mingliub.ttc',
|
|
|
255 |
'TTCfontID' => array (
|
|
|
256 |
'R' => 2,
|
|
|
257 |
),
|
|
|
258 |
),
|
|
|
259 |
'mingliu_hkscs-extb' => array (
|
|
|
260 |
'R' => 'mingliub.ttc',
|
|
|
261 |
'TTCfontID' => array (
|
|
|
262 |
'R' => 3,
|
|
|
263 |
),
|
|
|
264 |
),
|
|
|
265 |
*/
|
|
|
266 |
|
|
|
267 |
);
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
// Add fonts to this array if they contain characters in the SIP or SMP Unicode planes
|
|
|
271 |
// but you do not require them. This allows a more efficient form of subsetting to be used.
|
|
|
272 |
$this->BMPonly = array(
|
|
|
273 |
"dejavusanscondensed",
|
|
|
274 |
"dejavusans",
|
|
|
275 |
"dejavuserifcondensed",
|
|
|
276 |
"dejavuserif",
|
|
|
277 |
"dejavusansmono",
|
|
|
278 |
);
|
|
|
279 |
|
|
|
280 |
// These next 3 arrays do two things:
|
|
|
281 |
// 1. If a font referred to in HTML/CSS is not available to mPDF, these arrays will determine whether
|
|
|
282 |
// a serif/sans-serif or monospace font is substituted
|
|
|
283 |
// 2. The first font in each array will be the font which is substituted in circumstances as above
|
|
|
284 |
// (Otherwise the order is irrelevant)
|
|
|
285 |
// Use the mPDF font-family names i.e. lowercase and no spaces (after any translations in $fonttrans)
|
|
|
286 |
// Always include "sans-serif", "serif" and "monospace" etc.
|
|
|
287 |
$this->sans_fonts = array('dejavusanscondensed','dejavusans','freesans','liberationsans','sans','sans-serif','cursive','fantasy',
|
|
|
288 |
'arial','helvetica','verdana','geneva','lucida','arialnarrow','arialblack','arialunicodems',
|
|
|
289 |
'franklin','franklingothicbook','tahoma','garuda','calibri','trebuchet','lucidagrande','microsoftsansserif',
|
|
|
290 |
'trebuchetms','lucidasansunicode','franklingothicmedium','albertusmedium','xbriyaz','albasuper','quillscript'
|
|
|
291 |
|
|
|
292 |
);
|
|
|
293 |
|
|
|
294 |
$this->serif_fonts = array('dejavuserifcondensed','dejavuserif','freeserif','liberationserif','serif',
|
|
|
295 |
'timesnewroman','times','centuryschoolbookl','palatinolinotype','centurygothic',
|
|
|
296 |
'bookmanoldstyle','bookantiqua','cyberbit','cambria',
|
|
|
297 |
'norasi','charis','palatino','constantia','georgia','albertus','xbzar','algerian','garamond',
|
|
|
298 |
);
|
|
|
299 |
|
|
|
300 |
$this->mono_fonts = array('dejavusansmono','freemono','liberationmono','courier', 'mono','monospace','ocrb','ocr-b','lucidaconsole',
|
|
|
301 |
'couriernew','monotypecorsiva'
|
|
|
302 |
);
|
|
|
303 |
|
|
|
304 |
?>
|