You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

319 lines
9.9KB

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