config_cp.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. function GetLangOpts($llcc, $adobeCJK) {
  3. if (strlen($llcc) == 5) {
  4. $lang = substr(strtolower($llcc),0,2);
  5. $country = substr(strtoupper($llcc),3,2);
  6. }
  7. else { $lang = strtolower($llcc); $country = ''; }
  8. $unifonts = "";
  9. $coreSuitable = false;
  10. switch($lang){
  11. CASE "en":
  12. CASE "ca":
  13. CASE "cy":
  14. CASE "da":
  15. CASE "de":
  16. CASE "es":
  17. CASE "eu":
  18. CASE "fr":
  19. CASE "ga":
  20. CASE "fi":
  21. CASE "is":
  22. CASE "it":
  23. CASE "nl":
  24. CASE "no":
  25. CASE "pt":
  26. CASE "sv":
  27. // Edit this value to define how mPDF behaves when using new mPDF('-x')
  28. // If set to TRUE, mPDF will use Adobe core fonts only when it recognises the languages above
  29. $coreSuitable = true; break;
  30. // RTL Languages
  31. CASE "he":
  32. CASE "yi":
  33. $unifonts = "dejavusans,dejavusansB,dejavusansI,dejavusansBI"; break;
  34. // Arabic
  35. CASE "ar":
  36. $unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
  37. CASE "fa":
  38. $unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
  39. CASE "ps":
  40. $unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
  41. CASE "ur":
  42. $unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
  43. // Sindhi (can be Arabic or Devanagari)
  44. CASE "sd":
  45. if ($country == "IN") { $unifonts = "ind_hi_1_001"; }
  46. // else if ($country == "PK") { $unifonts = ""; }
  47. // else { $unifonts = ""; }
  48. break;
  49. // INDIC
  50. // Assamese
  51. CASE "as": $unifonts = "ind_bn_1_001"; break;
  52. // Bengali
  53. CASE "bn": $unifonts = "ind_bn_1_001"; break;
  54. // Gujarati
  55. CASE "gu": $unifonts = "ind_gu_1_001"; break;
  56. // Hindi (Devanagari)
  57. CASE "hi": $unifonts = "ind_hi_1_001"; break;
  58. // Kannada
  59. CASE "kn": $unifonts = "ind_kn_1_001"; break;
  60. // Kashmiri
  61. CASE "ks": $unifonts = "ind_hi_1_001"; break;
  62. // Malayalam
  63. CASE "ml": $unifonts = "ind_ml_1_001"; break;
  64. // Nepali (Devanagari)
  65. CASE "ne": $unifonts = "ind_hi_1_001"; break;
  66. // Oriya
  67. CASE "or": $unifonts = "ind_or_1_001"; break;
  68. // Punjabi (Gurmukhi)
  69. CASE "pa": $unifonts = "ind_pa_1_001"; break;
  70. // Tamil
  71. CASE "ta": $unifonts = "ind_ta_1_001"; break;
  72. // Telegu
  73. CASE "te": $unifonts = "ind_te_1_001"; break;
  74. // THAI
  75. CASE "th": $unifonts = "garuda,garudaB,garudaI,garudaBI,norasi,norasiB,norasiI,norasiBI"; break;
  76. // VIETNAMESE
  77. CASE "vi":
  78. $unifonts = "dejavusanscondensed,dejavusanscondensedB,dejavusanscondensedI,dejavusanscondensedBI,dejavusans,dejavusansB,dejavusansI,dejavusansBI"; break;
  79. // CJK Langauges
  80. CASE "ja":
  81. if ($adobeCJK) {
  82. $unifonts = "sjis,sjisB,sjisI,sjisBI";
  83. }
  84. /* Uncomment these lines if CJK fonts available */
  85. // else {
  86. // $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
  87. // }
  88. break;
  89. CASE "ko":
  90. if ($adobeCJK) {
  91. $unifonts = "uhc,uhcB,uhcI,uhcBI";
  92. }
  93. /* Uncomment these lines if CJK fonts available */
  94. // else {
  95. // $unifonts = "unbatang_0613";
  96. // }
  97. break;
  98. CASE "zh":
  99. if ($country == "HK" || $country == "TW") {
  100. if ($adobeCJK) {
  101. $unifonts = "big5,big5B,big5I,big5BI";
  102. }
  103. /* Uncomment these lines if CJK fonts available */
  104. // else {
  105. // $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
  106. // }
  107. }
  108. else if ($country == "CN") {
  109. if ($adobeCJK) {
  110. $unifonts = "gb,gbB,gbI,gbBI";
  111. }
  112. /* Uncomment these lines if CJK fonts available */
  113. // else {
  114. // $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
  115. // }
  116. }
  117. else {
  118. if ($adobeCJK) {
  119. $unifonts = "gb,gbB,gbI,gbBI";
  120. }
  121. /* Uncomment these lines if CJK fonts available */
  122. // else {
  123. // $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
  124. // }
  125. }
  126. break;
  127. }
  128. $unifonts_arr = array();
  129. if ($unifonts) {
  130. $unifonts_arr = preg_split('/\s*,\s*/',$unifonts);
  131. }
  132. return array($coreSuitable ,$unifonts_arr);
  133. }
  134. ?>