config_fonts.php 8.6 KB

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