選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

232 行
7.7KB

  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. ),
  79. "dejavusans" => array(
  80. 'R' => "DejaVuSans.ttf",
  81. 'B' => "DejaVuSans-Bold.ttf",
  82. 'I' => "DejaVuSans-Oblique.ttf",
  83. 'BI' => "DejaVuSans-BoldOblique.ttf",
  84. ),
  85. "dejavuserif" => array(
  86. 'R' => "DejaVuSerif.ttf",
  87. 'B' => "DejaVuSerif-Bold.ttf",
  88. 'I' => "DejaVuSerif-Italic.ttf",
  89. 'BI' => "DejaVuSerif-BoldItalic.ttf",
  90. ),
  91. "dejavuserifcondensed" => array(
  92. 'R' => "DejaVuSerifCondensed.ttf",
  93. 'B' => "DejaVuSerifCondensed-Bold.ttf",
  94. 'I' => "DejaVuSerifCondensed-Italic.ttf",
  95. 'BI' => "DejaVuSerifCondensed-BoldItalic.ttf",
  96. ),
  97. "dejavusansmono" => array(
  98. 'R' => "DejaVuSansMono.ttf",
  99. 'B' => "DejaVuSansMono-Bold.ttf",
  100. 'I' => "DejaVuSansMono-Oblique.ttf",
  101. 'BI' => "DejaVuSansMono-BoldOblique.ttf",
  102. ),
  103. "freesans" => array(
  104. 'R' => "FreeSans.ttf",
  105. 'B' => "FreeSansBold.ttf",
  106. 'I' => "FreeSansOblique.ttf",
  107. 'BI' => "FreeSansBoldOblique.ttf",
  108. ),
  109. "freeserif" => array(
  110. 'R' => "FreeSerif.ttf",
  111. 'B' => "FreeSerifBold.ttf",
  112. 'I' => "FreeSerifItalic.ttf",
  113. 'BI' => "FreeSerifBoldItalic.ttf",
  114. ),
  115. "freemono" => array(
  116. 'R' => "FreeMono.ttf",
  117. 'B' => "FreeMonoBold.ttf",
  118. 'I' => "FreeMonoOblique.ttf",
  119. 'BI' => "FreeMonoBoldOblique.ttf",
  120. ),
  121. /* OCR-B font for Barcodes */
  122. "ocrb" => array(
  123. 'R' => "ocrb10.ttf",
  124. ),
  125. /* Miscellaneous language font(s) */
  126. "abyssinicasil" => array(/* Ethiopic */
  127. 'R' => "Abyssinica_SIL.ttf",
  128. ),
  129. "aboriginalsans" => array(/* Cherokee and Canadian */
  130. 'R' => "AboriginalSansREGULAR.ttf",
  131. ),
  132. "sundaneseunicode" => array(/* Sundanese */
  133. 'R' => "SundaneseUnicode-1.0.5.ttf",
  134. ),
  135. "aegean" => array(
  136. 'R' => "Aegean.otf",
  137. ),
  138. "aegyptus" => array(
  139. 'R' => "Aegyptus.otf",
  140. ),
  141. "akkadian" => array(/* Cuneiform */
  142. 'R' => "Akkadian.otf",
  143. ),
  144. "quivira" => array(
  145. 'R' => "Quivira.otf",
  146. ),
  147. "eeyekunicode" => array(/* Meetei Mayek */
  148. 'R' => "Eeyek.ttf",
  149. ),
  150. "lannaalif" => array(/* Tai Tham */
  151. 'R' => "lannaalif-v1-03.ttf",
  152. ),
  153. "daibannasilbook" => array(/* New Tai Lue */
  154. 'R' => "DBSILBR.ttf",
  155. ),
  156. "garuda" => array(/* Thai */
  157. 'R' => "Garuda.ttf",
  158. 'B' => "Garuda-Bold.ttf",
  159. 'I' => "Garuda-Oblique.ttf",
  160. 'BI' => "Garuda-BoldOblique.ttf",
  161. ),
  162. /* SMP */
  163. "mph2bdamase" => array(
  164. 'R' => "damase_v.2.ttf",
  165. ),
  166. /* Indic */
  167. /* Arabic fonts */
  168. /* CJK fonts */
  169. "unbatang" => array(/* Korean */
  170. 'R' => "UnBatang_0613.ttf",
  171. ),
  172. "sun-exta" => array(
  173. 'R' => "Sun-ExtA.ttf",
  174. 'sip-ext' => 'sun-extb', /* SIP=Plane2 Unicode (extension B) */
  175. ),
  176. "sun-extb" => array(
  177. 'R' => "Sun-ExtB.ttf",
  178. ),
  179. );
  180. // Add fonts to this array if they contain characters in the SIP or SMP Unicode planes
  181. // but you do not require them. This allows a more efficient form of subsetting to be used.
  182. $this->BMPonly = array(
  183. "dejavusanscondensed",
  184. "dejavusans",
  185. "dejavuserifcondensed",
  186. "dejavuserif",
  187. "dejavusansmono",
  188. );
  189. // These next 3 arrays do two things:
  190. // 1. If a font referred to in HTML/CSS is not available to mPDF, these arrays will determine whether
  191. // a serif/sans-serif or monospace font is substituted
  192. // 2. The first font in each array will be the font which is substituted in circumstances as above
  193. // (Otherwise the order is irrelevant)
  194. // Use the mPDF font-family names i.e. lowercase and no spaces (after any translations in $fonttrans)
  195. // Always include "sans-serif", "serif" and "monospace" etc.
  196. $this->sans_fonts = array('dejavusanscondensed', 'sans', 'sans-serif', 'cursive', 'fantasy', 'dejavusans', 'freesans', 'liberationsans',
  197. 'arial', 'helvetica', 'verdana', 'geneva', 'lucida', 'arialnarrow', 'arialblack', 'arialunicodems',
  198. 'franklin', 'franklingothicbook', 'tahoma', 'garuda', 'calibri', 'trebuchet', 'lucidagrande', 'microsoftsansserif',
  199. 'trebuchetms', 'lucidasansunicode', 'franklingothicmedium', 'albertusmedium', 'xbriyaz', 'albasuper', 'quillscript',
  200. 'humanist777', 'humanist777black', 'humanist777light', 'futura', 'hobo', 'segoeprint'
  201. );
  202. $this->serif_fonts = array('dejavuserifcondensed', 'serif', 'dejavuserif', 'freeserif', 'liberationserif',
  203. 'timesnewroman', 'times', 'centuryschoolbookl', 'palatinolinotype', 'centurygothic',
  204. 'bookmanoldstyle', 'bookantiqua', 'cyberbit', 'cambria',
  205. 'norasi', 'charis', 'palatino', 'constantia', 'georgia', 'albertus', 'xbzar', 'algerian', 'garamond',
  206. );
  207. $this->mono_fonts = array('dejavusansmono', 'mono', 'monospace', 'freemono', 'liberationmono', 'courier', 'ocrb', 'ocr-b', 'lucidaconsole',
  208. 'couriernew', 'monotypecorsiva'
  209. );