config_fonts.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. "dejavusanscondensed" => array(
  74. 'R' => "DejaVuSansCondensed.ttf",
  75. 'B' => "DejaVuSansCondensed-Bold.ttf",
  76. 'I' => "DejaVuSansCondensed-Oblique.ttf",
  77. 'BI' => "DejaVuSansCondensed-BoldOblique.ttf",
  78. 'useOTL' => 0xFF,
  79. 'useKashida' => 75,
  80. ),
  81. "dejavusans" => array(
  82. 'R' => "DejaVuSans.ttf",
  83. 'B' => "DejaVuSans-Bold.ttf",
  84. 'I' => "DejaVuSans-Oblique.ttf",
  85. 'BI' => "DejaVuSans-BoldOblique.ttf",
  86. 'useOTL' => 0xFF,
  87. 'useKashida' => 75,
  88. ),
  89. "dejavuserif" => array(
  90. 'R' => "DejaVuSerif.ttf",
  91. 'B' => "DejaVuSerif-Bold.ttf",
  92. 'I' => "DejaVuSerif-Italic.ttf",
  93. 'BI' => "DejaVuSerif-BoldItalic.ttf",
  94. ),
  95. "dejavuserifcondensed" => array(
  96. 'R' => "DejaVuSerifCondensed.ttf",
  97. 'B' => "DejaVuSerifCondensed-Bold.ttf",
  98. 'I' => "DejaVuSerifCondensed-Italic.ttf",
  99. 'BI' => "DejaVuSerifCondensed-BoldItalic.ttf",
  100. ),
  101. "dejavusansmono" => array(
  102. 'R' => "DejaVuSansMono.ttf",
  103. 'B' => "DejaVuSansMono-Bold.ttf",
  104. 'I' => "DejaVuSansMono-Oblique.ttf",
  105. 'BI' => "DejaVuSansMono-BoldOblique.ttf",
  106. 'useOTL' => 0xFF,
  107. 'useKashida' => 75,
  108. ),
  109. "freesans" => array(
  110. 'R' => "FreeSans.ttf",
  111. 'B' => "FreeSansBold.ttf",
  112. 'I' => "FreeSansOblique.ttf",
  113. 'BI' => "FreeSansBoldOblique.ttf",
  114. 'useOTL' => 0xFF,
  115. ),
  116. "freeserif" => array(
  117. 'R' => "FreeSerif.ttf",
  118. 'B' => "FreeSerifBold.ttf",
  119. 'I' => "FreeSerifItalic.ttf",
  120. 'BI' => "FreeSerifBoldItalic.ttf",
  121. 'useOTL' => 0xFF,
  122. 'useKashida' => 75,
  123. ),
  124. "freemono" => array(
  125. 'R' => "FreeMono.ttf",
  126. 'B' => "FreeMonoBold.ttf",
  127. 'I' => "FreeMonoOblique.ttf",
  128. 'BI' => "FreeMonoBoldOblique.ttf",
  129. ),
  130. /* OCR-B font for Barcodes */
  131. "ocrb" => array(
  132. 'R' => "ocrb10.ttf",
  133. ),
  134. /* Miscellaneous language font(s) */
  135. "estrangeloedessa" => array(/* Syriac */
  136. 'R' => "SyrCOMEdessa.otf",
  137. 'useOTL' => 0xFF,
  138. ),
  139. "kaputaunicode" => array(/* Sinhala */
  140. 'R' => "kaputaunicode.ttf",
  141. 'useOTL' => 0xFF,
  142. ),
  143. "abyssinicasil" => array(/* Ethiopic */
  144. 'R' => "Abyssinica_SIL.ttf",
  145. 'useOTL' => 0xFF,
  146. ),
  147. "aboriginalsans" => array(/* Cherokee and Canadian */
  148. 'R' => "AboriginalSansREGULAR.ttf",
  149. ),
  150. "jomolhari" => array(/* Tibetan */
  151. 'R' => "Jomolhari.ttf",
  152. 'useOTL' => 0xFF,
  153. ),
  154. "sundaneseunicode" => array(/* Sundanese */
  155. 'R' => "SundaneseUnicode-1.0.5.ttf",
  156. 'useOTL' => 0xFF,
  157. ),
  158. "taiheritagepro" => array(/* Tai Viet */
  159. 'R' => "TaiHeritagePro.ttf",
  160. ),
  161. "aegean" => array(
  162. 'R' => "Aegean.otf",
  163. 'useOTL' => 0xFF,
  164. ),
  165. "aegyptus" => array(
  166. 'R' => "Aegyptus.otf",
  167. 'useOTL' => 0xFF,
  168. ),
  169. "akkadian" => array(/* Cuneiform */
  170. 'R' => "Akkadian.otf",
  171. 'useOTL' => 0xFF,
  172. ),
  173. "quivira" => array(
  174. 'R' => "Quivira.otf",
  175. 'useOTL' => 0xFF,
  176. ),
  177. "eeyekunicode" => array(/* Meetei Mayek */
  178. 'R' => "Eeyek.ttf",
  179. ),
  180. "lannaalif" => array(/* Tai Tham */
  181. 'R' => "lannaalif-v1-03.ttf",
  182. 'useOTL' => 0xFF,
  183. ),
  184. "daibannasilbook" => array(/* New Tai Lue */
  185. 'R' => "DBSILBR.ttf",
  186. ),
  187. "garuda" => array(/* Thai */
  188. 'R' => "Garuda.ttf",
  189. 'B' => "Garuda-Bold.ttf",
  190. 'I' => "Garuda-Oblique.ttf",
  191. 'BI' => "Garuda-BoldOblique.ttf",
  192. 'useOTL' => 0xFF,
  193. ),
  194. "khmeros" => array(/* Khmer */
  195. 'R' => "KhmerOS.ttf",
  196. 'useOTL' => 0xFF,
  197. ),
  198. "dhyana" => array(/* Lao fonts */
  199. 'R' => "Dhyana-Regular.ttf",
  200. 'B' => "Dhyana-Bold.ttf",
  201. 'useOTL' => 0xFF,
  202. ),
  203. "tharlon" => array(/* Myanmar / Burmese */
  204. 'R' => "Tharlon-Regular.ttf",
  205. 'useOTL' => 0xFF,
  206. ),
  207. "padaukbook" => array(/* Myanmar / Burmese */
  208. 'R' => "Padauk-book.ttf",
  209. 'useOTL' => 0xFF,
  210. ),
  211. "zawgyi-one" => array(/* Myanmar / Burmese */
  212. 'R' => "ZawgyiOne.ttf",
  213. 'useOTL' => 0xFF,
  214. ),
  215. "ayar" => array(/* Myanmar / Burmese */
  216. 'R' => "ayar.ttf",
  217. 'useOTL' => 0xFF,
  218. ),
  219. "taameydavidclm" => array(/* Hebrew with full Niqud and Cantillation */
  220. 'R' => "TaameyDavidCLM-Medium.ttf",
  221. 'useOTL' => 0xFF,
  222. ),
  223. /* SMP */
  224. "mph2bdamase" => array(
  225. 'R' => "damase_v.2.ttf",
  226. ),
  227. /* Indic */
  228. "lohitkannada" => array(
  229. 'R' => "Lohit-Kannada.ttf",
  230. 'useOTL' => 0xFF,
  231. ),
  232. "pothana2000" => array(
  233. 'R' => "Pothana2000.ttf",
  234. 'useOTL' => 0xFF,
  235. ),
  236. /* Arabic fonts */
  237. "xbriyaz" => array(
  238. 'R' => "XB Riyaz.ttf",
  239. 'B' => "XB RiyazBd.ttf",
  240. 'I' => "XB RiyazIt.ttf",
  241. 'BI' => "XB RiyazBdIt.ttf",
  242. 'useOTL' => 0xFF,
  243. 'useKashida' => 75,
  244. ),
  245. "lateef" => array(/* Sindhi, Pashto and Urdu */
  246. 'R' => "LateefRegOT.ttf",
  247. 'useOTL' => 0xFF,
  248. 'useKashida' => 75,
  249. ),
  250. "kfgqpcuthmantahanaskh" => array(/* KFGQPC Uthman Taha Naskh - Koranic */
  251. 'R' => "Uthman.otf",
  252. 'useOTL' => 0xFF,
  253. 'useKashida' => 75,
  254. ),
  255. /* CJK fonts */
  256. "sun-exta" => array(
  257. 'R' => "Sun-ExtA.ttf",
  258. 'sip-ext' => 'sun-extb', /* SIP=Plane2 Unicode (extension B) */
  259. ),
  260. "sun-extb" => array(
  261. 'R' => "Sun-ExtB.ttf",
  262. ),
  263. "unbatang" => array(/* Korean */
  264. 'R' => "UnBatang_0613.ttf",
  265. ),
  266. );
  267. // Add fonts to this array if they contain characters in the SIP or SMP Unicode planes
  268. // but you do not require them. This allows a more efficient form of subsetting to be used.
  269. $this->BMPonly = array(
  270. "dejavusanscondensed",
  271. "dejavusans",
  272. "dejavuserifcondensed",
  273. "dejavuserif",
  274. "dejavusansmono",
  275. );
  276. // These next 3 arrays do two things:
  277. // 1. If a font referred to in HTML/CSS is not available to mPDF, these arrays will determine whether
  278. // a serif/sans-serif or monospace font is substituted
  279. // 2. The first font in each array will be the font which is substituted in circumstances as above
  280. // (Otherwise the order is irrelevant)
  281. // Use the mPDF font-family names i.e. lowercase and no spaces (after any translations in $fonttrans)
  282. // Always include "sans-serif", "serif" and "monospace" etc.
  283. $this->sans_fonts = array('dejavusanscondensed', 'sans', 'sans-serif', 'cursive', 'fantasy', 'dejavusans', 'freesans', 'liberationsans',
  284. 'arial', 'helvetica', 'verdana', 'geneva', 'lucida', 'arialnarrow', 'arialblack', 'arialunicodems',
  285. 'franklin', 'franklingothicbook', 'tahoma', 'garuda', 'calibri', 'trebuchet', 'lucidagrande', 'microsoftsansserif',
  286. 'trebuchetms', 'lucidasansunicode', 'franklingothicmedium', 'albertusmedium', 'xbriyaz', 'albasuper', 'quillscript',
  287. 'humanist777', 'humanist777black', 'humanist777light', 'futura', 'hobo', 'segoeprint'
  288. );
  289. $this->serif_fonts = array('dejavuserifcondensed', 'serif', 'dejavuserif', 'freeserif', 'liberationserif',
  290. 'timesnewroman', 'times', 'centuryschoolbookl', 'palatinolinotype', 'centurygothic',
  291. 'bookmanoldstyle', 'bookantiqua', 'cyberbit', 'cambria',
  292. 'norasi', 'charis', 'palatino', 'constantia', 'georgia', 'albertus', 'xbzar', 'algerian', 'garamond',
  293. );
  294. $this->mono_fonts = array('dejavusansmono', 'mono', 'monospace', 'freemono', 'liberationmono', 'courier', 'ocrb', 'ocr-b', 'lucidaconsole',
  295. 'couriernew', 'monotypecorsiva'
  296. );