| 1 |
<?php |
| 2 |
|
| 3 |
// Optionally define a folder which contains TTF fonts |
| 4 |
// mPDF will look here before looking in the usual _MPDF_TTFONTPATH |
| 5 |
// Useful if you already have a folder for your fonts |
| 6 |
// e.g. on Windows: define("_MPDF_SYSTEM_TTFONTS", 'C:/Windows/Fonts/'); |
| 7 |
|
| 8 |
//if (!defined("_MPDF_SYSTEM_TTFONTS")) { define("_MPDF_SYSTEM_TTFONTS", 'C:/xampp/htdocs/common/ttffonts/'); } |
| 9 |
|
| 10 |
// Optionally set font(s) (names as defined below in $this->fontdata) to use for missing characters |
| 11 |
// when using useSubstitutions. Use a font with wide coverage - dejavusanscondensed is a good start |
| 12 |
// only works using subsets (otherwise would add very large file) |
| 13 |
// More than 1 font can be specified but each will add to the processing time of the script |
| 14 |
|
| 15 |
// $this->backupSubsFont = array('dejavusanscondensed','arialunicodems','sun-exta'); // this will recognise most scripts |
| 16 |
$this->backupSubsFont = array('dejavusanscondensed', 'freeserif'); |
| 17 |
|
| 18 |
// Optionally set a font (name as defined below in $this->fontdata) to use for CJK characters |
| 19 |
// in Plane 2 Unicode (> U+20000) when using useSubstitutions. |
| 20 |
// Use a font like hannomb or sun-extb if available |
| 21 |
// only works using subsets (otherwise would add very large file) |
| 22 |
|
| 23 |
$this->backupSIPFont = 'sun-extb'; |
| 24 |
|
| 25 |
/* |
| 26 |
This array defines translations from font-family in CSS or HTML |
| 27 |
to the internal font-family name used in mPDF. |
| 28 |
Can include as many as want, regardless of which fonts are installed. |
| 29 |
By default mPDF will take a CSS/HTML font-family and remove spaces |
| 30 |
and change to lowercase e.g. "Arial Unicode MS" will be recognised as |
| 31 |
"arialunicodems" |
| 32 |
You only need to define additional translations. |
| 33 |
You can also use it to define specific substitutions e.g. |
| 34 |
'helvetica' => 'arial' |
| 35 |
Generic substitutions (i.e. to a sans-serif or serif font) are set |
| 36 |
by including the font-family in e.g. $this->sans_fonts below |
| 37 |
*/ |
| 38 |
$this->fonttrans = array( |
| 39 |
'times' => 'timesnewroman', |
| 40 |
'courier' => 'couriernew', |
| 41 |
'trebuchet' => 'trebuchetms', |
| 42 |
'comic' => 'comicsansms', |
| 43 |
'franklin' => 'franklingothicbook', |
| 44 |
'ocr-b' => 'ocrb', |
| 45 |
'ocr-b10bt' => 'ocrb', |
| 46 |
'damase' => 'mph2bdamase', |
| 47 |
); |
| 48 |
|
| 49 |
/* |
| 50 |
This array lists the file names of the TrueType .ttf or .otf font files |
| 51 |
for each variant of the (internal mPDF) font-family name. |
| 52 |
['R'] = Regular (Normal), others are Bold, Italic, and Bold-Italic |
| 53 |
Each entry must contain an ['R'] entry, but others are optional. |
| 54 |
Only the font (files) entered here will be available to use in mPDF. |
| 55 |
Put preferred default first in order |
| 56 |
This will be used if a named font cannot be found in any of |
| 57 |
$this->sans_fonts, $this->serif_fonts or $this->mono_fonts |
| 58 |
|
| 59 |
['sip-ext'] = 'sun-extb'; name a related font file containing SIP characters |
| 60 |
['useOTL'] => 0xFF, Enable use of OTL features. |
| 61 |
['useKashida'] => 75, Enable use of kashida for text justification in Arabic text |
| 62 |
|
| 63 |
If a .ttc TrueType collection file is referenced, the number of the font |
| 64 |
within the collection is required. Fonts in the collection are numbered |
| 65 |
starting at 1, as they appear in the .ttc file e.g. |
| 66 |
"cambria" => array( |
| 67 |
'R' => "cambria.ttc", |
| 68 |
'B' => "cambriab.ttf", |
| 69 |
'I' => "cambriai.ttf", |
| 70 |
'BI' => "cambriaz.ttf", |
| 71 |
'TTCfontID' => array( |
| 72 |
'R' => 1, |
| 73 |
), |
| 74 |
), |
| 75 |
"cambriamath" => array( |
| 76 |
'R' => "cambria.ttc", |
| 77 |
'TTCfontID' => array( |
| 78 |
'R' => 2, |
| 79 |
), |
| 80 |
), |
| 81 |
*/ |
| 82 |
|
| 83 |
$this->fontdata = array( |
| 84 |
"dejavusanscondensed" => array( |
| 85 |
'R' => "DejaVuSansCondensed.ttf", |
| 86 |
'B' => "DejaVuSansCondensed-Bold.ttf", |
| 87 |
'I' => "DejaVuSansCondensed-Oblique.ttf", |
| 88 |
'BI' => "DejaVuSansCondensed-BoldOblique.ttf", |
| 89 |
'useOTL' => 0xFF, |
| 90 |
'useKashida' => 75, |
| 91 |
), |
| 92 |
"dejavusans" => array( |
| 93 |
'R' => "DejaVuSans.ttf", |
| 94 |
'B' => "DejaVuSans-Bold.ttf", |
| 95 |
'I' => "DejaVuSans-Oblique.ttf", |
| 96 |
'BI' => "DejaVuSans-BoldOblique.ttf", |
| 97 |
'useOTL' => 0xFF, |
| 98 |
'useKashida' => 75, |
| 99 |
), |
| 100 |
"dejavuserif" => array( |
| 101 |
'R' => "DejaVuSerif.ttf", |
| 102 |
'B' => "DejaVuSerif-Bold.ttf", |
| 103 |
'I' => "DejaVuSerif-Italic.ttf", |
| 104 |
'BI' => "DejaVuSerif-BoldItalic.ttf", |
| 105 |
), |
| 106 |
"dejavuserifcondensed" => array( |
| 107 |
'R' => "DejaVuSerifCondensed.ttf", |
| 108 |
'B' => "DejaVuSerifCondensed-Bold.ttf", |
| 109 |
'I' => "DejaVuSerifCondensed-Italic.ttf", |
| 110 |
'BI' => "DejaVuSerifCondensed-BoldItalic.ttf", |
| 111 |
), |
| 112 |
"dejavusansmono" => array( |
| 113 |
'R' => "DejaVuSansMono.ttf", |
| 114 |
'B' => "DejaVuSansMono-Bold.ttf", |
| 115 |
'I' => "DejaVuSansMono-Oblique.ttf", |
| 116 |
'BI' => "DejaVuSansMono-BoldOblique.ttf", |
| 117 |
'useOTL' => 0xFF, |
| 118 |
'useKashida' => 75, |
| 119 |
), |
| 120 |
"freesans" => array( |
| 121 |
'R' => "FreeSans.ttf", |
| 122 |
'B' => "FreeSansBold.ttf", |
| 123 |
'I' => "FreeSansOblique.ttf", |
| 124 |
'BI' => "FreeSansBoldOblique.ttf", |
| 125 |
'useOTL' => 0xFF, |
| 126 |
), |
| 127 |
"freeserif" => array( |
| 128 |
'R' => "FreeSerif.ttf", |
| 129 |
'B' => "FreeSerifBold.ttf", |
| 130 |
'I' => "FreeSerifItalic.ttf", |
| 131 |
'BI' => "FreeSerifBoldItalic.ttf", |
| 132 |
'useOTL' => 0xFF, |
| 133 |
'useKashida' => 75, |
| 134 |
), |
| 135 |
"freemono" => array( |
| 136 |
'R' => "FreeMono.ttf", |
| 137 |
'B' => "FreeMonoBold.ttf", |
| 138 |
'I' => "FreeMonoOblique.ttf", |
| 139 |
'BI' => "FreeMonoBoldOblique.ttf", |
| 140 |
), |
| 141 |
/* OCR-B font for Barcodes */ |
| 142 |
"ocrb" => array( |
| 143 |
'R' => "ocrb10.ttf", |
| 144 |
), |
| 145 |
/* Miscellaneous language font(s) */ |
| 146 |
"estrangeloedessa" => array(/* Syriac */ |
| 147 |
'R' => "SyrCOMEdessa.otf", |
| 148 |
'useOTL' => 0xFF, |
| 149 |
), |
| 150 |
"kaputaunicode" => array(/* Sinhala */ |
| 151 |
'R' => "kaputaunicode.ttf", |
| 152 |
'useOTL' => 0xFF, |
| 153 |
), |
| 154 |
"abyssinicasil" => array(/* Ethiopic */ |
| 155 |
'R' => "Abyssinica_SIL.ttf", |
| 156 |
'useOTL' => 0xFF, |
| 157 |
), |
| 158 |
"aboriginalsans" => array(/* Cherokee and Canadian */ |
| 159 |
'R' => "AboriginalSansREGULAR.ttf", |
| 160 |
), |
| 161 |
"jomolhari" => array(/* Tibetan */ |
| 162 |
'R' => "Jomolhari.ttf", |
| 163 |
'useOTL' => 0xFF, |
| 164 |
), |
| 165 |
"sundaneseunicode" => array(/* Sundanese */ |
| 166 |
'R' => "SundaneseUnicode-1.0.5.ttf", |
| 167 |
'useOTL' => 0xFF, |
| 168 |
), |
| 169 |
"taiheritagepro" => array(/* Tai Viet */ |
| 170 |
'R' => "TaiHeritagePro.ttf", |
| 171 |
), |
| 172 |
"aegean" => array( |
| 173 |
'R' => "Aegean.otf", |
| 174 |
'useOTL' => 0xFF, |
| 175 |
), |
| 176 |
"aegyptus" => array( |
| 177 |
'R' => "Aegyptus.otf", |
| 178 |
'useOTL' => 0xFF, |
| 179 |
), |
| 180 |
"akkadian" => array(/* Cuneiform */ |
| 181 |
'R' => "Akkadian.otf", |
| 182 |
'useOTL' => 0xFF, |
| 183 |
), |
| 184 |
"quivira" => array( |
| 185 |
'R' => "Quivira.otf", |
| 186 |
'useOTL' => 0xFF, |
| 187 |
), |
| 188 |
"eeyekunicode" => array(/* Meetei Mayek */ |
| 189 |
'R' => "Eeyek.ttf", |
| 190 |
), |
| 191 |
"lannaalif" => array(/* Tai Tham */ |
| 192 |
'R' => "lannaalif-v1-03.ttf", |
| 193 |
'useOTL' => 0xFF, |
| 194 |
), |
| 195 |
"daibannasilbook" => array(/* New Tai Lue */ |
| 196 |
'R' => "DBSILBR.ttf", |
| 197 |
), |
| 198 |
"garuda" => array(/* Thai */ |
| 199 |
'R' => "Garuda.ttf", |
| 200 |
'B' => "Garuda-Bold.ttf", |
| 201 |
'I' => "Garuda-Oblique.ttf", |
| 202 |
'BI' => "Garuda-BoldOblique.ttf", |
| 203 |
'useOTL' => 0xFF, |
| 204 |
), |
| 205 |
"khmeros" => array(/* Khmer */ |
| 206 |
'R' => "KhmerOS.ttf", |
| 207 |
'useOTL' => 0xFF, |
| 208 |
), |
| 209 |
"dhyana" => array(/* Lao fonts */ |
| 210 |
'R' => "Dhyana-Regular.ttf", |
| 211 |
'B' => "Dhyana-Bold.ttf", |
| 212 |
'useOTL' => 0xFF, |
| 213 |
), |
| 214 |
"tharlon" => array(/* Myanmar / Burmese */ |
| 215 |
'R' => "Tharlon-Regular.ttf", |
| 216 |
'useOTL' => 0xFF, |
| 217 |
), |
| 218 |
"padaukbook" => array(/* Myanmar / Burmese */ |
| 219 |
'R' => "Padauk-book.ttf", |
| 220 |
'useOTL' => 0xFF, |
| 221 |
), |
| 222 |
"zawgyi-one" => array(/* Myanmar / Burmese */ |
| 223 |
'R' => "ZawgyiOne.ttf", |
| 224 |
'useOTL' => 0xFF, |
| 225 |
), |
| 226 |
"ayar" => array(/* Myanmar / Burmese */ |
| 227 |
'R' => "ayar.ttf", |
| 228 |
'useOTL' => 0xFF, |
| 229 |
), |
| 230 |
"taameydavidclm" => array(/* Hebrew with full Niqud and Cantillation */ |
| 231 |
'R' => "TaameyDavidCLM-Medium.ttf", |
| 232 |
'useOTL' => 0xFF, |
| 233 |
), |
| 234 |
/* SMP */ |
| 235 |
"mph2bdamase" => array( |
| 236 |
'R' => "damase_v.2.ttf", |
| 237 |
), |
| 238 |
/* Indic */ |
| 239 |
"lohitkannada" => array( |
| 240 |
'R' => "Lohit-Kannada.ttf", |
| 241 |
'useOTL' => 0xFF, |
| 242 |
), |
| 243 |
"pothana2000" => array( |
| 244 |
'R' => "Pothana2000.ttf", |
| 245 |
'useOTL' => 0xFF, |
| 246 |
), |
| 247 |
/* Arabic fonts */ |
| 248 |
"xbriyaz" => array( |
| 249 |
'R' => "XB Riyaz.ttf", |
| 250 |
'B' => "XB RiyazBd.ttf", |
| 251 |
'I' => "XB RiyazIt.ttf", |
| 252 |
'BI' => "XB RiyazBdIt.ttf", |
| 253 |
'useOTL' => 0xFF, |
| 254 |
'useKashida' => 75, |
| 255 |
), |
| 256 |
"lateef" => array(/* Sindhi, Pashto and Urdu */ |
| 257 |
'R' => "LateefRegOT.ttf", |
| 258 |
'useOTL' => 0xFF, |
| 259 |
'useKashida' => 75, |
| 260 |
), |
| 261 |
"kfgqpcuthmantahanaskh" => array(/* KFGQPC Uthman Taha Naskh - Koranic */ |
| 262 |
'R' => "Uthman.otf", |
| 263 |
'useOTL' => 0xFF, |
| 264 |
'useKashida' => 75, |
| 265 |
), |
| 266 |
/* CJK fonts */ |
| 267 |
"sun-exta" => array( |
| 268 |
'R' => "Sun-ExtA.ttf", |
| 269 |
'sip-ext' => 'sun-extb', /* SIP=Plane2 Unicode (extension B) */ |
| 270 |
), |
| 271 |
"sun-extb" => array( |
| 272 |
'R' => "Sun-ExtB.ttf", |
| 273 |
), |
| 274 |
"unbatang" => array(/* Korean */ |
| 275 |
'R' => "UnBatang_0613.ttf", |
| 276 |
), |
| 277 |
"'Open Sans'" => array( |
| 278 |
'R' => "OpenSans-Regular.ttf", |
| 279 |
'B' => "OpenSans-Semibold.ttf", |
| 280 |
'I' => "OpenSans-LightItalic.ttf", |
| 281 |
'BI' => "OpenSans-Semibolditalic.ttf" |
| 282 |
), |
| 283 |
); |
| 284 |
|
| 285 |
|
| 286 |
// Add fonts to this array if they contain characters in the SIP or SMP Unicode planes |
| 287 |
// but you do not require them. This allows a more efficient form of subsetting to be used. |
| 288 |
$this->BMPonly = array( |
| 289 |
"dejavusanscondensed", |
| 290 |
"dejavusans", |
| 291 |
"dejavuserifcondensed", |
| 292 |
"dejavuserif", |
| 293 |
"dejavusansmono", |
| 294 |
); |
| 295 |
|
| 296 |
// These next 3 arrays do two things: |
| 297 |
// 1. If a font referred to in HTML/CSS is not available to mPDF, these arrays will determine whether |
| 298 |
// a serif/sans-serif or monospace font is substituted |
| 299 |
// 2. The first font in each array will be the font which is substituted in circumstances as above |
| 300 |
// (Otherwise the order is irrelevant) |
| 301 |
// Use the mPDF font-family names i.e. lowercase and no spaces (after any translations in $fonttrans) |
| 302 |
// Always include "sans-serif", "serif" and "monospace" etc. |
| 303 |
$this->sans_fonts = array('dejavusanscondensed', 'sans', 'sans-serif', 'cursive', 'fantasy', 'dejavusans', 'freesans', 'liberationsans', |
| 304 |
'arial', 'helvetica', 'verdana', 'geneva', 'lucida', 'arialnarrow', 'arialblack', 'arialunicodems', |
| 305 |
'franklin', 'franklingothicbook', 'tahoma', 'garuda', 'calibri', 'trebuchet', 'lucidagrande', 'microsoftsansserif', |
| 306 |
'trebuchetms', 'lucidasansunicode', 'franklingothicmedium', 'albertusmedium', 'xbriyaz', 'albasuper', 'quillscript', |
| 307 |
'humanist777', 'humanist777black', 'humanist777light', 'futura', 'hobo', 'segoeprint', 'opensans' |
| 308 |
); |
| 309 |
|
| 310 |
$this->serif_fonts = array('dejavuserifcondensed', 'serif', 'dejavuserif', 'freeserif', 'liberationserif', |
| 311 |
'timesnewroman', 'times', 'centuryschoolbookl', 'palatinolinotype', 'centurygothic', |
| 312 |
'bookmanoldstyle', 'bookantiqua', 'cyberbit', 'cambria', |
| 313 |
'norasi', 'charis', 'palatino', 'constantia', 'georgia', 'albertus', 'xbzar', 'algerian', 'garamond', |
| 314 |
); |
| 315 |
|
| 316 |
$this->mono_fonts = array('dejavusansmono', 'mono', 'monospace', 'freemono', 'liberationmono', 'courier', 'ocrb', 'ocr-b', 'lucidaconsole', |
| 317 |
'couriernew', 'monotypecorsiva' |
| 318 |
); |
| 319 |
|