laag-fontconfig 2.13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (455) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +28 -0
  4. data/README.org +34 -0
  5. data/ext/laag/fontconfig/extconf.rb +13 -0
  6. data/laag-fontconfig.gemspec +20 -0
  7. data/lib/laag/fontconfig.rb +29 -0
  8. data/vendor/anongit.freedesktop.org/git/fontconfig/AUTHORS +3 -0
  9. data/vendor/anongit.freedesktop.org/git/fontconfig/COPYING +28 -0
  10. data/vendor/anongit.freedesktop.org/git/fontconfig/INSTALL +42 -0
  11. data/vendor/anongit.freedesktop.org/git/fontconfig/Makefile.am +158 -0
  12. data/vendor/anongit.freedesktop.org/git/fontconfig/NEWS +0 -0
  13. data/vendor/anongit.freedesktop.org/git/fontconfig/README +2016 -0
  14. data/vendor/anongit.freedesktop.org/git/fontconfig/Tools.mk +64 -0
  15. data/vendor/anongit.freedesktop.org/git/fontconfig/autogen.sh +126 -0
  16. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-autohint.conf +19 -0
  17. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-full.conf +19 -0
  18. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-medium.conf +19 -0
  19. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-none.conf +19 -0
  20. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-slight.conf +19 -0
  21. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-no-sub-pixel.conf +19 -0
  22. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-scale-bitmap-fonts.conf +87 -0
  23. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-bgr.conf +19 -0
  24. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-rgb.conf +19 -0
  25. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-vbgr.conf +19 -0
  26. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-vrgb.conf +19 -0
  27. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-unhinted.conf +19 -0
  28. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/11-lcdfilter-default.conf +21 -0
  29. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/11-lcdfilter-legacy.conf +21 -0
  30. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/11-lcdfilter-light.conf +21 -0
  31. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/20-unhint-small-vera.conf +53 -0
  32. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/25-unhint-nonlatin.conf +132 -0
  33. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/30-metric-aliases.conf +634 -0
  34. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/40-nonlatin.conf +236 -0
  35. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/45-generic.conf +136 -0
  36. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/45-latin.conf +278 -0
  37. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/49-sansserif.conf +26 -0
  38. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/50-user.conf +20 -0
  39. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/51-local.conf +11 -0
  40. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/60-generic.conf +67 -0
  41. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/60-latin.conf +79 -0
  42. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/65-fonts-persian.conf +423 -0
  43. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/65-khmer.conf +20 -0
  44. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/65-nonlatin.conf +200 -0
  45. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/69-unifont.conf +32 -0
  46. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/70-no-bitmaps.conf +17 -0
  47. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/70-yes-bitmaps.conf +17 -0
  48. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/80-delicious.conf +23 -0
  49. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/90-synthetic.conf +68 -0
  50. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/Makefile.am +110 -0
  51. data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/README.in +23 -0
  52. data/vendor/anongit.freedesktop.org/git/fontconfig/config-fixups.h +40 -0
  53. data/vendor/anongit.freedesktop.org/git/fontconfig/configure.ac +793 -0
  54. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/Makefile.am +224 -0
  55. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/check-missing-doc +24 -0
  56. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/confdir.sgml.in +26 -0
  57. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/edit-sgml.c +546 -0
  58. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcatomic.fncs +95 -0
  59. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcblanks.fncs +60 -0
  60. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fccache.fncs +104 -0
  61. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fccharset.fncs +242 -0
  62. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcconfig.fncs +447 -0
  63. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcconstant.fncs +58 -0
  64. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcdircache.fncs +99 -0
  65. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcfile.fncs +88 -0
  66. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcfontset.fncs +140 -0
  67. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcformat.fncs +309 -0
  68. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcfreetype.fncs +135 -0
  69. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcinit.fncs +92 -0
  70. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fclangset.fncs +201 -0
  71. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcmatrix.fncs +125 -0
  72. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcobjectset.fncs +73 -0
  73. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcobjecttype.fncs +48 -0
  74. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcpattern.fncs +433 -0
  75. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcrange.fncs +75 -0
  76. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcstring.fncs +244 -0
  77. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcstrset.fncs +124 -0
  78. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcvalue.fncs +61 -0
  79. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcweight.fncs +69 -0
  80. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fontconfig-devel.sgml +613 -0
  81. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fontconfig-user.sgml +812 -0
  82. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/func.sgml +91 -0
  83. data/vendor/anongit.freedesktop.org/git/fontconfig/doc/version.sgml.in +24 -0
  84. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cache/Makefile.am +69 -0
  85. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cache/fc-cache.c +423 -0
  86. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cache/fc-cache.sgml +249 -0
  87. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/CaseFolding.txt +1495 -0
  88. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/Makefile.am +36 -0
  89. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/fc-case.c +363 -0
  90. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/fccase.tmpl.h +25 -0
  91. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cat/Makefile.am +60 -0
  92. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cat/fc-cat.c +400 -0
  93. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cat/fc-cat.sgml +169 -0
  94. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-conflist/Makefile.am +60 -0
  95. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-conflist/fc-conflist.c +142 -0
  96. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-conflist/fc-conflist.sgml +135 -0
  97. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/Makefile.am +288 -0
  98. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/README +28 -0
  99. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/aa.orth +40 -0
  100. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ab.orth +45 -0
  101. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/af.orth +46 -0
  102. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ak.orth +30 -0
  103. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/am.orth +36 -0
  104. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/an.orth +45 -0
  105. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ar.orth +39 -0
  106. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/as.orth +45 -0
  107. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ast.orth +47 -0
  108. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/av.orth +97 -0
  109. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ay.orth +37 -0
  110. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/az_az.orth +53 -0
  111. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/az_ir.orth +32 -0
  112. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ba.orth +56 -0
  113. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/be.orth +40 -0
  114. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ber_dz.orth +27 -0
  115. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ber_ma.orth +46 -0
  116. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bg.orth +43 -0
  117. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bh.orth +25 -0
  118. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bho.orth +25 -0
  119. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bi.orth +39 -0
  120. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bin.orth +55 -0
  121. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bm.orth +37 -0
  122. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bn.orth +44 -0
  123. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bo.orth +39 -0
  124. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/br.orth +47 -0
  125. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/brx.orth +46 -0
  126. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bs.orth +39 -0
  127. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bua.orth +102 -0
  128. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/byn.orth +27 -0
  129. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ca.orth +58 -0
  130. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ce.orth +97 -0
  131. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ch.orth +35 -0
  132. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/chm.orth +109 -0
  133. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/chr.orth +25 -0
  134. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/co.orth +25 -0
  135. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/crh.orth +46 -0
  136. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cs.orth +67 -0
  137. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/csb.orth +46 -0
  138. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cu.orth +42 -0
  139. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cv.orth +109 -0
  140. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cy.orth +63 -0
  141. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/da.orth +89 -0
  142. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/de.orth +49 -0
  143. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/doi.orth +40 -0
  144. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/dv.orth +34 -0
  145. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/dz.orth +28 -0
  146. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ee.orth +77 -0
  147. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/el.orth +32 -0
  148. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/en.orth +40 -0
  149. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/eo.orth +32 -0
  150. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/es.orth +50 -0
  151. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/et.orth +47 -0
  152. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/eu.orth +45 -0
  153. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fa.orth +73 -0
  154. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fat.orth +30 -0
  155. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fc-lang.c +595 -0
  156. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fc-lang.man +39 -0
  157. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fclang.tmpl.h +25 -0
  158. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ff.orth +38 -0
  159. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fi.orth +51 -0
  160. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fil.orth +45 -0
  161. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fj.orth +34 -0
  162. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fo.orth +59 -0
  163. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fr.orth +58 -0
  164. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fur.orth +39 -0
  165. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fy.orth +61 -0
  166. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ga.orth +84 -0
  167. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gd.orth +51 -0
  168. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gez.orth +60 -0
  169. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gl.orth +50 -0
  170. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gn.orth +48 -0
  171. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gu.orth +41 -0
  172. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gv.orth +31 -0
  173. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ha.orth +36 -0
  174. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/haw.orth +35 -0
  175. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/he.orth +25 -0
  176. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hi.orth +35 -0
  177. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hne.orth +28 -0
  178. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ho.orth +33 -0
  179. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hr.orth +49 -0
  180. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hsb.orth +42 -0
  181. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ht.orth +35 -0
  182. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hu.orth +49 -0
  183. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hy.orth +26 -0
  184. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hz.orth +35 -0
  185. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ia.orth +29 -0
  186. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/id.orth +31 -0
  187. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ie.orth +29 -0
  188. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ig.orth +35 -0
  189. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ii.orth +34 -0
  190. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ik.orth +100 -0
  191. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/io.orth +29 -0
  192. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/is.orth +64 -0
  193. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iso-3166.txt +242 -0
  194. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iso639-1 +139 -0
  195. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iso639-2 +473 -0
  196. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/it.orth +51 -0
  197. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iu.orth +77 -0
  198. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ja.orth +2345 -0
  199. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/jv.orth +36 -0
  200. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ka.orth +34 -0
  201. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kaa.orth +110 -0
  202. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kab.orth +42 -0
  203. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ki.orth +33 -0
  204. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kj.orth +34 -0
  205. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kk.orth +45 -0
  206. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kl.orth +63 -0
  207. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/km.orth +39 -0
  208. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kn.orth +40 -0
  209. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ko.orth +2537 -0
  210. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kok.orth +25 -0
  211. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kr.orth +43 -0
  212. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ks.orth +32 -0
  213. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_am.orth +91 -0
  214. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_iq.orth +27 -0
  215. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_ir.orth +49 -0
  216. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_tr.orth +42 -0
  217. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kum.orth +96 -0
  218. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kv.orth +101 -0
  219. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kw.orth +35 -0
  220. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kwm.orth +29 -0
  221. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ky.orth +102 -0
  222. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/la.orth +31 -0
  223. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lah.orth +35 -0
  224. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lb.orth +62 -0
  225. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lez.orth +97 -0
  226. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lg.orth +33 -0
  227. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/li.orth +43 -0
  228. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ln.orth +43 -0
  229. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lo.orth +45 -0
  230. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lt.orth +43 -0
  231. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lv.orth +44 -0
  232. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mai.orth +25 -0
  233. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mg.orth +35 -0
  234. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mh.orth +45 -0
  235. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mi.orth +35 -0
  236. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mk.orth +40 -0
  237. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ml.orth +38 -0
  238. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mn_cn.orth +37 -0
  239. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mn_mn.orth +35 -0
  240. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mni.orth +35 -0
  241. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mo.orth +37 -0
  242. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mr.orth +25 -0
  243. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ms.orth +32 -0
  244. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mt.orth +67 -0
  245. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/my.orth +37 -0
  246. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/na.orth +40 -0
  247. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nb.orth +25 -0
  248. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nds.orth +40 -0
  249. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ne.orth +43 -0
  250. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ng.orth +29 -0
  251. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nl.orth +63 -0
  252. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nn.orth +43 -0
  253. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/no.orth +68 -0
  254. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nqo.orth +30 -0
  255. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nr.orth +29 -0
  256. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nso.orth +34 -0
  257. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nv.orth +48 -0
  258. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ny.orth +30 -0
  259. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/oc.orth +53 -0
  260. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/om.orth +29 -0
  261. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/or.orth +42 -0
  262. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/os.orth +96 -0
  263. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ota.orth +41 -0
  264. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pa.orth +53 -0
  265. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pa_pk.orth +29 -0
  266. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pap_an.orth +46 -0
  267. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pap_aw.orth +31 -0
  268. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pes.orth +26 -0
  269. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pl.orth +41 -0
  270. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/prs.orth +29 -0
  271. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ps_af.orth +52 -0
  272. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ps_pk.orth +52 -0
  273. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pt.orth +64 -0
  274. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/qu.orth +36 -0
  275. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/quz.orth +36 -0
  276. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/rm.orth +45 -0
  277. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/rn.orth +32 -0
  278. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ro.orth +38 -0
  279. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ru.orth +38 -0
  280. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/rw.orth +31 -0
  281. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sa.orth +25 -0
  282. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sah.orth +108 -0
  283. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sat.orth +44 -0
  284. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sc.orth +42 -0
  285. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sco.orth +32 -0
  286. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sd.orth +58 -0
  287. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/se.orth +37 -0
  288. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sel.orth +96 -0
  289. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sg.orth +47 -0
  290. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sh.orth +33 -0
  291. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/shs.orth +48 -0
  292. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/si.orth +75 -0
  293. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sid.orth +27 -0
  294. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sk.orth +63 -0
  295. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sl.orth +88 -0
  296. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sm.orth +30 -0
  297. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sma.orth +37 -0
  298. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/smj.orth +37 -0
  299. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/smn.orth +40 -0
  300. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sms.orth +48 -0
  301. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sn.orth +35 -0
  302. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/so.orth +29 -0
  303. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sq.orth +35 -0
  304. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sr.orth +35 -0
  305. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ss.orth +29 -0
  306. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/st.orth +29 -0
  307. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/su.orth +33 -0
  308. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sv.orth +100 -0
  309. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sw.orth +29 -0
  310. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/syr.orth +29 -0
  311. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ta.orth +46 -0
  312. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/te.orth +39 -0
  313. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tg.orth +108 -0
  314. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/th.orth +30 -0
  315. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ti_er.orth +56 -0
  316. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ti_et.orth +33 -0
  317. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tig.orth +52 -0
  318. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tk.orth +44 -0
  319. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tl.orth +27 -0
  320. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tn.orth +35 -0
  321. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/to.orth +30 -0
  322. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tr.orth +49 -0
  323. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ts.orth +29 -0
  324. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tt.orth +108 -0
  325. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tw.orth +50 -0
  326. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ty.orth +41 -0
  327. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tyv.orth +102 -0
  328. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ug.orth +50 -0
  329. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/uk.orth +43 -0
  330. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/und_zmth.orth +144 -0
  331. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/und_zsye.orth +151 -0
  332. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ur.orth +68 -0
  333. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/uz.orth +36 -0
  334. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ve.orth +34 -0
  335. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/vi.orth +58 -0
  336. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/vo.orth +36 -0
  337. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/vot.orth +40 -0
  338. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wa.orth +47 -0
  339. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wal.orth +27 -0
  340. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wen.orth +42 -0
  341. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wo.orth +42 -0
  342. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/xh.orth +29 -0
  343. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/yap.orth +35 -0
  344. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/yi.orth +25 -0
  345. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/yo.orth +86 -0
  346. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/za.orth +39 -0
  347. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_cn.orth +6792 -0
  348. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_hk.orth +1119 -0
  349. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_mo.orth +32 -0
  350. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_sg.orth +27 -0
  351. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_tw.orth +13105 -0
  352. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zu.orth +29 -0
  353. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-list/Makefile.am +60 -0
  354. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-list/fc-list.c +220 -0
  355. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-list/fc-list.sgml +227 -0
  356. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-match/Makefile.am +60 -0
  357. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-match/fc-match.c +268 -0
  358. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-match/fc-match.sgml +217 -0
  359. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-pattern/Makefile.am +60 -0
  360. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-pattern/fc-pattern.c +203 -0
  361. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-pattern/fc-pattern.sgml +204 -0
  362. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-query/Makefile.am +60 -0
  363. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-query/fc-query.c +194 -0
  364. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-query/fc-query.sgml +204 -0
  365. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-scan/Makefile.am +60 -0
  366. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-scan/fc-scan.c +197 -0
  367. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-scan/fc-scan.sgml +177 -0
  368. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-validate/Makefile.am +60 -0
  369. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-validate/fc-validate.c +250 -0
  370. data/vendor/anongit.freedesktop.org/git/fontconfig/fc-validate/fc-validate.sgml +182 -0
  371. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig-zip.in +29 -0
  372. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig.pc.in +18 -0
  373. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig.spec.in +138 -0
  374. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/Makefile.am +10 -0
  375. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/fcfreetype.h +59 -0
  376. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/fcprivate.h +134 -0
  377. data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/fontconfig.h +1107 -0
  378. data/vendor/anongit.freedesktop.org/git/fontconfig/fonts.conf.in +94 -0
  379. data/vendor/anongit.freedesktop.org/git/fontconfig/fonts.dtd +233 -0
  380. data/vendor/anongit.freedesktop.org/git/fontconfig/git.mk +254 -0
  381. data/vendor/anongit.freedesktop.org/git/fontconfig/its/Makefile.am +11 -0
  382. data/vendor/anongit.freedesktop.org/git/fontconfig/its/fontconfig.its +4 -0
  383. data/vendor/anongit.freedesktop.org/git/fontconfig/its/fontconfig.loc +6 -0
  384. data/vendor/anongit.freedesktop.org/git/fontconfig/local.conf +42 -0
  385. data/vendor/anongit.freedesktop.org/git/fontconfig/m4/.gitkeep +0 -0
  386. data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ac_check_symbol.m4 +48 -0
  387. data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ax_cc_for_build.m4 +77 -0
  388. data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ax_create_stdint_h.m4 +695 -0
  389. data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ax_pthread.m4 +337 -0
  390. data/vendor/anongit.freedesktop.org/git/fontconfig/m4/pkg.m4 +214 -0
  391. data/vendor/anongit.freedesktop.org/git/fontconfig/new-version.sh +139 -0
  392. data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/ChangeLog +12 -0
  393. data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/LINGUAS +2 -0
  394. data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/Makevars +80 -0
  395. data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/POTFILES.in +34 -0
  396. data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/zh_CN.po +140 -0
  397. data/vendor/anongit.freedesktop.org/git/fontconfig/po/ChangeLog +12 -0
  398. data/vendor/anongit.freedesktop.org/git/fontconfig/po/LINGUAS +2 -0
  399. data/vendor/anongit.freedesktop.org/git/fontconfig/po/Makevars +78 -0
  400. data/vendor/anongit.freedesktop.org/git/fontconfig/po/POTFILES.in +11 -0
  401. data/vendor/anongit.freedesktop.org/git/fontconfig/po/zh_CN.po +608 -0
  402. data/vendor/anongit.freedesktop.org/git/fontconfig/src/Makefile.am +222 -0
  403. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcarch.c +59 -0
  404. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcarch.h +76 -0
  405. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcatomic.c +229 -0
  406. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcatomic.h +145 -0
  407. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccache.c +1880 -0
  408. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccfg.c +2668 -0
  409. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccharset.c +1400 -0
  410. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccompat.c +280 -0
  411. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdbg.c +587 -0
  412. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdefault.c +343 -0
  413. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdeprecate.h +36 -0
  414. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdir.c +435 -0
  415. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcformat.c +1220 -0
  416. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcfreetype.c +2626 -0
  417. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcfs.c +149 -0
  418. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcftint.h +54 -0
  419. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fchash.c +216 -0
  420. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcinit.c +258 -0
  421. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcint.h +1344 -0
  422. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fclang.c +1110 -0
  423. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fclist.c +645 -0
  424. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcmatch.c +1240 -0
  425. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcmatrix.c +116 -0
  426. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcmutex.h +127 -0
  427. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcname.c +634 -0
  428. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcobjs.c +168 -0
  429. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcobjs.h +75 -0
  430. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcobjshash.gperf.h +49 -0
  431. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcpat.c +1420 -0
  432. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcptrlist.c +198 -0
  433. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcrange.c +160 -0
  434. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcserialize.c +155 -0
  435. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcstat.c +442 -0
  436. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcstr.c +1371 -0
  437. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcweight.c +103 -0
  438. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcwindows.h +49 -0
  439. data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcxml.c +3508 -0
  440. data/vendor/anongit.freedesktop.org/git/fontconfig/src/ftglue.c +261 -0
  441. data/vendor/anongit.freedesktop.org/git/fontconfig/src/ftglue.h +111 -0
  442. data/vendor/anongit.freedesktop.org/git/fontconfig/src/makealias +38 -0
  443. data/vendor/anongit.freedesktop.org/git/fontconfig/test/4x6.pcf +0 -0
  444. data/vendor/anongit.freedesktop.org/git/fontconfig/test/8x16.pcf +0 -0
  445. data/vendor/anongit.freedesktop.org/git/fontconfig/test/Makefile.am +64 -0
  446. data/vendor/anongit.freedesktop.org/git/fontconfig/test/fonts.conf.in +4 -0
  447. data/vendor/anongit.freedesktop.org/git/fontconfig/test/out.expected-long-family-names +8 -0
  448. data/vendor/anongit.freedesktop.org/git/fontconfig/test/out.expected-no-long-family-names +8 -0
  449. data/vendor/anongit.freedesktop.org/git/fontconfig/test/run-test.sh +205 -0
  450. data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-bz131804.c +135 -0
  451. data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-bz89617.c +40 -0
  452. data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-bz96676.c +32 -0
  453. data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-migration.c +230 -0
  454. data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-pthread.c +101 -0
  455. metadata +518 -0
@@ -0,0 +1,103 @@
1
+ /*
2
+ * fontconfig/src/fcweight.c
3
+ *
4
+ * Permission to use, copy, modify, distribute, and sell this software and its
5
+ * documentation for any purpose is hereby granted without fee, provided that
6
+ * the above copyright notice appear in all copies and that both that
7
+ * copyright notice and this permission notice appear in supporting
8
+ * documentation, and that the name of the author(s) not be used in
9
+ * advertising or publicity pertaining to distribution of the software without
10
+ * specific, written prior permission. The authors make no
11
+ * representations about the suitability of this software for any purpose. It
12
+ * is provided "as is" without express or implied warranty.
13
+ *
14
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ * PERFORMANCE OF THIS SOFTWARE.
21
+ */
22
+
23
+ #include "fcint.h"
24
+
25
+ static const struct {
26
+ int ot;
27
+ int fc;
28
+ } map[] = {
29
+ { 0, FC_WEIGHT_THIN },
30
+ { 100, FC_WEIGHT_THIN },
31
+ { 200, FC_WEIGHT_EXTRALIGHT },
32
+ { 300, FC_WEIGHT_LIGHT },
33
+ { 350, FC_WEIGHT_DEMILIGHT },
34
+ { 380, FC_WEIGHT_BOOK },
35
+ { 400, FC_WEIGHT_REGULAR },
36
+ { 500, FC_WEIGHT_MEDIUM },
37
+ { 600, FC_WEIGHT_DEMIBOLD },
38
+ { 700, FC_WEIGHT_BOLD },
39
+ { 800, FC_WEIGHT_EXTRABOLD },
40
+ { 900, FC_WEIGHT_BLACK },
41
+ {1000, FC_WEIGHT_EXTRABLACK },
42
+ };
43
+
44
+ static double lerp(double x, int x1, int x2, int y1, int y2)
45
+ {
46
+ int dx = x2 - x1;
47
+ int dy = y2 - y1;
48
+ assert (dx > 0 && dy >= 0 && x1 <= x && x <= x2);
49
+ return y1 + (dy*(x-x1) + dx/2) / dx;
50
+ }
51
+
52
+ double
53
+ FcWeightFromOpenTypeDouble (double ot_weight)
54
+ {
55
+ int i;
56
+
57
+ if (ot_weight < 0)
58
+ return -1;
59
+
60
+ ot_weight = FC_MIN (ot_weight, map[(sizeof (map) / sizeof (map[0])) - 1].ot);
61
+
62
+ for (i = 1; ot_weight > map[i].ot; i++)
63
+ ;
64
+
65
+ if (ot_weight == map[i].ot)
66
+ return map[i].fc;
67
+
68
+ /* Interpolate between two items. */
69
+ return lerp (ot_weight, map[i-1].ot, map[i].ot, map[i-1].fc, map[i].fc);
70
+ }
71
+
72
+ double
73
+ FcWeightToOpenTypeDouble (double fc_weight)
74
+ {
75
+ int i;
76
+ if (fc_weight < 0 || fc_weight > FC_WEIGHT_EXTRABLACK)
77
+ return -1;
78
+
79
+ for (i = 1; fc_weight > map[i].fc; i++)
80
+ ;
81
+
82
+ if (fc_weight == map[i].fc)
83
+ return map[i].ot;
84
+
85
+ /* Interpolate between two items. */
86
+ return lerp (fc_weight, map[i-1].fc, map[i].fc, map[i-1].ot, map[i].ot);
87
+ }
88
+
89
+ int
90
+ FcWeightFromOpenType (int ot_weight)
91
+ {
92
+ return FcWeightFromOpenTypeDouble (ot_weight) + .5;
93
+ }
94
+
95
+ int
96
+ FcWeightToOpenType (int fc_weight)
97
+ {
98
+ return FcWeightToOpenTypeDouble (fc_weight) + .5;
99
+ }
100
+
101
+ #define __fcweight__
102
+ #include "fcaliastail.h"
103
+ #undef __fcweight__
@@ -0,0 +1,49 @@
1
+ /*
2
+ * fontconfig/src/fcwindows.h
3
+ *
4
+ * Copyright © 2013 Google, Inc.
5
+ *
6
+ * Permission to use, copy, modify, distribute, and sell this software and its
7
+ * documentation for any purpose is hereby granted without fee, provided that
8
+ * the above copyright notice appear in all copies and that both that
9
+ * copyright notice and this permission notice appear in supporting
10
+ * documentation, and that the name of the author(s) not be used in
11
+ * advertising or publicity pertaining to distribution of the software without
12
+ * specific, written prior permission. The authors make no
13
+ * representations about the suitability of this software for any purpose. It
14
+ * is provided "as is" without express or implied warranty.
15
+ *
16
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
+ * PERFORMANCE OF THIS SOFTWARE.
23
+ *
24
+ * Google Author(s): Behdad Esfahbod
25
+ */
26
+
27
+ #ifndef _FCWINDOWS_H_
28
+ #define _FCWINDOWS_H_
29
+
30
+ #ifdef HAVE_CONFIG_H
31
+ #include <config.h>
32
+ #endif
33
+
34
+ #ifdef _WIN32
35
+ /* Request Windows Vista for building. This is required to
36
+ * get MemoryBarrier on mingw32... */
37
+ # if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
38
+ # undef _WIN32_WINNT
39
+ # endif
40
+ # ifndef _WIN32_WINNT
41
+ # define _WIN32_WINNT 0x0600
42
+ # endif
43
+ # define WIN32_LEAN_AND_MEAN
44
+ # define WIN32_EXTRA_LEAN
45
+ # define STRICT
46
+ # include <windows.h>
47
+ #endif
48
+
49
+ #endif /* _FCWINDOWS_H_ */
@@ -0,0 +1,3508 @@
1
+ /*
2
+ * fontconfig/src/fcxml.c
3
+ *
4
+ * Copyright © 2002 Keith Packard
5
+ *
6
+ * Permission to use, copy, modify, distribute, and sell this software and its
7
+ * documentation for any purpose is hereby granted without fee, provided that
8
+ * the above copyright notice appear in all copies and that both that
9
+ * copyright notice and this permission notice appear in supporting
10
+ * documentation, and that the name of the author(s) not be used in
11
+ * advertising or publicity pertaining to distribution of the software without
12
+ * specific, written prior permission. The authors make no
13
+ * representations about the suitability of this software for any purpose. It
14
+ * is provided "as is" without express or implied warranty.
15
+ *
16
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
+ * PERFORMANCE OF THIS SOFTWARE.
23
+ */
24
+
25
+ #include "fcint.h"
26
+ #include <fcntl.h>
27
+ #include <stdarg.h>
28
+ #include <dirent.h>
29
+
30
+ #ifdef ENABLE_LIBXML2
31
+
32
+ #include <libxml/parser.h>
33
+
34
+ #define XML_Char xmlChar
35
+ #define XML_Parser xmlParserCtxtPtr
36
+ #define XML_ParserFree xmlFreeParserCtxt
37
+ #define XML_GetCurrentLineNumber xmlSAX2GetLineNumber
38
+ #define XML_GetErrorCode xmlCtxtGetLastError
39
+ #define XML_ErrorString(Error) (Error)->message
40
+
41
+ #else /* ENABLE_LIBXML2 */
42
+
43
+ #ifndef HAVE_XMLPARSE_H
44
+ #define HAVE_XMLPARSE_H 0
45
+ #endif
46
+
47
+ #if HAVE_XMLPARSE_H
48
+ #include <xmlparse.h>
49
+ #else
50
+ #include <expat.h>
51
+ #endif
52
+
53
+ #endif /* ENABLE_LIBXML2 */
54
+
55
+ #ifdef _WIN32
56
+ #include <mbstring.h>
57
+ extern FcChar8 fontconfig_instprefix[];
58
+ #endif
59
+
60
+ static FcChar8 *__fc_userdir = NULL;
61
+ static FcChar8 *__fc_userconf = NULL;
62
+
63
+ static void
64
+ FcExprDestroy (FcExpr *e);
65
+ static FcBool
66
+ _FcConfigParse (FcConfig *config,
67
+ const FcChar8 *name,
68
+ FcBool complain,
69
+ FcBool load);
70
+
71
+ void
72
+ FcTestDestroy (FcTest *test)
73
+ {
74
+ FcExprDestroy (test->expr);
75
+ free (test);
76
+ }
77
+
78
+ void
79
+ FcRuleDestroy (FcRule *rule)
80
+ {
81
+ FcRule *n = rule->next;
82
+
83
+ switch (rule->type) {
84
+ case FcRuleTest:
85
+ FcTestDestroy (rule->u.test);
86
+ break;
87
+ case FcRuleEdit:
88
+ FcEditDestroy (rule->u.edit);
89
+ break;
90
+ case FcRuleUnknown:
91
+ default:
92
+ break;
93
+ }
94
+ free (rule);
95
+ if (n)
96
+ FcRuleDestroy (n);
97
+ }
98
+
99
+ static FcExpr *
100
+ FcExprCreateInteger (FcConfig *config, int i)
101
+ {
102
+ FcExpr *e = FcConfigAllocExpr (config);
103
+ if (e)
104
+ {
105
+ e->op = FcOpInteger;
106
+ e->u.ival = i;
107
+ }
108
+ return e;
109
+ }
110
+
111
+ static FcExpr *
112
+ FcExprCreateDouble (FcConfig *config, double d)
113
+ {
114
+ FcExpr *e = FcConfigAllocExpr (config);
115
+ if (e)
116
+ {
117
+ e->op = FcOpDouble;
118
+ e->u.dval = d;
119
+ }
120
+ return e;
121
+ }
122
+
123
+ static FcExpr *
124
+ FcExprCreateString (FcConfig *config, const FcChar8 *s)
125
+ {
126
+ FcExpr *e = FcConfigAllocExpr (config);
127
+ if (e)
128
+ {
129
+ e->op = FcOpString;
130
+ e->u.sval = FcStrdup (s);
131
+ }
132
+ return e;
133
+ }
134
+
135
+ static FcExprMatrix *
136
+ FcExprMatrixCopyShallow (const FcExprMatrix *matrix)
137
+ {
138
+ FcExprMatrix *m = malloc (sizeof (FcExprMatrix));
139
+ if (m)
140
+ {
141
+ *m = *matrix;
142
+ }
143
+ return m;
144
+ }
145
+
146
+ static void
147
+ FcExprMatrixFreeShallow (FcExprMatrix *m)
148
+ {
149
+ if (!m)
150
+ return;
151
+
152
+ free (m);
153
+ }
154
+
155
+ static void
156
+ FcExprMatrixFree (FcExprMatrix *m)
157
+ {
158
+ if (!m)
159
+ return;
160
+
161
+ FcExprDestroy (m->xx);
162
+ FcExprDestroy (m->xy);
163
+ FcExprDestroy (m->yx);
164
+ FcExprDestroy (m->yy);
165
+
166
+ free (m);
167
+ }
168
+
169
+ static FcExpr *
170
+ FcExprCreateMatrix (FcConfig *config, const FcExprMatrix *matrix)
171
+ {
172
+ FcExpr *e = FcConfigAllocExpr (config);
173
+ if (e)
174
+ {
175
+ e->op = FcOpMatrix;
176
+ e->u.mexpr = FcExprMatrixCopyShallow (matrix);
177
+ }
178
+ return e;
179
+ }
180
+
181
+ static FcExpr *
182
+ FcExprCreateRange (FcConfig *config, FcRange *range)
183
+ {
184
+ FcExpr *e = FcConfigAllocExpr (config);
185
+ if (e)
186
+ {
187
+ e->op = FcOpRange;
188
+ e->u.rval = FcRangeCopy (range);
189
+ }
190
+ return e;
191
+ }
192
+
193
+ static FcExpr *
194
+ FcExprCreateBool (FcConfig *config, FcBool b)
195
+ {
196
+ FcExpr *e = FcConfigAllocExpr (config);
197
+ if (e)
198
+ {
199
+ e->op = FcOpBool;
200
+ e->u.bval = b;
201
+ }
202
+ return e;
203
+ }
204
+
205
+ static FcExpr *
206
+ FcExprCreateCharSet (FcConfig *config, FcCharSet *charset)
207
+ {
208
+ FcExpr *e = FcConfigAllocExpr (config);
209
+ if (e)
210
+ {
211
+ e->op = FcOpCharSet;
212
+ e->u.cval = FcCharSetCopy (charset);
213
+ }
214
+ return e;
215
+ }
216
+
217
+ static FcExpr *
218
+ FcExprCreateLangSet (FcConfig *config, FcLangSet *langset)
219
+ {
220
+ FcExpr *e = FcConfigAllocExpr (config);
221
+ if (e)
222
+ {
223
+ e->op = FcOpLangSet;
224
+ e->u.lval = FcLangSetCopy (langset);
225
+ }
226
+ return e;
227
+ }
228
+
229
+ static FcExpr *
230
+ FcExprCreateName (FcConfig *config, FcExprName name)
231
+ {
232
+ FcExpr *e = FcConfigAllocExpr (config);
233
+ if (e)
234
+ {
235
+ e->op = FcOpField;
236
+ e->u.name = name;
237
+ }
238
+ return e;
239
+ }
240
+
241
+ static FcExpr *
242
+ FcExprCreateConst (FcConfig *config, const FcChar8 *constant)
243
+ {
244
+ FcExpr *e = FcConfigAllocExpr (config);
245
+ if (e)
246
+ {
247
+ e->op = FcOpConst;
248
+ e->u.constant = FcStrdup (constant);
249
+ }
250
+ return e;
251
+ }
252
+
253
+ static FcExpr *
254
+ FcExprCreateOp (FcConfig *config, FcExpr *left, FcOp op, FcExpr *right)
255
+ {
256
+ FcExpr *e = FcConfigAllocExpr (config);
257
+ if (e)
258
+ {
259
+ e->op = op;
260
+ e->u.tree.left = left;
261
+ e->u.tree.right = right;
262
+ }
263
+ return e;
264
+ }
265
+
266
+ static void
267
+ FcExprDestroy (FcExpr *e)
268
+ {
269
+ if (!e)
270
+ return;
271
+ switch (FC_OP_GET_OP (e->op)) {
272
+ case FcOpInteger:
273
+ break;
274
+ case FcOpDouble:
275
+ break;
276
+ case FcOpString:
277
+ FcFree (e->u.sval);
278
+ break;
279
+ case FcOpMatrix:
280
+ FcExprMatrixFree (e->u.mexpr);
281
+ break;
282
+ case FcOpRange:
283
+ FcRangeDestroy (e->u.rval);
284
+ break;
285
+ case FcOpCharSet:
286
+ FcCharSetDestroy (e->u.cval);
287
+ break;
288
+ case FcOpLangSet:
289
+ FcLangSetDestroy (e->u.lval);
290
+ break;
291
+ case FcOpBool:
292
+ break;
293
+ case FcOpField:
294
+ break;
295
+ case FcOpConst:
296
+ FcFree (e->u.constant);
297
+ break;
298
+ case FcOpAssign:
299
+ case FcOpAssignReplace:
300
+ case FcOpPrepend:
301
+ case FcOpPrependFirst:
302
+ case FcOpAppend:
303
+ case FcOpAppendLast:
304
+ case FcOpDelete:
305
+ case FcOpDeleteAll:
306
+ break;
307
+ case FcOpOr:
308
+ case FcOpAnd:
309
+ case FcOpEqual:
310
+ case FcOpNotEqual:
311
+ case FcOpLess:
312
+ case FcOpLessEqual:
313
+ case FcOpMore:
314
+ case FcOpMoreEqual:
315
+ case FcOpContains:
316
+ case FcOpListing:
317
+ case FcOpNotContains:
318
+ case FcOpPlus:
319
+ case FcOpMinus:
320
+ case FcOpTimes:
321
+ case FcOpDivide:
322
+ case FcOpQuest:
323
+ case FcOpComma:
324
+ FcExprDestroy (e->u.tree.right);
325
+ /* fall through */
326
+ case FcOpNot:
327
+ case FcOpFloor:
328
+ case FcOpCeil:
329
+ case FcOpRound:
330
+ case FcOpTrunc:
331
+ FcExprDestroy (e->u.tree.left);
332
+ break;
333
+ case FcOpNil:
334
+ case FcOpInvalid:
335
+ break;
336
+ }
337
+
338
+ e->op = FcOpNil;
339
+ }
340
+
341
+ void
342
+ FcEditDestroy (FcEdit *e)
343
+ {
344
+ if (e->expr)
345
+ FcExprDestroy (e->expr);
346
+ free (e);
347
+ }
348
+
349
+ typedef enum _FcElement {
350
+ FcElementNone,
351
+ FcElementFontconfig,
352
+ FcElementDir,
353
+ FcElementCacheDir,
354
+ FcElementCache,
355
+ FcElementInclude,
356
+ FcElementConfig,
357
+ FcElementMatch,
358
+ FcElementAlias,
359
+ FcElementDescription,
360
+
361
+ FcElementRescan,
362
+
363
+ FcElementPrefer,
364
+ FcElementAccept,
365
+ FcElementDefault,
366
+ FcElementFamily,
367
+
368
+ FcElementSelectfont,
369
+ FcElementAcceptfont,
370
+ FcElementRejectfont,
371
+ FcElementGlob,
372
+ FcElementPattern,
373
+ FcElementPatelt,
374
+
375
+ FcElementTest,
376
+ FcElementEdit,
377
+ FcElementInt,
378
+ FcElementDouble,
379
+ FcElementString,
380
+ FcElementMatrix,
381
+ FcElementRange,
382
+ FcElementBool,
383
+ FcElementCharSet,
384
+ FcElementLangSet,
385
+ FcElementName,
386
+ FcElementConst,
387
+ FcElementOr,
388
+ FcElementAnd,
389
+ FcElementEq,
390
+ FcElementNotEq,
391
+ FcElementLess,
392
+ FcElementLessEq,
393
+ FcElementMore,
394
+ FcElementMoreEq,
395
+ FcElementContains,
396
+ FcElementNotContains,
397
+ FcElementPlus,
398
+ FcElementMinus,
399
+ FcElementTimes,
400
+ FcElementDivide,
401
+ FcElementNot,
402
+ FcElementIf,
403
+ FcElementFloor,
404
+ FcElementCeil,
405
+ FcElementRound,
406
+ FcElementTrunc,
407
+ FcElementUnknown
408
+ } FcElement;
409
+
410
+ static const struct {
411
+ const char name[16];
412
+ FcElement element;
413
+ } fcElementMap[] = {
414
+ { "fontconfig", FcElementFontconfig },
415
+ { "dir", FcElementDir },
416
+ { "cachedir", FcElementCacheDir },
417
+ { "cache", FcElementCache },
418
+ { "include", FcElementInclude },
419
+ { "config", FcElementConfig },
420
+ { "match", FcElementMatch },
421
+ { "alias", FcElementAlias },
422
+ { "description", FcElementDescription },
423
+
424
+ { "rescan", FcElementRescan },
425
+
426
+ { "prefer", FcElementPrefer },
427
+ { "accept", FcElementAccept },
428
+ { "default", FcElementDefault },
429
+ { "family", FcElementFamily },
430
+
431
+ { "selectfont", FcElementSelectfont },
432
+ { "acceptfont", FcElementAcceptfont },
433
+ { "rejectfont", FcElementRejectfont },
434
+ { "glob", FcElementGlob },
435
+ { "pattern", FcElementPattern },
436
+ { "patelt", FcElementPatelt },
437
+
438
+ { "test", FcElementTest },
439
+ { "edit", FcElementEdit },
440
+ { "int", FcElementInt },
441
+ { "double", FcElementDouble },
442
+ { "string", FcElementString },
443
+ { "matrix", FcElementMatrix },
444
+ { "range", FcElementRange },
445
+ { "bool", FcElementBool },
446
+ { "charset", FcElementCharSet },
447
+ { "langset", FcElementLangSet },
448
+ { "name", FcElementName },
449
+ { "const", FcElementConst },
450
+ { "or", FcElementOr },
451
+ { "and", FcElementAnd },
452
+ { "eq", FcElementEq },
453
+ { "not_eq", FcElementNotEq },
454
+ { "less", FcElementLess },
455
+ { "less_eq", FcElementLessEq },
456
+ { "more", FcElementMore },
457
+ { "more_eq", FcElementMoreEq },
458
+ { "contains", FcElementContains },
459
+ { "not_contains", FcElementNotContains },
460
+ { "plus", FcElementPlus },
461
+ { "minus", FcElementMinus },
462
+ { "times", FcElementTimes },
463
+ { "divide", FcElementDivide },
464
+ { "not", FcElementNot },
465
+ { "if", FcElementIf },
466
+ { "floor", FcElementFloor },
467
+ { "ceil", FcElementCeil },
468
+ { "round", FcElementRound },
469
+ { "trunc", FcElementTrunc },
470
+ };
471
+ #define NUM_ELEMENT_MAPS (int) (sizeof fcElementMap / sizeof fcElementMap[0])
472
+
473
+ static const char *fcElementIgnoreName[16] = {
474
+ "its:",
475
+ NULL
476
+ };
477
+
478
+ static FcElement
479
+ FcElementMap (const XML_Char *name)
480
+ {
481
+
482
+ int i;
483
+ for (i = 0; i < NUM_ELEMENT_MAPS; i++)
484
+ if (!strcmp ((char *) name, fcElementMap[i].name))
485
+ return fcElementMap[i].element;
486
+ for (i = 0; fcElementIgnoreName[i] != NULL; i++)
487
+ if (!strncmp ((char *) name, fcElementIgnoreName[i], strlen (fcElementIgnoreName[i])))
488
+ return FcElementNone;
489
+ return FcElementUnknown;
490
+ }
491
+
492
+ typedef struct _FcPStack {
493
+ struct _FcPStack *prev;
494
+ FcElement element;
495
+ FcChar8 **attr;
496
+ FcStrBuf str;
497
+ FcChar8 *attr_buf_static[16];
498
+ } FcPStack;
499
+
500
+ typedef enum _FcVStackTag {
501
+ FcVStackNone,
502
+
503
+ FcVStackString,
504
+ FcVStackFamily,
505
+ FcVStackConstant,
506
+ FcVStackGlob,
507
+ FcVStackName,
508
+ FcVStackPattern,
509
+
510
+ FcVStackPrefer,
511
+ FcVStackAccept,
512
+ FcVStackDefault,
513
+
514
+ FcVStackInteger,
515
+ FcVStackDouble,
516
+ FcVStackMatrix,
517
+ FcVStackRange,
518
+ FcVStackBool,
519
+ FcVStackCharSet,
520
+ FcVStackLangSet,
521
+
522
+ FcVStackTest,
523
+ FcVStackExpr,
524
+ FcVStackEdit
525
+ } FcVStackTag;
526
+
527
+ typedef struct _FcVStack {
528
+ struct _FcVStack *prev;
529
+ FcPStack *pstack; /* related parse element */
530
+ FcVStackTag tag;
531
+ union {
532
+ FcChar8 *string;
533
+
534
+ int integer;
535
+ double _double;
536
+ FcExprMatrix *matrix;
537
+ FcRange *range;
538
+ FcBool bool_;
539
+ FcCharSet *charset;
540
+ FcLangSet *langset;
541
+ FcExprName name;
542
+
543
+ FcTest *test;
544
+ FcQual qual;
545
+ FcOp op;
546
+ FcExpr *expr;
547
+ FcEdit *edit;
548
+
549
+ FcPattern *pattern;
550
+ } u;
551
+ } FcVStack;
552
+
553
+ typedef struct _FcConfigParse {
554
+ FcPStack *pstack;
555
+ FcVStack *vstack;
556
+ FcBool error;
557
+ const FcChar8 *name;
558
+ FcConfig *config;
559
+ FcRuleSet *ruleset;
560
+ XML_Parser parser;
561
+ unsigned int pstack_static_used;
562
+ FcPStack pstack_static[8];
563
+ unsigned int vstack_static_used;
564
+ FcVStack vstack_static[64];
565
+ FcBool scanOnly;
566
+ } FcConfigParse;
567
+
568
+ typedef enum _FcConfigSeverity {
569
+ FcSevereInfo, FcSevereWarning, FcSevereError
570
+ } FcConfigSeverity;
571
+
572
+ static void
573
+ FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, const char *fmt, ...)
574
+ {
575
+ const char *s = "unknown";
576
+ va_list args;
577
+
578
+ va_start (args, fmt);
579
+
580
+ switch (severe) {
581
+ case FcSevereInfo: s = "info"; break;
582
+ case FcSevereWarning: s = "warning"; break;
583
+ case FcSevereError: s = "error"; break;
584
+ }
585
+ if (parse)
586
+ {
587
+ if (parse->name)
588
+ fprintf (stderr, "Fontconfig %s: \"%s\", line %d: ", s,
589
+ parse->name, (int)XML_GetCurrentLineNumber (parse->parser));
590
+ else
591
+ fprintf (stderr, "Fontconfig %s: line %d: ", s,
592
+ (int)XML_GetCurrentLineNumber (parse->parser));
593
+ if (severe >= FcSevereError)
594
+ parse->error = FcTrue;
595
+ }
596
+ else
597
+ fprintf (stderr, "Fontconfig %s: ", s);
598
+ vfprintf (stderr, fmt, args);
599
+ fprintf (stderr, "\n");
600
+ va_end (args);
601
+ }
602
+
603
+
604
+ static FcExpr *
605
+ FcPopExpr (FcConfigParse *parse);
606
+
607
+
608
+ static const char *
609
+ FcTypeName (FcType type)
610
+ {
611
+ switch (type) {
612
+ case FcTypeVoid:
613
+ return "void";
614
+ case FcTypeInteger:
615
+ case FcTypeDouble:
616
+ return "number";
617
+ case FcTypeString:
618
+ return "string";
619
+ case FcTypeBool:
620
+ return "bool";
621
+ case FcTypeMatrix:
622
+ return "matrix";
623
+ case FcTypeCharSet:
624
+ return "charset";
625
+ case FcTypeFTFace:
626
+ return "FT_Face";
627
+ case FcTypeLangSet:
628
+ return "langset";
629
+ case FcTypeRange:
630
+ return "range";
631
+ case FcTypeUnknown:
632
+ default:
633
+ return "unknown";
634
+ }
635
+ }
636
+
637
+ static void
638
+ FcTypecheckValue (FcConfigParse *parse, FcType value, FcType type)
639
+ {
640
+ if (value == FcTypeInteger)
641
+ value = FcTypeDouble;
642
+ if (type == FcTypeInteger)
643
+ type = FcTypeDouble;
644
+ if (value != type)
645
+ {
646
+ if ((value == FcTypeLangSet && type == FcTypeString) ||
647
+ (value == FcTypeString && type == FcTypeLangSet) ||
648
+ (value == FcTypeInteger && type == FcTypeRange) ||
649
+ (value == FcTypeDouble && type == FcTypeRange))
650
+ return;
651
+ if (type == FcTypeUnknown)
652
+ return;
653
+ /* It's perfectly fine to use user-define elements in expressions,
654
+ * so don't warn in that case. */
655
+ if (value == FcTypeUnknown)
656
+ return;
657
+ FcConfigMessage (parse, FcSevereWarning, "saw %s, expected %s",
658
+ FcTypeName (value), FcTypeName (type));
659
+ }
660
+ }
661
+
662
+ static void
663
+ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type)
664
+ {
665
+ const FcObjectType *o;
666
+ const FcConstant *c;
667
+
668
+ /* If parsing the expression failed, some nodes may be NULL */
669
+ if (!expr)
670
+ return;
671
+
672
+ switch (FC_OP_GET_OP (expr->op)) {
673
+ case FcOpInteger:
674
+ case FcOpDouble:
675
+ FcTypecheckValue (parse, FcTypeDouble, type);
676
+ break;
677
+ case FcOpString:
678
+ FcTypecheckValue (parse, FcTypeString, type);
679
+ break;
680
+ case FcOpMatrix:
681
+ FcTypecheckValue (parse, FcTypeMatrix, type);
682
+ break;
683
+ case FcOpBool:
684
+ FcTypecheckValue (parse, FcTypeBool, type);
685
+ break;
686
+ case FcOpCharSet:
687
+ FcTypecheckValue (parse, FcTypeCharSet, type);
688
+ break;
689
+ case FcOpLangSet:
690
+ FcTypecheckValue (parse, FcTypeLangSet, type);
691
+ break;
692
+ case FcOpRange:
693
+ FcTypecheckValue (parse, FcTypeRange, type);
694
+ break;
695
+ case FcOpNil:
696
+ break;
697
+ case FcOpField:
698
+ o = FcNameGetObjectType (FcObjectName (expr->u.name.object));
699
+ if (o)
700
+ FcTypecheckValue (parse, o->type, type);
701
+ break;
702
+ case FcOpConst:
703
+ c = FcNameGetConstant (expr->u.constant);
704
+ if (c)
705
+ {
706
+ o = FcNameGetObjectType (c->object);
707
+ if (o)
708
+ FcTypecheckValue (parse, o->type, type);
709
+ }
710
+ else
711
+ FcConfigMessage (parse, FcSevereWarning,
712
+ "invalid constant used : %s",
713
+ expr->u.constant);
714
+ break;
715
+ case FcOpQuest:
716
+ FcTypecheckExpr (parse, expr->u.tree.left, FcTypeBool);
717
+ FcTypecheckExpr (parse, expr->u.tree.right->u.tree.left, type);
718
+ FcTypecheckExpr (parse, expr->u.tree.right->u.tree.right, type);
719
+ break;
720
+ case FcOpAssign:
721
+ case FcOpAssignReplace:
722
+ break;
723
+ case FcOpEqual:
724
+ case FcOpNotEqual:
725
+ case FcOpLess:
726
+ case FcOpLessEqual:
727
+ case FcOpMore:
728
+ case FcOpMoreEqual:
729
+ case FcOpContains:
730
+ case FcOpNotContains:
731
+ case FcOpListing:
732
+ FcTypecheckValue (parse, FcTypeBool, type);
733
+ break;
734
+ case FcOpComma:
735
+ case FcOpOr:
736
+ case FcOpAnd:
737
+ case FcOpPlus:
738
+ case FcOpMinus:
739
+ case FcOpTimes:
740
+ case FcOpDivide:
741
+ FcTypecheckExpr (parse, expr->u.tree.left, type);
742
+ FcTypecheckExpr (parse, expr->u.tree.right, type);
743
+ break;
744
+ case FcOpNot:
745
+ FcTypecheckValue (parse, FcTypeBool, type);
746
+ FcTypecheckExpr (parse, expr->u.tree.left, FcTypeBool);
747
+ break;
748
+ case FcOpFloor:
749
+ case FcOpCeil:
750
+ case FcOpRound:
751
+ case FcOpTrunc:
752
+ FcTypecheckValue (parse, FcTypeDouble, type);
753
+ FcTypecheckExpr (parse, expr->u.tree.left, FcTypeDouble);
754
+ break;
755
+ default:
756
+ break;
757
+ }
758
+ }
759
+
760
+ static FcTest *
761
+ FcTestCreate (FcConfigParse *parse,
762
+ FcMatchKind kind,
763
+ FcQual qual,
764
+ const FcChar8 *field,
765
+ unsigned int compare,
766
+ FcExpr *expr)
767
+ {
768
+ FcTest *test = (FcTest *) malloc (sizeof (FcTest));
769
+
770
+ if (test)
771
+ {
772
+ const FcObjectType *o;
773
+
774
+ test->kind = kind;
775
+ test->qual = qual;
776
+ test->object = FcObjectFromName ((const char *) field);
777
+ test->op = compare;
778
+ test->expr = expr;
779
+ o = FcNameGetObjectType (FcObjectName (test->object));
780
+ if (o)
781
+ FcTypecheckExpr (parse, expr, o->type);
782
+ }
783
+ return test;
784
+ }
785
+
786
+ static FcEdit *
787
+ FcEditCreate (FcConfigParse *parse,
788
+ FcObject object,
789
+ FcOp op,
790
+ FcExpr *expr,
791
+ FcValueBinding binding)
792
+ {
793
+ FcEdit *e = (FcEdit *) malloc (sizeof (FcEdit));
794
+
795
+ if (e)
796
+ {
797
+ const FcObjectType *o;
798
+
799
+ e->object = object;
800
+ e->op = op;
801
+ e->expr = expr;
802
+ e->binding = binding;
803
+ o = FcNameGetObjectType (FcObjectName (e->object));
804
+ if (o)
805
+ FcTypecheckExpr (parse, expr, o->type);
806
+ }
807
+ return e;
808
+ }
809
+
810
+ static FcRule *
811
+ FcRuleCreate (FcRuleType type,
812
+ void *p)
813
+ {
814
+ FcRule *r = (FcRule *) malloc (sizeof (FcRule));
815
+
816
+ if (!r)
817
+ return NULL;
818
+
819
+ r->next = NULL;
820
+ r->type = type;
821
+ switch (type)
822
+ {
823
+ case FcRuleTest:
824
+ r->u.test = (FcTest *) p;
825
+ break;
826
+ case FcRuleEdit:
827
+ r->u.edit = (FcEdit *) p;
828
+ break;
829
+ case FcRuleUnknown:
830
+ default:
831
+ free (r);
832
+ r = NULL;
833
+ break;
834
+ }
835
+
836
+ return r;
837
+ }
838
+
839
+ static FcVStack *
840
+ FcVStackCreateAndPush (FcConfigParse *parse)
841
+ {
842
+ FcVStack *new;
843
+
844
+ if (parse->vstack_static_used < sizeof (parse->vstack_static) / sizeof (parse->vstack_static[0]))
845
+ new = &parse->vstack_static[parse->vstack_static_used++];
846
+ else
847
+ {
848
+ new = malloc (sizeof (FcVStack));
849
+ if (!new)
850
+ return 0;
851
+ }
852
+ new->tag = FcVStackNone;
853
+ new->prev = 0;
854
+
855
+ new->prev = parse->vstack;
856
+ new->pstack = parse->pstack ? parse->pstack->prev : 0;
857
+ parse->vstack = new;
858
+
859
+ return new;
860
+ }
861
+
862
+ static FcBool
863
+ FcVStackPushString (FcConfigParse *parse, FcVStackTag tag, FcChar8 *string)
864
+ {
865
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
866
+ if (!vstack)
867
+ return FcFalse;
868
+ vstack->u.string = string;
869
+ vstack->tag = tag;
870
+ return FcTrue;
871
+ }
872
+
873
+ static FcBool
874
+ FcVStackPushInteger (FcConfigParse *parse, int integer)
875
+ {
876
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
877
+ if (!vstack)
878
+ return FcFalse;
879
+ vstack->u.integer = integer;
880
+ vstack->tag = FcVStackInteger;
881
+ return FcTrue;
882
+ }
883
+
884
+ static FcBool
885
+ FcVStackPushDouble (FcConfigParse *parse, double _double)
886
+ {
887
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
888
+ if (!vstack)
889
+ return FcFalse;
890
+ vstack->u._double = _double;
891
+ vstack->tag = FcVStackDouble;
892
+ return FcTrue;
893
+ }
894
+
895
+ static FcBool
896
+ FcVStackPushMatrix (FcConfigParse *parse, FcExprMatrix *matrix)
897
+ {
898
+ FcVStack *vstack;
899
+ vstack = FcVStackCreateAndPush (parse);
900
+ if (!vstack)
901
+ return FcFalse;
902
+ vstack->u.matrix = FcExprMatrixCopyShallow (matrix);
903
+ vstack->tag = FcVStackMatrix;
904
+ return FcTrue;
905
+ }
906
+
907
+ static FcBool
908
+ FcVStackPushRange (FcConfigParse *parse, FcRange *range)
909
+ {
910
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
911
+ if (!vstack)
912
+ return FcFalse;
913
+ vstack->u.range = range;
914
+ vstack->tag = FcVStackRange;
915
+ return FcTrue;
916
+ }
917
+
918
+ static FcBool
919
+ FcVStackPushBool (FcConfigParse *parse, FcBool bool_)
920
+ {
921
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
922
+ if (!vstack)
923
+ return FcFalse;
924
+ vstack->u.bool_ = bool_;
925
+ vstack->tag = FcVStackBool;
926
+ return FcTrue;
927
+ }
928
+
929
+ static FcBool
930
+ FcVStackPushCharSet (FcConfigParse *parse, FcCharSet *charset)
931
+ {
932
+ FcVStack *vstack;
933
+ if (!charset)
934
+ return FcFalse;
935
+ vstack = FcVStackCreateAndPush (parse);
936
+ if (!vstack)
937
+ return FcFalse;
938
+ vstack->u.charset = charset;
939
+ vstack->tag = FcVStackCharSet;
940
+ return FcTrue;
941
+ }
942
+
943
+ static FcBool
944
+ FcVStackPushLangSet (FcConfigParse *parse, FcLangSet *langset)
945
+ {
946
+ FcVStack *vstack;
947
+ if (!langset)
948
+ return FcFalse;
949
+ vstack = FcVStackCreateAndPush (parse);
950
+ if (!vstack)
951
+ return FcFalse;
952
+ vstack->u.langset = langset;
953
+ vstack->tag = FcVStackLangSet;
954
+ return FcTrue;
955
+ }
956
+
957
+ static FcBool
958
+ FcVStackPushName (FcConfigParse *parse, FcMatchKind kind, FcObject object)
959
+ {
960
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
961
+ if (!vstack)
962
+ return FcFalse;
963
+ vstack->u.name.object = object;
964
+ vstack->u.name.kind = kind;
965
+ vstack->tag = FcVStackName;
966
+ return FcTrue;
967
+ }
968
+
969
+ static FcBool
970
+ FcVStackPushTest (FcConfigParse *parse, FcTest *test)
971
+ {
972
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
973
+ if (!vstack)
974
+ return FcFalse;
975
+ vstack->u.test = test;
976
+ vstack->tag = FcVStackTest;
977
+ return FcTrue;
978
+ }
979
+
980
+ static FcBool
981
+ FcVStackPushExpr (FcConfigParse *parse, FcVStackTag tag, FcExpr *expr)
982
+ {
983
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
984
+ if (!vstack)
985
+ return FcFalse;
986
+ vstack->u.expr = expr;
987
+ vstack->tag = tag;
988
+ return FcTrue;
989
+ }
990
+
991
+ static FcBool
992
+ FcVStackPushEdit (FcConfigParse *parse, FcEdit *edit)
993
+ {
994
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
995
+ if (!vstack)
996
+ return FcFalse;
997
+ vstack->u.edit = edit;
998
+ vstack->tag = FcVStackEdit;
999
+ return FcTrue;
1000
+ }
1001
+
1002
+ static FcBool
1003
+ FcVStackPushPattern (FcConfigParse *parse, FcPattern *pattern)
1004
+ {
1005
+ FcVStack *vstack = FcVStackCreateAndPush (parse);
1006
+ if (!vstack)
1007
+ return FcFalse;
1008
+ vstack->u.pattern = pattern;
1009
+ vstack->tag = FcVStackPattern;
1010
+ return FcTrue;
1011
+ }
1012
+
1013
+ static FcVStack *
1014
+ FcVStackFetch (FcConfigParse *parse, int off)
1015
+ {
1016
+ FcVStack *vstack;
1017
+
1018
+ for (vstack = parse->vstack; vstack && off-- > 0; vstack = vstack->prev);
1019
+ return vstack;
1020
+ }
1021
+
1022
+ static FcVStack *
1023
+ FcVStackPeek (FcConfigParse *parse)
1024
+ {
1025
+ FcVStack *vstack = parse->vstack;
1026
+
1027
+ return vstack && vstack->pstack == parse->pstack ? vstack : 0;
1028
+ }
1029
+
1030
+ static void
1031
+ FcVStackPopAndDestroy (FcConfigParse *parse)
1032
+ {
1033
+ FcVStack *vstack = parse->vstack;
1034
+
1035
+ if (!vstack || vstack->pstack != parse->pstack)
1036
+ return;
1037
+
1038
+ parse->vstack = vstack->prev;
1039
+
1040
+ switch (vstack->tag) {
1041
+ case FcVStackNone:
1042
+ break;
1043
+ case FcVStackName:
1044
+ break;
1045
+ case FcVStackFamily:
1046
+ break;
1047
+ case FcVStackString:
1048
+ case FcVStackConstant:
1049
+ case FcVStackGlob:
1050
+ FcStrFree (vstack->u.string);
1051
+ break;
1052
+ case FcVStackPattern:
1053
+ FcPatternDestroy (vstack->u.pattern);
1054
+ break;
1055
+ case FcVStackInteger:
1056
+ case FcVStackDouble:
1057
+ break;
1058
+ case FcVStackMatrix:
1059
+ FcExprMatrixFreeShallow (vstack->u.matrix);
1060
+ break;
1061
+ case FcVStackBool:
1062
+ break;
1063
+ case FcVStackRange:
1064
+ FcRangeDestroy (vstack->u.range);
1065
+ break;
1066
+ case FcVStackCharSet:
1067
+ FcCharSetDestroy (vstack->u.charset);
1068
+ break;
1069
+ case FcVStackLangSet:
1070
+ FcLangSetDestroy (vstack->u.langset);
1071
+ break;
1072
+ case FcVStackTest:
1073
+ FcTestDestroy (vstack->u.test);
1074
+ break;
1075
+ case FcVStackExpr:
1076
+ case FcVStackPrefer:
1077
+ case FcVStackAccept:
1078
+ case FcVStackDefault:
1079
+ FcExprDestroy (vstack->u.expr);
1080
+ break;
1081
+ case FcVStackEdit:
1082
+ FcEditDestroy (vstack->u.edit);
1083
+ break;
1084
+ }
1085
+
1086
+ if (vstack == &parse->vstack_static[parse->vstack_static_used - 1])
1087
+ parse->vstack_static_used--;
1088
+ else
1089
+ free (vstack);
1090
+ }
1091
+
1092
+ static void
1093
+ FcVStackClear (FcConfigParse *parse)
1094
+ {
1095
+ while (FcVStackPeek (parse))
1096
+ FcVStackPopAndDestroy (parse);
1097
+ }
1098
+
1099
+ static int
1100
+ FcVStackElements (FcConfigParse *parse)
1101
+ {
1102
+ int h = 0;
1103
+ FcVStack *vstack = parse->vstack;
1104
+ while (vstack && vstack->pstack == parse->pstack)
1105
+ {
1106
+ h++;
1107
+ vstack = vstack->prev;
1108
+ }
1109
+ return h;
1110
+ }
1111
+
1112
+ static FcChar8 **
1113
+ FcConfigSaveAttr (const XML_Char **attr, FcChar8 **buf, int size_bytes)
1114
+ {
1115
+ int slen;
1116
+ int i;
1117
+ FcChar8 **new;
1118
+ FcChar8 *s;
1119
+
1120
+ if (!attr)
1121
+ return 0;
1122
+ slen = 0;
1123
+ for (i = 0; attr[i]; i++)
1124
+ slen += strlen ((char *) attr[i]) + 1;
1125
+ if (i == 0)
1126
+ return 0;
1127
+ slen += (i + 1) * sizeof (FcChar8 *);
1128
+ if (slen <= size_bytes)
1129
+ new = buf;
1130
+ else
1131
+ {
1132
+ new = malloc (slen);
1133
+ if (!new)
1134
+ {
1135
+ FcConfigMessage (0, FcSevereError, "out of memory");
1136
+ return 0;
1137
+ }
1138
+ }
1139
+ s = (FcChar8 *) (new + (i + 1));
1140
+ for (i = 0; attr[i]; i++)
1141
+ {
1142
+ new[i] = s;
1143
+ strcpy ((char *) s, (char *) attr[i]);
1144
+ s += strlen ((char *) s) + 1;
1145
+ }
1146
+ new[i] = 0;
1147
+ return new;
1148
+ }
1149
+
1150
+ static FcBool
1151
+ FcPStackPush (FcConfigParse *parse, FcElement element, const XML_Char **attr)
1152
+ {
1153
+ FcPStack *new;
1154
+
1155
+ if (parse->pstack_static_used < sizeof (parse->pstack_static) / sizeof (parse->pstack_static[0]))
1156
+ new = &parse->pstack_static[parse->pstack_static_used++];
1157
+ else
1158
+ {
1159
+ new = malloc (sizeof (FcPStack));
1160
+ if (!new)
1161
+ return FcFalse;
1162
+ }
1163
+
1164
+ new->prev = parse->pstack;
1165
+ new->element = element;
1166
+ new->attr = FcConfigSaveAttr (attr, new->attr_buf_static, sizeof (new->attr_buf_static));
1167
+ FcStrBufInit (&new->str, 0, 0);
1168
+ parse->pstack = new;
1169
+ return FcTrue;
1170
+ }
1171
+
1172
+ static FcBool
1173
+ FcPStackPop (FcConfigParse *parse)
1174
+ {
1175
+ FcPStack *old;
1176
+
1177
+ if (!parse->pstack)
1178
+ {
1179
+ FcConfigMessage (parse, FcSevereError, "mismatching element");
1180
+ return FcFalse;
1181
+ }
1182
+
1183
+ /* Don't check the attributes for FcElementNone */
1184
+ if (parse->pstack->element != FcElementNone &&
1185
+ parse->pstack->attr)
1186
+ {
1187
+ /* Warn about unused attrs. */
1188
+ FcChar8 **attrs = parse->pstack->attr;
1189
+ while (*attrs)
1190
+ {
1191
+ if (attrs[0][0])
1192
+ {
1193
+ FcConfigMessage (parse, FcSevereError, "invalid attribute '%s'", attrs[0]);
1194
+ }
1195
+ attrs += 2;
1196
+ }
1197
+ }
1198
+
1199
+ FcVStackClear (parse);
1200
+ old = parse->pstack;
1201
+ parse->pstack = old->prev;
1202
+ FcStrBufDestroy (&old->str);
1203
+
1204
+ if (old->attr && old->attr != old->attr_buf_static)
1205
+ free (old->attr);
1206
+
1207
+ if (old == &parse->pstack_static[parse->pstack_static_used - 1])
1208
+ parse->pstack_static_used--;
1209
+ else
1210
+ free (old);
1211
+ return FcTrue;
1212
+ }
1213
+
1214
+ static FcBool
1215
+ FcConfigParseInit (FcConfigParse *parse,
1216
+ const FcChar8 *name,
1217
+ FcConfig *config,
1218
+ XML_Parser parser,
1219
+ FcBool enabled)
1220
+ {
1221
+ parse->pstack = 0;
1222
+ parse->pstack_static_used = 0;
1223
+ parse->vstack = 0;
1224
+ parse->vstack_static_used = 0;
1225
+ parse->error = FcFalse;
1226
+ parse->name = name;
1227
+ parse->config = config;
1228
+ parse->ruleset = FcRuleSetCreate (name);
1229
+ parse->parser = parser;
1230
+ parse->scanOnly = !enabled;
1231
+ FcRuleSetEnable (parse->ruleset, enabled);
1232
+
1233
+ return FcTrue;
1234
+ }
1235
+
1236
+ static void
1237
+ FcConfigCleanup (FcConfigParse *parse)
1238
+ {
1239
+ while (parse->pstack)
1240
+ FcPStackPop (parse);
1241
+ FcRuleSetDestroy (parse->ruleset);
1242
+ parse->ruleset = NULL;
1243
+ }
1244
+
1245
+ static const FcChar8 *
1246
+ FcConfigGetAttribute (FcConfigParse *parse, const char *attr)
1247
+ {
1248
+ FcChar8 **attrs;
1249
+ if (!parse->pstack)
1250
+ return 0;
1251
+
1252
+ attrs = parse->pstack->attr;
1253
+ if (!attrs)
1254
+ return 0;
1255
+
1256
+ while (*attrs)
1257
+ {
1258
+ if (!strcmp ((char *) *attrs, attr))
1259
+ {
1260
+ attrs[0][0] = '\0'; /* Mark as used. */
1261
+ return attrs[1];
1262
+ }
1263
+ attrs += 2;
1264
+ }
1265
+ return 0;
1266
+ }
1267
+
1268
+ static void
1269
+ FcStartElement(void *userData, const XML_Char *name, const XML_Char **attr)
1270
+ {
1271
+ FcConfigParse *parse = userData;
1272
+ FcElement element;
1273
+
1274
+ element = FcElementMap (name);
1275
+ if (element == FcElementUnknown)
1276
+ FcConfigMessage (parse, FcSevereWarning, "unknown element \"%s\"", name);
1277
+
1278
+ if (!FcPStackPush (parse, element, attr))
1279
+ {
1280
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1281
+ return;
1282
+ }
1283
+ return;
1284
+ }
1285
+
1286
+ static void
1287
+ FcParseRescan (FcConfigParse *parse)
1288
+ {
1289
+ int n = FcVStackElements (parse);
1290
+ while (n-- > 0)
1291
+ {
1292
+ FcVStack *v = FcVStackFetch (parse, n);
1293
+ if (v->tag != FcVStackInteger)
1294
+ FcConfigMessage (parse, FcSevereWarning, "non-integer rescan");
1295
+ else
1296
+ parse->config->rescanInterval = v->u.integer;
1297
+ }
1298
+ }
1299
+
1300
+ static void
1301
+ FcParseInt (FcConfigParse *parse)
1302
+ {
1303
+ FcChar8 *s, *end;
1304
+ int l;
1305
+
1306
+ if (!parse->pstack)
1307
+ return;
1308
+ s = FcStrBufDoneStatic (&parse->pstack->str);
1309
+ if (!s)
1310
+ {
1311
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1312
+ return;
1313
+ }
1314
+ end = 0;
1315
+ l = (int) strtol ((char *) s, (char **)&end, 0);
1316
+ if (end != s + strlen ((char *) s))
1317
+ FcConfigMessage (parse, FcSevereError, "\"%s\": not a valid integer", s);
1318
+ else
1319
+ FcVStackPushInteger (parse, l);
1320
+ FcStrBufDestroy (&parse->pstack->str);
1321
+ }
1322
+
1323
+ /*
1324
+ * idea copied from glib g_ascii_strtod with
1325
+ * permission of the author (Alexander Larsson)
1326
+ */
1327
+
1328
+ #include <locale.h>
1329
+
1330
+ static double
1331
+ FcStrtod (char *s, char **end)
1332
+ {
1333
+ #ifndef __BIONIC__
1334
+ struct lconv *locale_data;
1335
+ #endif
1336
+ const char *decimal_point;
1337
+ int dlen;
1338
+ char *dot;
1339
+ double v;
1340
+
1341
+ /*
1342
+ * Have to swap the decimal point to match the current locale
1343
+ * if that locale doesn't use 0x2e
1344
+ */
1345
+ #ifndef __BIONIC__
1346
+ locale_data = localeconv ();
1347
+ decimal_point = locale_data->decimal_point;
1348
+ dlen = strlen (decimal_point);
1349
+ #else
1350
+ decimal_point = ".";
1351
+ dlen = 1;
1352
+ #endif
1353
+
1354
+ if ((dot = strchr (s, 0x2e)) &&
1355
+ (decimal_point[0] != 0x2e ||
1356
+ decimal_point[1] != 0))
1357
+ {
1358
+ char buf[128];
1359
+ int slen = strlen (s);
1360
+
1361
+ if (slen + dlen > (int) sizeof (buf))
1362
+ {
1363
+ if (end)
1364
+ *end = s;
1365
+ v = 0;
1366
+ }
1367
+ else
1368
+ {
1369
+ char *buf_end;
1370
+ /* mantissa */
1371
+ strncpy (buf, s, dot - s);
1372
+ /* decimal point */
1373
+ strcpy (buf + (dot - s), decimal_point);
1374
+ /* rest of number */
1375
+ strcpy (buf + (dot - s) + dlen, dot + 1);
1376
+ buf_end = 0;
1377
+ v = strtod (buf, &buf_end);
1378
+ if (buf_end) {
1379
+ buf_end = s + (buf_end - buf);
1380
+ if (buf_end > dot)
1381
+ buf_end -= dlen - 1;
1382
+ }
1383
+ if (end)
1384
+ *end = buf_end;
1385
+ }
1386
+ }
1387
+ else
1388
+ v = strtod (s, end);
1389
+ return v;
1390
+ }
1391
+
1392
+ static void
1393
+ FcParseDouble (FcConfigParse *parse)
1394
+ {
1395
+ FcChar8 *s, *end;
1396
+ double d;
1397
+
1398
+ if (!parse->pstack)
1399
+ return;
1400
+ s = FcStrBufDoneStatic (&parse->pstack->str);
1401
+ if (!s)
1402
+ {
1403
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1404
+ return;
1405
+ }
1406
+ end = 0;
1407
+ d = FcStrtod ((char *) s, (char **)&end);
1408
+ if (end != s + strlen ((char *) s))
1409
+ FcConfigMessage (parse, FcSevereError, "\"%s\": not a valid double", s);
1410
+ else
1411
+ FcVStackPushDouble (parse, d);
1412
+ FcStrBufDestroy (&parse->pstack->str);
1413
+ }
1414
+
1415
+ static void
1416
+ FcParseString (FcConfigParse *parse, FcVStackTag tag)
1417
+ {
1418
+ FcChar8 *s;
1419
+
1420
+ if (!parse->pstack)
1421
+ return;
1422
+ s = FcStrBufDone (&parse->pstack->str);
1423
+ if (!s)
1424
+ {
1425
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1426
+ return;
1427
+ }
1428
+ if (!FcVStackPushString (parse, tag, s))
1429
+ FcStrFree (s);
1430
+ }
1431
+
1432
+ static void
1433
+ FcParseName (FcConfigParse *parse)
1434
+ {
1435
+ const FcChar8 *kind_string;
1436
+ FcMatchKind kind;
1437
+ FcChar8 *s;
1438
+ FcObject object;
1439
+
1440
+ kind_string = FcConfigGetAttribute (parse, "target");
1441
+ if (!kind_string)
1442
+ kind = FcMatchDefault;
1443
+ else
1444
+ {
1445
+ if (!strcmp ((char *) kind_string, "pattern"))
1446
+ kind = FcMatchPattern;
1447
+ else if (!strcmp ((char *) kind_string, "font"))
1448
+ kind = FcMatchFont;
1449
+ else if (!strcmp ((char *) kind_string, "default"))
1450
+ kind = FcMatchDefault;
1451
+ else
1452
+ {
1453
+ FcConfigMessage (parse, FcSevereWarning, "invalid name target \"%s\"", kind_string);
1454
+ return;
1455
+ }
1456
+ }
1457
+
1458
+ if (!parse->pstack)
1459
+ return;
1460
+ s = FcStrBufDone (&parse->pstack->str);
1461
+ if (!s)
1462
+ {
1463
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1464
+ return;
1465
+ }
1466
+ object = FcObjectFromName ((const char *) s);
1467
+
1468
+ FcVStackPushName (parse, kind, object);
1469
+
1470
+ FcStrFree (s);
1471
+ }
1472
+
1473
+ static void
1474
+ FcParseMatrix (FcConfigParse *parse)
1475
+ {
1476
+ FcExprMatrix m;
1477
+
1478
+ m.yy = FcPopExpr (parse);
1479
+ m.yx = FcPopExpr (parse);
1480
+ m.xy = FcPopExpr (parse);
1481
+ m.xx = FcPopExpr (parse);
1482
+
1483
+ if (FcPopExpr (parse))
1484
+ FcConfigMessage (parse, FcSevereError, "wrong number of matrix elements");
1485
+ else
1486
+ FcVStackPushMatrix (parse, &m);
1487
+ }
1488
+
1489
+ static void
1490
+ FcParseRange (FcConfigParse *parse)
1491
+ {
1492
+ FcVStack *vstack;
1493
+ FcRange *r;
1494
+ FcChar32 n[2] = {0, 0};
1495
+ int count = 1;
1496
+ double d[2] = {0.0L, 0.0L};
1497
+ FcBool dflag = FcFalse;
1498
+
1499
+ while ((vstack = FcVStackPeek (parse)))
1500
+ {
1501
+ if (count < 0)
1502
+ {
1503
+ FcConfigMessage (parse, FcSevereError, "too many elements in range");
1504
+ return;
1505
+ }
1506
+ switch ((int) vstack->tag) {
1507
+ case FcVStackInteger:
1508
+ if (dflag)
1509
+ d[count] = (double)vstack->u.integer;
1510
+ else
1511
+ n[count] = vstack->u.integer;
1512
+ break;
1513
+ case FcVStackDouble:
1514
+ if (count == 0 && !dflag)
1515
+ d[1] = (double)n[1];
1516
+ d[count] = vstack->u._double;
1517
+ dflag = FcTrue;
1518
+ break;
1519
+ default:
1520
+ FcConfigMessage (parse, FcSevereError, "invalid element in range");
1521
+ if (dflag)
1522
+ d[count] = 0.0L;
1523
+ else
1524
+ n[count] = 0;
1525
+ break;
1526
+ }
1527
+ count--;
1528
+ FcVStackPopAndDestroy (parse);
1529
+ }
1530
+ if (count >= 0)
1531
+ {
1532
+ FcConfigMessage (parse, FcSevereError, "invalid range");
1533
+ return;
1534
+ }
1535
+ if (dflag)
1536
+ {
1537
+ if (d[0] > d[1])
1538
+ {
1539
+ FcConfigMessage (parse, FcSevereError, "invalid range");
1540
+ return;
1541
+ }
1542
+ r = FcRangeCreateDouble (d[0], d[1]);
1543
+ }
1544
+ else
1545
+ {
1546
+ if (n[0] > n[1])
1547
+ {
1548
+ FcConfigMessage (parse, FcSevereError, "invalid range");
1549
+ return;
1550
+ }
1551
+ r = FcRangeCreateInteger (n[0], n[1]);
1552
+ }
1553
+ FcVStackPushRange (parse, r);
1554
+ }
1555
+
1556
+ static FcBool
1557
+ FcConfigLexBool (FcConfigParse *parse, const FcChar8 *bool_)
1558
+ {
1559
+ FcBool result = FcFalse;
1560
+
1561
+ if (!FcNameBool (bool_, &result))
1562
+ FcConfigMessage (parse, FcSevereWarning, "\"%s\" is not known boolean",
1563
+ bool_);
1564
+ return result;
1565
+ }
1566
+
1567
+ static void
1568
+ FcParseBool (FcConfigParse *parse)
1569
+ {
1570
+ FcChar8 *s;
1571
+
1572
+ if (!parse->pstack)
1573
+ return;
1574
+ s = FcStrBufDoneStatic (&parse->pstack->str);
1575
+ if (!s)
1576
+ {
1577
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1578
+ return;
1579
+ }
1580
+ FcVStackPushBool (parse, FcConfigLexBool (parse, s));
1581
+ FcStrBufDestroy (&parse->pstack->str);
1582
+ }
1583
+
1584
+ static void
1585
+ FcParseCharSet (FcConfigParse *parse)
1586
+ {
1587
+ FcVStack *vstack;
1588
+ FcCharSet *charset = FcCharSetCreate ();
1589
+ FcChar32 i, begin, end;
1590
+ int n = 0;
1591
+
1592
+ while ((vstack = FcVStackPeek (parse)))
1593
+ {
1594
+ switch ((int) vstack->tag) {
1595
+ case FcVStackInteger:
1596
+ if (!FcCharSetAddChar (charset, vstack->u.integer))
1597
+ {
1598
+ FcConfigMessage (parse, FcSevereWarning, "invalid character: 0x%04x", vstack->u.integer);
1599
+ }
1600
+ else
1601
+ n++;
1602
+ break;
1603
+ case FcVStackRange:
1604
+ begin = (FcChar32) vstack->u.range->begin;
1605
+ end = (FcChar32) vstack->u.range->end;
1606
+
1607
+ if (begin <= end)
1608
+ {
1609
+ for (i = begin; i <= end; i++)
1610
+ {
1611
+ if (!FcCharSetAddChar (charset, i))
1612
+ {
1613
+ FcConfigMessage (parse, FcSevereWarning, "invalid character: 0x%04x", i);
1614
+ }
1615
+ else
1616
+ n++;
1617
+ }
1618
+ }
1619
+ break;
1620
+ default:
1621
+ FcConfigMessage (parse, FcSevereError, "invalid element in charset");
1622
+ break;
1623
+ }
1624
+ FcVStackPopAndDestroy (parse);
1625
+ }
1626
+ if (n > 0)
1627
+ FcVStackPushCharSet (parse, charset);
1628
+ else
1629
+ FcCharSetDestroy (charset);
1630
+ }
1631
+
1632
+ static void
1633
+ FcParseLangSet (FcConfigParse *parse)
1634
+ {
1635
+ FcVStack *vstack;
1636
+ FcLangSet *langset = FcLangSetCreate ();
1637
+ int n = 0;
1638
+
1639
+ while ((vstack = FcVStackPeek (parse)))
1640
+ {
1641
+ switch ((int) vstack->tag) {
1642
+ case FcVStackString:
1643
+ if (!FcLangSetAdd (langset, vstack->u.string))
1644
+ {
1645
+ FcConfigMessage (parse, FcSevereWarning, "invalid langset: %s", vstack->u.string);
1646
+ }
1647
+ else
1648
+ n++;
1649
+ break;
1650
+ default:
1651
+ FcConfigMessage (parse, FcSevereError, "invalid element in langset");
1652
+ break;
1653
+ }
1654
+ FcVStackPopAndDestroy (parse);
1655
+ }
1656
+ if (n > 0)
1657
+ FcVStackPushLangSet (parse, langset);
1658
+ else
1659
+ FcLangSetDestroy (langset);
1660
+ }
1661
+
1662
+ static FcBool
1663
+ FcConfigLexBinding (FcConfigParse *parse,
1664
+ const FcChar8 *binding_string,
1665
+ FcValueBinding *binding_ret)
1666
+ {
1667
+ FcValueBinding binding;
1668
+
1669
+ if (!binding_string)
1670
+ binding = FcValueBindingWeak;
1671
+ else
1672
+ {
1673
+ if (!strcmp ((char *) binding_string, "weak"))
1674
+ binding = FcValueBindingWeak;
1675
+ else if (!strcmp ((char *) binding_string, "strong"))
1676
+ binding = FcValueBindingStrong;
1677
+ else if (!strcmp ((char *) binding_string, "same"))
1678
+ binding = FcValueBindingSame;
1679
+ else
1680
+ {
1681
+ FcConfigMessage (parse, FcSevereWarning, "invalid binding \"%s\"", binding_string);
1682
+ return FcFalse;
1683
+ }
1684
+ }
1685
+ *binding_ret = binding;
1686
+ return FcTrue;
1687
+ }
1688
+
1689
+ static void
1690
+ FcParseFamilies (FcConfigParse *parse, FcVStackTag tag)
1691
+ {
1692
+ FcVStack *vstack;
1693
+ FcExpr *left, *expr = 0, *new;
1694
+
1695
+ while ((vstack = FcVStackPeek (parse)))
1696
+ {
1697
+ if (vstack->tag != FcVStackFamily)
1698
+ {
1699
+ FcConfigMessage (parse, FcSevereWarning, "non-family");
1700
+ FcVStackPopAndDestroy (parse);
1701
+ continue;
1702
+ }
1703
+ left = vstack->u.expr;
1704
+ vstack->tag = FcVStackNone;
1705
+ FcVStackPopAndDestroy (parse);
1706
+ if (expr)
1707
+ {
1708
+ new = FcExprCreateOp (parse->config, left, FcOpComma, expr);
1709
+ if (!new)
1710
+ {
1711
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1712
+ FcExprDestroy (left);
1713
+ FcExprDestroy (expr);
1714
+ break;
1715
+ }
1716
+ expr = new;
1717
+ }
1718
+ else
1719
+ expr = left;
1720
+ }
1721
+ if (expr)
1722
+ {
1723
+ if (!FcVStackPushExpr (parse, tag, expr))
1724
+ {
1725
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1726
+ FcExprDestroy (expr);
1727
+ }
1728
+ }
1729
+ }
1730
+
1731
+ static void
1732
+ FcParseFamily (FcConfigParse *parse)
1733
+ {
1734
+ FcChar8 *s;
1735
+ FcExpr *expr;
1736
+
1737
+ if (!parse->pstack)
1738
+ return;
1739
+ s = FcStrBufDoneStatic (&parse->pstack->str);
1740
+ if (!s)
1741
+ {
1742
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1743
+ return;
1744
+ }
1745
+ expr = FcExprCreateString (parse->config, s);
1746
+ FcStrBufDestroy (&parse->pstack->str);
1747
+ if (expr)
1748
+ FcVStackPushExpr (parse, FcVStackFamily, expr);
1749
+ }
1750
+
1751
+ static void
1752
+ FcParseAlias (FcConfigParse *parse)
1753
+ {
1754
+ FcExpr *family = 0, *accept = 0, *prefer = 0, *def = 0, *new = 0;
1755
+ FcEdit *edit = 0;
1756
+ FcVStack *vstack;
1757
+ FcRule *rule = NULL, *r;
1758
+ FcValueBinding binding;
1759
+ int n;
1760
+
1761
+ if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
1762
+ return;
1763
+ while ((vstack = FcVStackPeek (parse)))
1764
+ {
1765
+ switch ((int) vstack->tag) {
1766
+ case FcVStackFamily:
1767
+ if (family)
1768
+ {
1769
+ FcConfigMessage (parse, FcSevereWarning, "Having multiple <family> in <alias> isn't supported and may not work as expected");
1770
+ new = FcExprCreateOp (parse->config, vstack->u.expr, FcOpComma, family);
1771
+ if (!new)
1772
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1773
+ else
1774
+ family = new;
1775
+ }
1776
+ else
1777
+ new = vstack->u.expr;
1778
+ if (new)
1779
+ {
1780
+ family = new;
1781
+ vstack->tag = FcVStackNone;
1782
+ }
1783
+ break;
1784
+ case FcVStackPrefer:
1785
+ if (prefer)
1786
+ FcExprDestroy (prefer);
1787
+ prefer = vstack->u.expr;
1788
+ vstack->tag = FcVStackNone;
1789
+ break;
1790
+ case FcVStackAccept:
1791
+ if (accept)
1792
+ FcExprDestroy (accept);
1793
+ accept = vstack->u.expr;
1794
+ vstack->tag = FcVStackNone;
1795
+ break;
1796
+ case FcVStackDefault:
1797
+ if (def)
1798
+ FcExprDestroy (def);
1799
+ def = vstack->u.expr;
1800
+ vstack->tag = FcVStackNone;
1801
+ break;
1802
+ case FcVStackTest:
1803
+ if (rule)
1804
+ {
1805
+ r = FcRuleCreate (FcRuleTest, vstack->u.test);
1806
+ r->next = rule;
1807
+ rule = r;
1808
+ }
1809
+ else
1810
+ rule = FcRuleCreate (FcRuleTest, vstack->u.test);
1811
+ vstack->tag = FcVStackNone;
1812
+ break;
1813
+ default:
1814
+ FcConfigMessage (parse, FcSevereWarning, "bad alias");
1815
+ break;
1816
+ }
1817
+ FcVStackPopAndDestroy (parse);
1818
+ }
1819
+ if (!family)
1820
+ {
1821
+ FcConfigMessage (parse, FcSevereError, "missing family in alias");
1822
+ if (prefer)
1823
+ FcExprDestroy (prefer);
1824
+ if (accept)
1825
+ FcExprDestroy (accept);
1826
+ if (def)
1827
+ FcExprDestroy (def);
1828
+ if (rule)
1829
+ FcRuleDestroy (rule);
1830
+ return;
1831
+ }
1832
+ if (!prefer &&
1833
+ !accept &&
1834
+ !def)
1835
+ {
1836
+ FcExprDestroy (family);
1837
+ return;
1838
+ }
1839
+ else
1840
+ {
1841
+ FcTest *t = FcTestCreate (parse, FcMatchPattern,
1842
+ FcQualAny,
1843
+ (FcChar8 *) FC_FAMILY,
1844
+ FC_OP (FcOpEqual, FcOpFlagIgnoreBlanks),
1845
+ family);
1846
+ if (rule)
1847
+ {
1848
+ for (r = rule; r->next; r = r->next);
1849
+ r->next = FcRuleCreate (FcRuleTest, t);
1850
+ r = r->next;
1851
+ }
1852
+ else
1853
+ {
1854
+ r = rule = FcRuleCreate (FcRuleTest, t);
1855
+ }
1856
+ }
1857
+ if (prefer)
1858
+ {
1859
+ edit = FcEditCreate (parse,
1860
+ FC_FAMILY_OBJECT,
1861
+ FcOpPrepend,
1862
+ prefer,
1863
+ binding);
1864
+ if (!edit)
1865
+ FcExprDestroy (prefer);
1866
+ else
1867
+ {
1868
+ r->next = FcRuleCreate (FcRuleEdit, edit);
1869
+ r = r->next;
1870
+ }
1871
+ }
1872
+ if (accept)
1873
+ {
1874
+ edit = FcEditCreate (parse,
1875
+ FC_FAMILY_OBJECT,
1876
+ FcOpAppend,
1877
+ accept,
1878
+ binding);
1879
+ if (!edit)
1880
+ FcExprDestroy (accept);
1881
+ else
1882
+ {
1883
+ r->next = FcRuleCreate (FcRuleEdit, edit);
1884
+ r = r->next;
1885
+ }
1886
+ }
1887
+ if (def)
1888
+ {
1889
+ edit = FcEditCreate (parse,
1890
+ FC_FAMILY_OBJECT,
1891
+ FcOpAppendLast,
1892
+ def,
1893
+ binding);
1894
+ if (!edit)
1895
+ FcExprDestroy (def);
1896
+ else
1897
+ {
1898
+ r->next = FcRuleCreate (FcRuleEdit, edit);
1899
+ r = r->next;
1900
+ }
1901
+ }
1902
+ if ((n = FcRuleSetAdd (parse->ruleset, rule, FcMatchPattern)) == -1)
1903
+ FcRuleDestroy (rule);
1904
+ else
1905
+ if (parse->config->maxObjects < n)
1906
+ parse->config->maxObjects = n;
1907
+ }
1908
+
1909
+ static void
1910
+ FcParseDescription (FcConfigParse *parse)
1911
+ {
1912
+ const FcChar8 *domain;
1913
+ FcChar8 *desc;
1914
+
1915
+ domain = FcConfigGetAttribute (parse, "domain");
1916
+ desc = FcStrBufDone (&parse->pstack->str);
1917
+ if (!desc)
1918
+ {
1919
+ FcConfigMessage (parse, FcSevereError, "out of memory");
1920
+ return;
1921
+ }
1922
+ FcRuleSetAddDescription (parse->ruleset, domain, desc);
1923
+
1924
+ FcStrFree (desc);
1925
+ }
1926
+
1927
+ static FcExpr *
1928
+ FcPopExpr (FcConfigParse *parse)
1929
+ {
1930
+ FcVStack *vstack = FcVStackPeek (parse);
1931
+ FcExpr *expr = 0;
1932
+ if (!vstack)
1933
+ return 0;
1934
+ switch ((int) vstack->tag) {
1935
+ case FcVStackNone:
1936
+ break;
1937
+ case FcVStackString:
1938
+ case FcVStackFamily:
1939
+ expr = FcExprCreateString (parse->config, vstack->u.string);
1940
+ break;
1941
+ case FcVStackName:
1942
+ expr = FcExprCreateName (parse->config, vstack->u.name);
1943
+ break;
1944
+ case FcVStackConstant:
1945
+ expr = FcExprCreateConst (parse->config, vstack->u.string);
1946
+ break;
1947
+ case FcVStackGlob:
1948
+ /* XXX: What's the correct action here? (CDW) */
1949
+ break;
1950
+ case FcVStackPrefer:
1951
+ case FcVStackAccept:
1952
+ case FcVStackDefault:
1953
+ expr = vstack->u.expr;
1954
+ vstack->tag = FcVStackNone;
1955
+ break;
1956
+ case FcVStackInteger:
1957
+ expr = FcExprCreateInteger (parse->config, vstack->u.integer);
1958
+ break;
1959
+ case FcVStackDouble:
1960
+ expr = FcExprCreateDouble (parse->config, vstack->u._double);
1961
+ break;
1962
+ case FcVStackMatrix:
1963
+ expr = FcExprCreateMatrix (parse->config, vstack->u.matrix);
1964
+ break;
1965
+ case FcVStackRange:
1966
+ expr = FcExprCreateRange (parse->config, vstack->u.range);
1967
+ break;
1968
+ case FcVStackBool:
1969
+ expr = FcExprCreateBool (parse->config, vstack->u.bool_);
1970
+ break;
1971
+ case FcVStackCharSet:
1972
+ expr = FcExprCreateCharSet (parse->config, vstack->u.charset);
1973
+ break;
1974
+ case FcVStackLangSet:
1975
+ expr = FcExprCreateLangSet (parse->config, vstack->u.langset);
1976
+ break;
1977
+ case FcVStackTest:
1978
+ break;
1979
+ case FcVStackExpr:
1980
+ expr = vstack->u.expr;
1981
+ vstack->tag = FcVStackNone;
1982
+ break;
1983
+ case FcVStackEdit:
1984
+ break;
1985
+ default:
1986
+ break;
1987
+ }
1988
+ FcVStackPopAndDestroy (parse);
1989
+ return expr;
1990
+ }
1991
+
1992
+ /*
1993
+ * This builds a tree of binary operations. Note
1994
+ * that every operator is defined so that if only
1995
+ * a single operand is contained, the value of the
1996
+ * whole expression is the value of the operand.
1997
+ *
1998
+ * This code reduces in that case to returning that
1999
+ * operand.
2000
+ */
2001
+ static FcExpr *
2002
+ FcPopBinary (FcConfigParse *parse, FcOp op)
2003
+ {
2004
+ FcExpr *left, *expr = 0, *new;
2005
+
2006
+ while ((left = FcPopExpr (parse)))
2007
+ {
2008
+ if (expr)
2009
+ {
2010
+ new = FcExprCreateOp (parse->config, left, op, expr);
2011
+ if (!new)
2012
+ {
2013
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2014
+ FcExprDestroy (left);
2015
+ FcExprDestroy (expr);
2016
+ return 0;
2017
+ }
2018
+ expr = new;
2019
+ }
2020
+ else
2021
+ expr = left;
2022
+ }
2023
+ return expr;
2024
+ }
2025
+
2026
+ static void
2027
+ FcParseBinary (FcConfigParse *parse, FcOp op)
2028
+ {
2029
+ FcExpr *expr = FcPopBinary (parse, op);
2030
+ if (expr)
2031
+ FcVStackPushExpr (parse, FcVStackExpr, expr);
2032
+ }
2033
+
2034
+ /*
2035
+ * This builds a a unary operator, it consumes only
2036
+ * a single operand
2037
+ */
2038
+
2039
+ static FcExpr *
2040
+ FcPopUnary (FcConfigParse *parse, FcOp op)
2041
+ {
2042
+ FcExpr *operand, *new = 0;
2043
+
2044
+ if ((operand = FcPopExpr (parse)))
2045
+ {
2046
+ new = FcExprCreateOp (parse->config, operand, op, 0);
2047
+ if (!new)
2048
+ {
2049
+ FcExprDestroy (operand);
2050
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2051
+ }
2052
+ }
2053
+ return new;
2054
+ }
2055
+
2056
+ static void
2057
+ FcParseUnary (FcConfigParse *parse, FcOp op)
2058
+ {
2059
+ FcExpr *expr = FcPopUnary (parse, op);
2060
+ if (expr)
2061
+ FcVStackPushExpr (parse, FcVStackExpr, expr);
2062
+ }
2063
+
2064
+ static void
2065
+ FcParseDir (FcConfigParse *parse)
2066
+ {
2067
+ const FcChar8 *attr, *data;
2068
+ FcChar8 *prefix = NULL, *p;
2069
+ #ifdef _WIN32
2070
+ FcChar8 buffer[1000];
2071
+ #endif
2072
+
2073
+ attr = FcConfigGetAttribute (parse, "prefix");
2074
+ if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
2075
+ {
2076
+ prefix = FcConfigXdgDataHome ();
2077
+ /* home directory might be disabled.
2078
+ * simply ignore this element.
2079
+ */
2080
+ if (!prefix)
2081
+ goto bail;
2082
+ }
2083
+ data = FcStrBufDoneStatic (&parse->pstack->str);
2084
+ if (!data)
2085
+ {
2086
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2087
+ data = prefix;
2088
+ goto bail;
2089
+ }
2090
+ if (prefix)
2091
+ {
2092
+ size_t plen = strlen ((const char *)prefix);
2093
+ size_t dlen = strlen ((const char *)data);
2094
+
2095
+ p = realloc (prefix, plen + 1 + dlen + 1);
2096
+ if (!p)
2097
+ {
2098
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2099
+ goto bail;
2100
+ }
2101
+ prefix = p;
2102
+ prefix[plen] = FC_DIR_SEPARATOR;
2103
+ memcpy (&prefix[plen + 1], data, dlen);
2104
+ prefix[plen + 1 + dlen] = 0;
2105
+ data = prefix;
2106
+ }
2107
+ #ifdef _WIN32
2108
+ if (strcmp ((const char *) data, "CUSTOMFONTDIR") == 0)
2109
+ {
2110
+ FcChar8 *p;
2111
+ data = buffer;
2112
+ if (!GetModuleFileName (NULL, (LPCH) buffer, sizeof (buffer) - 20))
2113
+ {
2114
+ FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed");
2115
+ goto bail;
2116
+ }
2117
+ /*
2118
+ * Must use the multi-byte aware function to search
2119
+ * for backslash because East Asian double-byte code
2120
+ * pages have characters with backslash as the second
2121
+ * byte.
2122
+ */
2123
+ p = _mbsrchr (data, '\\');
2124
+ if (p) *p = '\0';
2125
+ strcat ((char *) data, "\\fonts");
2126
+ }
2127
+ else if (strcmp ((const char *) data, "APPSHAREFONTDIR") == 0)
2128
+ {
2129
+ FcChar8 *p;
2130
+ data = buffer;
2131
+ if (!GetModuleFileName (NULL, (LPCH) buffer, sizeof (buffer) - 20))
2132
+ {
2133
+ FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed");
2134
+ goto bail;
2135
+ }
2136
+ p = _mbsrchr (data, '\\');
2137
+ if (p) *p = '\0';
2138
+ strcat ((char *) data, "\\..\\share\\fonts");
2139
+ }
2140
+ else if (strcmp ((const char *) data, "WINDOWSFONTDIR") == 0)
2141
+ {
2142
+ int rc;
2143
+ data = buffer;
2144
+ rc = pGetSystemWindowsDirectory ((LPSTR) buffer, sizeof (buffer) - 20);
2145
+ if (rc == 0 || rc > sizeof (buffer) - 20)
2146
+ {
2147
+ FcConfigMessage (parse, FcSevereError, "GetSystemWindowsDirectory failed");
2148
+ goto bail;
2149
+ }
2150
+ if (data [strlen ((const char *) data) - 1] != '\\')
2151
+ strcat ((char *) data, "\\");
2152
+ strcat ((char *) data, "fonts");
2153
+ }
2154
+ #endif
2155
+ if (strlen ((char *) data) == 0)
2156
+ FcConfigMessage (parse, FcSevereWarning, "empty font directory name ignored");
2157
+ else if (!parse->scanOnly && (!FcStrUsesHome (data) || FcConfigHome ()))
2158
+ {
2159
+ if (!FcConfigAddFontDir (parse->config, data))
2160
+ FcConfigMessage (parse, FcSevereError, "out of memory; cannot add directory %s", data);
2161
+ }
2162
+ FcStrBufDestroy (&parse->pstack->str);
2163
+
2164
+ bail:
2165
+ if (prefix)
2166
+ FcStrFree (prefix);
2167
+ }
2168
+
2169
+ static void
2170
+ FcParseCacheDir (FcConfigParse *parse)
2171
+ {
2172
+ const FcChar8 *attr;
2173
+ FcChar8 *prefix = NULL, *p, *data = NULL;
2174
+
2175
+ attr = FcConfigGetAttribute (parse, "prefix");
2176
+ if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
2177
+ {
2178
+ prefix = FcConfigXdgCacheHome ();
2179
+ /* home directory might be disabled.
2180
+ * simply ignore this element.
2181
+ */
2182
+ if (!prefix)
2183
+ goto bail;
2184
+ }
2185
+ data = FcStrBufDone (&parse->pstack->str);
2186
+ if (!data)
2187
+ {
2188
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2189
+ goto bail;
2190
+ }
2191
+ if (prefix)
2192
+ {
2193
+ size_t plen = strlen ((const char *)prefix);
2194
+ size_t dlen = strlen ((const char *)data);
2195
+
2196
+ p = realloc (prefix, plen + 1 + dlen + 1);
2197
+ if (!p)
2198
+ {
2199
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2200
+ data = prefix;
2201
+ goto bail;
2202
+ }
2203
+ prefix = p;
2204
+ prefix[plen] = FC_DIR_SEPARATOR;
2205
+ memcpy (&prefix[plen + 1], data, dlen);
2206
+ prefix[plen + 1 + dlen] = 0;
2207
+ FcStrFree (data);
2208
+ data = prefix;
2209
+ }
2210
+ #ifdef _WIN32
2211
+ else if (data[0] == '/' && fontconfig_instprefix[0] != '\0')
2212
+ {
2213
+ size_t plen = strlen ((const char *)fontconfig_instprefix);
2214
+ size_t dlen = strlen ((const char *)data);
2215
+
2216
+ prefix = malloc (plen + 1 + dlen + 1);
2217
+ if (!prefix)
2218
+ {
2219
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2220
+ goto bail;
2221
+ }
2222
+ strcpy ((char *) prefix, (char *) fontconfig_instprefix);
2223
+ prefix[plen] = FC_DIR_SEPARATOR;
2224
+ memcpy (&prefix[plen + 1], data, dlen);
2225
+ prefix[plen + 1 + dlen] = 0;
2226
+ FcStrFree (data);
2227
+ data = prefix;
2228
+ }
2229
+ else if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0)
2230
+ {
2231
+ int rc;
2232
+ FcStrFree (data);
2233
+ data = malloc (1000);
2234
+ if (!data)
2235
+ {
2236
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2237
+ goto bail;
2238
+ }
2239
+ rc = GetTempPath (800, (LPSTR) data);
2240
+ if (rc == 0 || rc > 800)
2241
+ {
2242
+ FcConfigMessage (parse, FcSevereError, "GetTempPath failed");
2243
+ goto bail;
2244
+ }
2245
+ if (data [strlen ((const char *) data) - 1] != '\\')
2246
+ strcat ((char *) data, "\\");
2247
+ strcat ((char *) data, "fontconfig\\cache");
2248
+ }
2249
+ else if (strcmp ((const char *) data, "LOCAL_APPDATA_FONTCONFIG_CACHE") == 0)
2250
+ {
2251
+ char szFPath[MAX_PATH + 1];
2252
+ size_t len;
2253
+
2254
+ if (!(pSHGetFolderPathA && SUCCEEDED(pSHGetFolderPathA(NULL, /* CSIDL_LOCAL_APPDATA */ 28, NULL, 0, szFPath))))
2255
+ {
2256
+ FcConfigMessage (parse, FcSevereError, "SHGetFolderPathA failed");
2257
+ goto bail;
2258
+ }
2259
+ strncat(szFPath, "\\fontconfig\\cache", MAX_PATH - 1 - strlen(szFPath));
2260
+ len = strlen(szFPath) + 1;
2261
+ FcStrFree (data);
2262
+ data = malloc(len);
2263
+ if (!data)
2264
+ {
2265
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2266
+ goto bail;
2267
+ }
2268
+ strncpy((char *) data, szFPath, len);
2269
+ }
2270
+ #endif
2271
+ if (strlen ((char *) data) == 0)
2272
+ FcConfigMessage (parse, FcSevereWarning, "empty cache directory name ignored");
2273
+ else if (!parse->scanOnly && (!FcStrUsesHome (data) || FcConfigHome ()))
2274
+ {
2275
+ if (!FcConfigAddCacheDir (parse->config, data))
2276
+ FcConfigMessage (parse, FcSevereError, "out of memory; cannot add cache directory %s", data);
2277
+ }
2278
+ FcStrBufDestroy (&parse->pstack->str);
2279
+
2280
+ bail:
2281
+ if (data)
2282
+ FcStrFree (data);
2283
+ }
2284
+
2285
+ void
2286
+ FcConfigPathFini (void)
2287
+ {
2288
+ FcChar8 *s;
2289
+
2290
+ retry_dir:
2291
+ s = fc_atomic_ptr_get (&__fc_userdir);
2292
+ if (!fc_atomic_ptr_cmpexch (&__fc_userdir, s, NULL))
2293
+ goto retry_dir;
2294
+ free (s);
2295
+
2296
+ retry_conf:
2297
+ s = fc_atomic_ptr_get (&__fc_userconf);
2298
+ if (!fc_atomic_ptr_cmpexch (&__fc_userconf, s, NULL))
2299
+ goto retry_conf;
2300
+ free (s);
2301
+ }
2302
+
2303
+ static void
2304
+ FcParseInclude (FcConfigParse *parse)
2305
+ {
2306
+ FcChar8 *s;
2307
+ const FcChar8 *attr;
2308
+ FcBool ignore_missing = FcFalse;
2309
+ #ifndef _WIN32
2310
+ FcBool deprecated = FcFalse;
2311
+ #endif
2312
+ FcChar8 *prefix = NULL, *p;
2313
+ FcChar8 *userdir = NULL, *userconf = NULL;
2314
+ FcRuleSet *ruleset;
2315
+ FcMatchKind k;
2316
+
2317
+ s = FcStrBufDoneStatic (&parse->pstack->str);
2318
+ if (!s)
2319
+ {
2320
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2321
+ goto bail;
2322
+ }
2323
+ attr = FcConfigGetAttribute (parse, "ignore_missing");
2324
+ if (attr && FcConfigLexBool (parse, (FcChar8 *) attr) == FcTrue)
2325
+ ignore_missing = FcTrue;
2326
+ attr = FcConfigGetAttribute (parse, "deprecated");
2327
+ #ifndef _WIN32
2328
+ if (attr && FcConfigLexBool (parse, (FcChar8 *) attr) == FcTrue)
2329
+ deprecated = FcTrue;
2330
+ #endif
2331
+ attr = FcConfigGetAttribute (parse, "prefix");
2332
+ if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
2333
+ {
2334
+ prefix = FcConfigXdgConfigHome ();
2335
+ /* home directory might be disabled.
2336
+ * simply ignore this element.
2337
+ */
2338
+ if (!prefix)
2339
+ goto bail;
2340
+ }
2341
+ if (prefix)
2342
+ {
2343
+ size_t plen = strlen ((const char *)prefix);
2344
+ size_t dlen = strlen ((const char *)s);
2345
+ FcChar8 *u;
2346
+
2347
+ p = realloc (prefix, plen + 1 + dlen + 1);
2348
+ if (!p)
2349
+ {
2350
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2351
+ goto bail;
2352
+ }
2353
+ prefix = p;
2354
+ prefix[plen] = FC_DIR_SEPARATOR;
2355
+ memcpy (&prefix[plen + 1], s, dlen);
2356
+ prefix[plen + 1 + dlen] = 0;
2357
+ s = prefix;
2358
+ if (FcFileIsDir (s))
2359
+ {
2360
+ userdir:
2361
+ userdir = fc_atomic_ptr_get (&__fc_userdir);
2362
+ if (!userdir)
2363
+ {
2364
+ u = FcStrdup (s);
2365
+ if (!fc_atomic_ptr_cmpexch (&__fc_userdir, userdir, u))
2366
+ {
2367
+ free (u);
2368
+ goto userdir;
2369
+ }
2370
+ userdir = u;
2371
+ }
2372
+ }
2373
+ else if (FcFileIsFile (s))
2374
+ {
2375
+ userconf:
2376
+ userconf = fc_atomic_ptr_get (&__fc_userconf);
2377
+ if (!userconf)
2378
+ {
2379
+ u = FcStrdup (s);
2380
+ if (!fc_atomic_ptr_cmpexch (&__fc_userconf, userconf, u))
2381
+ {
2382
+ free (u);
2383
+ goto userconf;
2384
+ }
2385
+ userconf = u;
2386
+ }
2387
+ }
2388
+ else
2389
+ {
2390
+ /* No config dir nor file on the XDG directory spec compliant place
2391
+ * so need to guess what it is supposed to be.
2392
+ */
2393
+ if (FcStrStr (s, (const FcChar8 *)"conf.d") != NULL)
2394
+ goto userdir;
2395
+ else
2396
+ goto userconf;
2397
+ }
2398
+ }
2399
+ /* flush the ruleset into the queue */
2400
+ ruleset = parse->ruleset;
2401
+ parse->ruleset = FcRuleSetCreate (ruleset->name);
2402
+ FcRuleSetEnable (parse->ruleset, ruleset->enabled);
2403
+ FcRuleSetAddDescription (parse->ruleset, ruleset->domain, ruleset->description);
2404
+ for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
2405
+ {
2406
+ FcPtrListIter iter;
2407
+
2408
+ FcPtrListIterInit (ruleset->subst[k], &iter);
2409
+ if (FcPtrListIterIsValid (ruleset->subst[k], &iter))
2410
+ {
2411
+ FcPtrListIterInitAtLast (parse->config->subst[k], &iter);
2412
+ FcRuleSetReference (ruleset);
2413
+ FcPtrListIterAdd (parse->config->subst[k], &iter, ruleset);
2414
+ }
2415
+ }
2416
+ FcRuleSetDestroy (ruleset);
2417
+ if (!_FcConfigParse (parse->config, s, !ignore_missing, !parse->scanOnly))
2418
+ parse->error = FcTrue;
2419
+ #ifndef _WIN32
2420
+ else
2421
+ {
2422
+ FcChar8 *filename;
2423
+ static FcBool warn_conf = FcFalse, warn_confd = FcFalse;
2424
+
2425
+ filename = FcConfigFilename(s);
2426
+ if (deprecated == FcTrue &&
2427
+ filename != NULL &&
2428
+ userdir != NULL &&
2429
+ !FcFileIsLink (filename))
2430
+ {
2431
+ if (FcFileIsDir (filename))
2432
+ {
2433
+ FcChar8 *parent = FcStrDirname (userdir);
2434
+
2435
+ if (!FcFileIsDir (parent))
2436
+ FcMakeDirectory (parent);
2437
+ FcStrFree (parent);
2438
+ if (FcFileIsDir (userdir) ||
2439
+ rename ((const char *)filename, (const char *)userdir) != 0 ||
2440
+ symlink ((const char *)userdir, (const char *)filename) != 0)
2441
+ {
2442
+ if (!warn_confd)
2443
+ {
2444
+ FcConfigMessage (parse, FcSevereWarning, "reading configurations from %s is deprecated. please move it to %s manually", s, userdir);
2445
+ warn_confd = FcTrue;
2446
+ }
2447
+ }
2448
+ }
2449
+ else
2450
+ {
2451
+ FcChar8 *parent = FcStrDirname (userconf);
2452
+
2453
+ if (!FcFileIsDir (parent))
2454
+ FcMakeDirectory (parent);
2455
+ FcStrFree (parent);
2456
+ if (FcFileIsFile (userconf) ||
2457
+ rename ((const char *)filename, (const char *)userconf) != 0 ||
2458
+ symlink ((const char *)userconf, (const char *)filename) != 0)
2459
+ {
2460
+ if (!warn_conf)
2461
+ {
2462
+ FcConfigMessage (parse, FcSevereWarning, "reading configurations from %s is deprecated. please move it to %s manually", s, userconf);
2463
+ warn_conf = FcTrue;
2464
+ }
2465
+ }
2466
+ }
2467
+ }
2468
+ if(filename)
2469
+ FcStrFree(filename);
2470
+ }
2471
+ #endif
2472
+ FcStrBufDestroy (&parse->pstack->str);
2473
+
2474
+ bail:
2475
+ if (prefix)
2476
+ FcStrFree (prefix);
2477
+ }
2478
+
2479
+ typedef struct _FcOpMap {
2480
+ char name[16];
2481
+ FcOp op;
2482
+ } FcOpMap;
2483
+
2484
+ static FcOp
2485
+ FcConfigLexOp (const FcChar8 *op, const FcOpMap *map, int nmap)
2486
+ {
2487
+ int i;
2488
+
2489
+ for (i = 0; i < nmap; i++)
2490
+ if (!strcmp ((char *) op, map[i].name))
2491
+ return map[i].op;
2492
+ return FcOpInvalid;
2493
+ }
2494
+
2495
+ static const FcOpMap fcCompareOps[] = {
2496
+ { "eq", FcOpEqual },
2497
+ { "not_eq", FcOpNotEqual },
2498
+ { "less", FcOpLess },
2499
+ { "less_eq", FcOpLessEqual },
2500
+ { "more", FcOpMore },
2501
+ { "more_eq", FcOpMoreEqual },
2502
+ { "contains", FcOpContains },
2503
+ { "not_contains", FcOpNotContains }
2504
+ };
2505
+
2506
+ #define NUM_COMPARE_OPS (int) (sizeof fcCompareOps / sizeof fcCompareOps[0])
2507
+
2508
+ static FcOp
2509
+ FcConfigLexCompare (const FcChar8 *compare)
2510
+ {
2511
+ return FcConfigLexOp (compare, fcCompareOps, NUM_COMPARE_OPS);
2512
+ }
2513
+
2514
+ static void
2515
+ FcParseTest (FcConfigParse *parse)
2516
+ {
2517
+ const FcChar8 *kind_string;
2518
+ FcMatchKind kind;
2519
+ const FcChar8 *qual_string;
2520
+ FcQual qual;
2521
+ const FcChar8 *name;
2522
+ const FcChar8 *compare_string;
2523
+ FcOp compare;
2524
+ FcExpr *expr;
2525
+ FcTest *test;
2526
+ const FcChar8 *iblanks_string;
2527
+ int flags = 0;
2528
+
2529
+ kind_string = FcConfigGetAttribute (parse, "target");
2530
+ if (!kind_string)
2531
+ kind = FcMatchDefault;
2532
+ else
2533
+ {
2534
+ if (!strcmp ((char *) kind_string, "pattern"))
2535
+ kind = FcMatchPattern;
2536
+ else if (!strcmp ((char *) kind_string, "font"))
2537
+ kind = FcMatchFont;
2538
+ else if (!strcmp ((char *) kind_string, "scan"))
2539
+ kind = FcMatchScan;
2540
+ else if (!strcmp ((char *) kind_string, "default"))
2541
+ kind = FcMatchDefault;
2542
+ else
2543
+ {
2544
+ FcConfigMessage (parse, FcSevereWarning, "invalid test target \"%s\"", kind_string);
2545
+ return;
2546
+ }
2547
+ }
2548
+ qual_string = FcConfigGetAttribute (parse, "qual");
2549
+ if (!qual_string)
2550
+ qual = FcQualAny;
2551
+ else
2552
+ {
2553
+ if (!strcmp ((char *) qual_string, "any"))
2554
+ qual = FcQualAny;
2555
+ else if (!strcmp ((char *) qual_string, "all"))
2556
+ qual = FcQualAll;
2557
+ else if (!strcmp ((char *) qual_string, "first"))
2558
+ qual = FcQualFirst;
2559
+ else if (!strcmp ((char *) qual_string, "not_first"))
2560
+ qual = FcQualNotFirst;
2561
+ else
2562
+ {
2563
+ FcConfigMessage (parse, FcSevereWarning, "invalid test qual \"%s\"", qual_string);
2564
+ return;
2565
+ }
2566
+ }
2567
+ name = FcConfigGetAttribute (parse, "name");
2568
+ if (!name)
2569
+ {
2570
+ FcConfigMessage (parse, FcSevereWarning, "missing test name");
2571
+ return;
2572
+ }
2573
+ compare_string = FcConfigGetAttribute (parse, "compare");
2574
+ if (!compare_string)
2575
+ compare = FcOpEqual;
2576
+ else
2577
+ {
2578
+ compare = FcConfigLexCompare (compare_string);
2579
+ if (compare == FcOpInvalid)
2580
+ {
2581
+ FcConfigMessage (parse, FcSevereWarning, "invalid test compare \"%s\"", compare_string);
2582
+ return;
2583
+ }
2584
+ }
2585
+ iblanks_string = FcConfigGetAttribute (parse, "ignore-blanks");
2586
+ if (iblanks_string)
2587
+ {
2588
+ FcBool f = FcFalse;
2589
+
2590
+ if (!FcNameBool (iblanks_string, &f))
2591
+ {
2592
+ FcConfigMessage (parse,
2593
+ FcSevereWarning,
2594
+ "invalid test ignore-blanks \"%s\"", iblanks_string);
2595
+ }
2596
+ if (f)
2597
+ flags |= FcOpFlagIgnoreBlanks;
2598
+ }
2599
+ expr = FcPopBinary (parse, FcOpComma);
2600
+ if (!expr)
2601
+ {
2602
+ FcConfigMessage (parse, FcSevereWarning, "missing test expression");
2603
+ return;
2604
+ }
2605
+ if (expr->op == FcOpComma)
2606
+ {
2607
+ FcConfigMessage (parse, FcSevereWarning, "Having multiple values in <test> isn't supported and may not work as expected");
2608
+ }
2609
+ test = FcTestCreate (parse, kind, qual, name, FC_OP (compare, flags), expr);
2610
+ if (!test)
2611
+ {
2612
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2613
+ return;
2614
+ }
2615
+ FcVStackPushTest (parse, test);
2616
+ }
2617
+
2618
+ static const FcOpMap fcModeOps[] = {
2619
+ { "assign", FcOpAssign },
2620
+ { "assign_replace", FcOpAssignReplace },
2621
+ { "prepend", FcOpPrepend },
2622
+ { "prepend_first", FcOpPrependFirst },
2623
+ { "append", FcOpAppend },
2624
+ { "append_last", FcOpAppendLast },
2625
+ { "delete", FcOpDelete },
2626
+ { "delete_all", FcOpDeleteAll },
2627
+ };
2628
+
2629
+ #define NUM_MODE_OPS (int) (sizeof fcModeOps / sizeof fcModeOps[0])
2630
+
2631
+ static FcOp
2632
+ FcConfigLexMode (const FcChar8 *mode)
2633
+ {
2634
+ return FcConfigLexOp (mode, fcModeOps, NUM_MODE_OPS);
2635
+ }
2636
+
2637
+ static void
2638
+ FcParseEdit (FcConfigParse *parse)
2639
+ {
2640
+ const FcChar8 *name;
2641
+ const FcChar8 *mode_string;
2642
+ FcOp mode;
2643
+ FcValueBinding binding;
2644
+ FcExpr *expr;
2645
+ FcEdit *edit;
2646
+
2647
+ name = FcConfigGetAttribute (parse, "name");
2648
+ if (!name)
2649
+ {
2650
+ FcConfigMessage (parse, FcSevereWarning, "missing edit name");
2651
+ return;
2652
+ }
2653
+ mode_string = FcConfigGetAttribute (parse, "mode");
2654
+ if (!mode_string)
2655
+ mode = FcOpAssign;
2656
+ else
2657
+ {
2658
+ mode = FcConfigLexMode (mode_string);
2659
+ if (mode == FcOpInvalid)
2660
+ {
2661
+ FcConfigMessage (parse, FcSevereWarning, "invalid edit mode \"%s\"", mode_string);
2662
+ return;
2663
+ }
2664
+ }
2665
+ if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
2666
+ return;
2667
+
2668
+ expr = FcPopBinary (parse, FcOpComma);
2669
+ if ((mode == FcOpDelete || mode == FcOpDeleteAll) &&
2670
+ expr != NULL)
2671
+ {
2672
+ FcConfigMessage (parse, FcSevereWarning, "Expression doesn't take any effects for delete and delete_all");
2673
+ FcExprDestroy (expr);
2674
+ expr = NULL;
2675
+ }
2676
+ edit = FcEditCreate (parse, FcObjectFromName ((char *) name),
2677
+ mode, expr, binding);
2678
+ if (!edit)
2679
+ {
2680
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2681
+ FcExprDestroy (expr);
2682
+ return;
2683
+ }
2684
+ if (!FcVStackPushEdit (parse, edit))
2685
+ FcEditDestroy (edit);
2686
+ }
2687
+
2688
+ static void
2689
+ FcParseMatch (FcConfigParse *parse)
2690
+ {
2691
+ const FcChar8 *kind_name;
2692
+ FcMatchKind kind;
2693
+ FcVStack *vstack;
2694
+ FcRule *rule = NULL, *r;
2695
+ int n;
2696
+
2697
+ kind_name = FcConfigGetAttribute (parse, "target");
2698
+ if (!kind_name)
2699
+ kind = FcMatchPattern;
2700
+ else
2701
+ {
2702
+ if (!strcmp ((char *) kind_name, "pattern"))
2703
+ kind = FcMatchPattern;
2704
+ else if (!strcmp ((char *) kind_name, "font"))
2705
+ kind = FcMatchFont;
2706
+ else if (!strcmp ((char *) kind_name, "scan"))
2707
+ kind = FcMatchScan;
2708
+ else
2709
+ {
2710
+ FcConfigMessage (parse, FcSevereWarning, "invalid match target \"%s\"", kind_name);
2711
+ return;
2712
+ }
2713
+ }
2714
+ while ((vstack = FcVStackPeek (parse)))
2715
+ {
2716
+ switch ((int) vstack->tag) {
2717
+ case FcVStackTest:
2718
+ r = FcRuleCreate (FcRuleTest, vstack->u.test);
2719
+ if (rule)
2720
+ r->next = rule;
2721
+ rule = r;
2722
+ vstack->tag = FcVStackNone;
2723
+ break;
2724
+ case FcVStackEdit:
2725
+ if (kind == FcMatchScan && vstack->u.edit->object > FC_MAX_BASE_OBJECT)
2726
+ {
2727
+ FcConfigMessage (parse, FcSevereError,
2728
+ "<match target=\"scan\"> cannot edit user-defined object \"%s\"",
2729
+ FcObjectName(vstack->u.edit->object));
2730
+ if (rule)
2731
+ FcRuleDestroy (rule);
2732
+ return;
2733
+ }
2734
+ r = FcRuleCreate (FcRuleEdit, vstack->u.edit);
2735
+ if (rule)
2736
+ r->next = rule;
2737
+ rule = r;
2738
+ vstack->tag = FcVStackNone;
2739
+ break;
2740
+ default:
2741
+ FcConfigMessage (parse, FcSevereWarning, "invalid match element");
2742
+ break;
2743
+ }
2744
+ FcVStackPopAndDestroy (parse);
2745
+ }
2746
+ if (!rule)
2747
+ {
2748
+ FcConfigMessage (parse, FcSevereWarning, "No <test> nor <edit> elements in <match>");
2749
+ return;
2750
+ }
2751
+ if ((n = FcRuleSetAdd (parse->ruleset, rule, kind)) == -1)
2752
+ {
2753
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2754
+ FcRuleDestroy (rule);
2755
+ }
2756
+ else
2757
+ if (parse->config->maxObjects < n)
2758
+ parse->config->maxObjects = n;
2759
+ }
2760
+
2761
+ static void
2762
+ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
2763
+ {
2764
+ FcVStack *vstack;
2765
+
2766
+ while ((vstack = FcVStackPeek (parse)))
2767
+ {
2768
+ switch ((int) vstack->tag) {
2769
+ case FcVStackGlob:
2770
+ if (!parse->scanOnly && !FcConfigGlobAdd (parse->config,
2771
+ vstack->u.string,
2772
+ element == FcElementAcceptfont))
2773
+ {
2774
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2775
+ }
2776
+ break;
2777
+ case FcVStackPattern:
2778
+ if (!parse->scanOnly && !FcConfigPatternsAdd (parse->config,
2779
+ vstack->u.pattern,
2780
+ element == FcElementAcceptfont))
2781
+ {
2782
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2783
+ }
2784
+ else
2785
+ vstack->tag = FcVStackNone;
2786
+ break;
2787
+ default:
2788
+ FcConfigMessage (parse, FcSevereWarning, "bad font selector");
2789
+ break;
2790
+ }
2791
+ FcVStackPopAndDestroy (parse);
2792
+ }
2793
+ }
2794
+
2795
+
2796
+ static FcValue
2797
+ FcPopValue (FcConfigParse *parse)
2798
+ {
2799
+ FcVStack *vstack = FcVStackPeek (parse);
2800
+ FcValue value;
2801
+
2802
+ value.type = FcTypeVoid;
2803
+
2804
+ if (!vstack)
2805
+ return value;
2806
+
2807
+ switch ((int) vstack->tag) {
2808
+ case FcVStackString:
2809
+ value.u.s = FcStrdup (vstack->u.string);
2810
+ if (value.u.s)
2811
+ value.type = FcTypeString;
2812
+ break;
2813
+ case FcVStackConstant:
2814
+ if (FcNameConstant (vstack->u.string, &value.u.i))
2815
+ value.type = FcTypeInteger;
2816
+ break;
2817
+ case FcVStackInteger:
2818
+ value.u.i = vstack->u.integer;
2819
+ value.type = FcTypeInteger;
2820
+ break;
2821
+ case FcVStackDouble:
2822
+ value.u.d = vstack->u._double;
2823
+ value.type = FcTypeDouble;
2824
+ break;
2825
+ case FcVStackBool:
2826
+ value.u.b = vstack->u.bool_;
2827
+ value.type = FcTypeBool;
2828
+ break;
2829
+ case FcVStackCharSet:
2830
+ value.u.c = FcCharSetCopy (vstack->u.charset);
2831
+ if (value.u.c)
2832
+ value.type = FcTypeCharSet;
2833
+ break;
2834
+ case FcVStackLangSet:
2835
+ value.u.l = FcLangSetCopy (vstack->u.langset);
2836
+ if (value.u.l)
2837
+ value.type = FcTypeLangSet;
2838
+ break;
2839
+ case FcVStackRange:
2840
+ value.u.r = FcRangeCopy (vstack->u.range);
2841
+ if (value.u.r)
2842
+ value.type = FcTypeRange;
2843
+ break;
2844
+ default:
2845
+ FcConfigMessage (parse, FcSevereWarning, "unknown pattern element %d",
2846
+ vstack->tag);
2847
+ break;
2848
+ }
2849
+ FcVStackPopAndDestroy (parse);
2850
+
2851
+ return value;
2852
+ }
2853
+
2854
+ static void
2855
+ FcParsePatelt (FcConfigParse *parse)
2856
+ {
2857
+ FcValue value;
2858
+ FcPattern *pattern = FcPatternCreate ();
2859
+ const char *name;
2860
+
2861
+ if (!pattern)
2862
+ {
2863
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2864
+ return;
2865
+ }
2866
+
2867
+ name = (char *) FcConfigGetAttribute (parse, "name");
2868
+ if (!name)
2869
+ {
2870
+ FcConfigMessage (parse, FcSevereWarning, "missing pattern element name");
2871
+ FcPatternDestroy (pattern);
2872
+ return;
2873
+ }
2874
+
2875
+ for (;;)
2876
+ {
2877
+ value = FcPopValue (parse);
2878
+ if (value.type == FcTypeVoid)
2879
+ break;
2880
+ if (!FcPatternAdd (pattern, name, value, FcTrue))
2881
+ {
2882
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2883
+ FcValueDestroy(value);
2884
+ break;
2885
+ }
2886
+ FcValueDestroy(value);
2887
+ }
2888
+
2889
+ FcVStackPushPattern (parse, pattern);
2890
+ }
2891
+
2892
+ static void
2893
+ FcParsePattern (FcConfigParse *parse)
2894
+ {
2895
+ FcVStack *vstack;
2896
+ FcPattern *pattern = FcPatternCreate ();
2897
+
2898
+ if (!pattern)
2899
+ {
2900
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2901
+ return;
2902
+ }
2903
+
2904
+ while ((vstack = FcVStackPeek (parse)))
2905
+ {
2906
+ switch ((int) vstack->tag) {
2907
+ case FcVStackPattern:
2908
+ if (!FcPatternAppend (pattern, vstack->u.pattern))
2909
+ {
2910
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2911
+ FcPatternDestroy (pattern);
2912
+ return;
2913
+ }
2914
+ break;
2915
+ default:
2916
+ FcConfigMessage (parse, FcSevereWarning, "unknown pattern element");
2917
+ break;
2918
+ }
2919
+ FcVStackPopAndDestroy (parse);
2920
+ }
2921
+
2922
+ FcVStackPushPattern (parse, pattern);
2923
+ }
2924
+
2925
+ static void
2926
+ FcEndElement(void *userData, const XML_Char *name FC_UNUSED)
2927
+ {
2928
+ FcConfigParse *parse = userData;
2929
+ FcChar8 *data;
2930
+
2931
+ if (!parse->pstack)
2932
+ return;
2933
+ switch (parse->pstack->element) {
2934
+ case FcElementNone:
2935
+ break;
2936
+ case FcElementFontconfig:
2937
+ break;
2938
+ case FcElementDir:
2939
+ FcParseDir (parse);
2940
+ break;
2941
+ case FcElementCacheDir:
2942
+ FcParseCacheDir (parse);
2943
+ break;
2944
+ case FcElementCache:
2945
+ data = FcStrBufDoneStatic (&parse->pstack->str);
2946
+ if (!data)
2947
+ {
2948
+ FcConfigMessage (parse, FcSevereError, "out of memory");
2949
+ break;
2950
+ }
2951
+ /* discard this data; no longer used */
2952
+ FcStrBufDestroy (&parse->pstack->str);
2953
+ break;
2954
+ case FcElementInclude:
2955
+ FcParseInclude (parse);
2956
+ break;
2957
+ case FcElementConfig:
2958
+ break;
2959
+ case FcElementMatch:
2960
+ FcParseMatch (parse);
2961
+ break;
2962
+ case FcElementAlias:
2963
+ FcParseAlias (parse);
2964
+ break;
2965
+ case FcElementDescription:
2966
+ FcParseDescription (parse);
2967
+ break;
2968
+
2969
+ case FcElementRescan:
2970
+ FcParseRescan (parse);
2971
+ break;
2972
+
2973
+ case FcElementPrefer:
2974
+ FcParseFamilies (parse, FcVStackPrefer);
2975
+ break;
2976
+ case FcElementAccept:
2977
+ FcParseFamilies (parse, FcVStackAccept);
2978
+ break;
2979
+ case FcElementDefault:
2980
+ FcParseFamilies (parse, FcVStackDefault);
2981
+ break;
2982
+ case FcElementFamily:
2983
+ FcParseFamily (parse);
2984
+ break;
2985
+
2986
+ case FcElementTest:
2987
+ FcParseTest (parse);
2988
+ break;
2989
+ case FcElementEdit:
2990
+ FcParseEdit (parse);
2991
+ break;
2992
+
2993
+ case FcElementInt:
2994
+ FcParseInt (parse);
2995
+ break;
2996
+ case FcElementDouble:
2997
+ FcParseDouble (parse);
2998
+ break;
2999
+ case FcElementString:
3000
+ FcParseString (parse, FcVStackString);
3001
+ break;
3002
+ case FcElementMatrix:
3003
+ FcParseMatrix (parse);
3004
+ break;
3005
+ case FcElementRange:
3006
+ FcParseRange (parse);
3007
+ break;
3008
+ case FcElementBool:
3009
+ FcParseBool (parse);
3010
+ break;
3011
+ case FcElementCharSet:
3012
+ FcParseCharSet (parse);
3013
+ break;
3014
+ case FcElementLangSet:
3015
+ FcParseLangSet (parse);
3016
+ break;
3017
+ case FcElementSelectfont:
3018
+ break;
3019
+ case FcElementAcceptfont:
3020
+ case FcElementRejectfont:
3021
+ FcParseAcceptRejectFont (parse, parse->pstack->element);
3022
+ break;
3023
+ case FcElementGlob:
3024
+ FcParseString (parse, FcVStackGlob);
3025
+ break;
3026
+ case FcElementPattern:
3027
+ FcParsePattern (parse);
3028
+ break;
3029
+ case FcElementPatelt:
3030
+ FcParsePatelt (parse);
3031
+ break;
3032
+ case FcElementName:
3033
+ FcParseName (parse);
3034
+ break;
3035
+ case FcElementConst:
3036
+ FcParseString (parse, FcVStackConstant);
3037
+ break;
3038
+ case FcElementOr:
3039
+ FcParseBinary (parse, FcOpOr);
3040
+ break;
3041
+ case FcElementAnd:
3042
+ FcParseBinary (parse, FcOpAnd);
3043
+ break;
3044
+ case FcElementEq:
3045
+ FcParseBinary (parse, FcOpEqual);
3046
+ break;
3047
+ case FcElementNotEq:
3048
+ FcParseBinary (parse, FcOpNotEqual);
3049
+ break;
3050
+ case FcElementLess:
3051
+ FcParseBinary (parse, FcOpLess);
3052
+ break;
3053
+ case FcElementLessEq:
3054
+ FcParseBinary (parse, FcOpLessEqual);
3055
+ break;
3056
+ case FcElementMore:
3057
+ FcParseBinary (parse, FcOpMore);
3058
+ break;
3059
+ case FcElementMoreEq:
3060
+ FcParseBinary (parse, FcOpMoreEqual);
3061
+ break;
3062
+ case FcElementContains:
3063
+ FcParseBinary (parse, FcOpContains);
3064
+ break;
3065
+ case FcElementNotContains:
3066
+ FcParseBinary (parse, FcOpNotContains);
3067
+ break;
3068
+ case FcElementPlus:
3069
+ FcParseBinary (parse, FcOpPlus);
3070
+ break;
3071
+ case FcElementMinus:
3072
+ FcParseBinary (parse, FcOpMinus);
3073
+ break;
3074
+ case FcElementTimes:
3075
+ FcParseBinary (parse, FcOpTimes);
3076
+ break;
3077
+ case FcElementDivide:
3078
+ FcParseBinary (parse, FcOpDivide);
3079
+ break;
3080
+ case FcElementNot:
3081
+ FcParseUnary (parse, FcOpNot);
3082
+ break;
3083
+ case FcElementIf:
3084
+ FcParseBinary (parse, FcOpQuest);
3085
+ break;
3086
+ case FcElementFloor:
3087
+ FcParseUnary (parse, FcOpFloor);
3088
+ break;
3089
+ case FcElementCeil:
3090
+ FcParseUnary (parse, FcOpCeil);
3091
+ break;
3092
+ case FcElementRound:
3093
+ FcParseUnary (parse, FcOpRound);
3094
+ break;
3095
+ case FcElementTrunc:
3096
+ FcParseUnary (parse, FcOpTrunc);
3097
+ break;
3098
+ case FcElementUnknown:
3099
+ break;
3100
+ }
3101
+ (void) FcPStackPop (parse);
3102
+ }
3103
+
3104
+ static void
3105
+ FcCharacterData (void *userData, const XML_Char *s, int len)
3106
+ {
3107
+ FcConfigParse *parse = userData;
3108
+
3109
+ if (!parse->pstack)
3110
+ return;
3111
+ if (!FcStrBufData (&parse->pstack->str, (FcChar8 *) s, len))
3112
+ FcConfigMessage (parse, FcSevereError, "out of memory");
3113
+ }
3114
+
3115
+ static void
3116
+ FcStartDoctypeDecl (void *userData,
3117
+ const XML_Char *doctypeName,
3118
+ const XML_Char *sysid FC_UNUSED,
3119
+ const XML_Char *pubid FC_UNUSED,
3120
+ int has_internal_subset FC_UNUSED)
3121
+ {
3122
+ FcConfigParse *parse = userData;
3123
+
3124
+ if (strcmp ((char *) doctypeName, "fontconfig") != 0)
3125
+ FcConfigMessage (parse, FcSevereError, "invalid doctype \"%s\"", doctypeName);
3126
+ }
3127
+
3128
+ #ifdef ENABLE_LIBXML2
3129
+
3130
+ static void
3131
+ FcInternalSubsetDecl (void *userData,
3132
+ const XML_Char *doctypeName,
3133
+ const XML_Char *sysid,
3134
+ const XML_Char *pubid)
3135
+ {
3136
+ FcStartDoctypeDecl (userData, doctypeName, sysid, pubid, 1);
3137
+ }
3138
+
3139
+ static void
3140
+ FcExternalSubsetDecl (void *userData,
3141
+ const XML_Char *doctypeName,
3142
+ const XML_Char *sysid,
3143
+ const XML_Char *pubid)
3144
+ {
3145
+ FcStartDoctypeDecl (userData, doctypeName, sysid, pubid, 0);
3146
+ }
3147
+
3148
+ #else /* ENABLE_LIBXML2 */
3149
+
3150
+ static void
3151
+ FcEndDoctypeDecl (void *userData FC_UNUSED)
3152
+ {
3153
+ }
3154
+
3155
+ #endif /* ENABLE_LIBXML2 */
3156
+
3157
+ static int
3158
+ FcSortCmpStr (const void *a, const void *b)
3159
+ {
3160
+ const FcChar8 *as = *((FcChar8 **) a);
3161
+ const FcChar8 *bs = *((FcChar8 **) b);
3162
+ return FcStrCmp (as, bs);
3163
+ }
3164
+
3165
+ static FcBool
3166
+ FcConfigParseAndLoadDir (FcConfig *config,
3167
+ const FcChar8 *name,
3168
+ const FcChar8 *dir,
3169
+ FcBool complain,
3170
+ FcBool load)
3171
+ {
3172
+ DIR *d;
3173
+ struct dirent *e;
3174
+ FcBool ret = FcTrue;
3175
+ FcChar8 *file;
3176
+ FcChar8 *base;
3177
+ FcStrSet *files;
3178
+
3179
+ d = opendir ((char *) dir);
3180
+ if (!d)
3181
+ {
3182
+ if (complain)
3183
+ FcConfigMessage (0, FcSevereError, "Cannot open config dir \"%s\"",
3184
+ name);
3185
+ ret = FcFalse;
3186
+ goto bail0;
3187
+ }
3188
+ /* freed below */
3189
+ file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1);
3190
+ if (!file)
3191
+ {
3192
+ ret = FcFalse;
3193
+ goto bail1;
3194
+ }
3195
+
3196
+ strcpy ((char *) file, (char *) dir);
3197
+ strcat ((char *) file, "/");
3198
+ base = file + strlen ((char *) file);
3199
+
3200
+ files = FcStrSetCreateEx (FCSS_GROW_BY_64);
3201
+ if (!files)
3202
+ {
3203
+ ret = FcFalse;
3204
+ goto bail2;
3205
+ }
3206
+
3207
+ if (FcDebug () & FC_DBG_CONFIG)
3208
+ printf ("\tScanning config dir %s\n", dir);
3209
+
3210
+ if (load)
3211
+ FcConfigAddConfigDir (config, dir);
3212
+
3213
+ while (ret && (e = readdir (d)))
3214
+ {
3215
+ int d_len;
3216
+ #define TAIL ".conf"
3217
+ #define TAIL_LEN 5
3218
+ /*
3219
+ * Add all files of the form [0-9]*.conf
3220
+ */
3221
+ if ('0' <= e->d_name[0] && e->d_name[0] <= '9' &&
3222
+ (d_len = strlen (e->d_name)) < FC_MAX_FILE_LEN &&
3223
+ d_len > TAIL_LEN &&
3224
+ strcmp (e->d_name + d_len - TAIL_LEN, TAIL) == 0)
3225
+ {
3226
+ strcpy ((char *) base, (char *) e->d_name);
3227
+ if (!FcStrSetAdd (files, file))
3228
+ {
3229
+ ret = FcFalse;
3230
+ goto bail3;
3231
+ }
3232
+ }
3233
+ }
3234
+ if (ret)
3235
+ {
3236
+ int i;
3237
+ qsort (files->strs, files->num, sizeof (FcChar8 *),
3238
+ (int (*)(const void *, const void *)) FcSortCmpStr);
3239
+ for (i = 0; ret && i < files->num; i++)
3240
+ ret = _FcConfigParse (config, files->strs[i], complain, load);
3241
+ }
3242
+ bail3:
3243
+ FcStrSetDestroy (files);
3244
+ bail2:
3245
+ free (file);
3246
+ bail1:
3247
+ closedir (d);
3248
+ bail0:
3249
+ return ret || !complain;
3250
+ }
3251
+
3252
+ #ifdef _WIN32
3253
+ pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory = NULL;
3254
+ pfnSHGetFolderPathA pSHGetFolderPathA = NULL;
3255
+ #endif
3256
+
3257
+ static FcBool
3258
+ FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
3259
+ const FcChar8 *filename,
3260
+ const FcChar8 *buffer,
3261
+ FcBool complain,
3262
+ FcBool load)
3263
+ {
3264
+
3265
+ XML_Parser p;
3266
+ size_t len;
3267
+ FcConfigParse parse;
3268
+ FcBool error = FcTrue;
3269
+ FcMatchKind k;
3270
+ FcPtrListIter liter;
3271
+
3272
+ #ifdef ENABLE_LIBXML2
3273
+ xmlSAXHandler sax;
3274
+ #else
3275
+ void *buf;
3276
+ const FcChar8 *s;
3277
+ size_t buflen;
3278
+ #endif
3279
+
3280
+ if (!buffer)
3281
+ return FcFalse;
3282
+ len = strlen ((const char *) buffer);
3283
+ if (FcDebug () & FC_DBG_CONFIG)
3284
+ printf ("\t%s config file from %s\n", load ? "Loading" : "Scanning", filename);
3285
+
3286
+ #ifdef ENABLE_LIBXML2
3287
+ memset(&sax, 0, sizeof(sax));
3288
+
3289
+ sax.internalSubset = FcInternalSubsetDecl;
3290
+ sax.externalSubset = FcExternalSubsetDecl;
3291
+ sax.startElement = FcStartElement;
3292
+ sax.endElement = FcEndElement;
3293
+ sax.characters = FcCharacterData;
3294
+
3295
+ p = xmlCreatePushParserCtxt (&sax, &parse, NULL, 0, (const char *) filename);
3296
+ #else
3297
+ p = XML_ParserCreate ("UTF-8");
3298
+ #endif
3299
+
3300
+ if (!p)
3301
+ goto bail1;
3302
+
3303
+ if (!FcConfigParseInit (&parse, filename, config, p, load))
3304
+ goto bail2;
3305
+
3306
+ #ifndef ENABLE_LIBXML2
3307
+
3308
+ XML_SetUserData (p, &parse);
3309
+
3310
+ XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl);
3311
+ XML_SetElementHandler (p, FcStartElement, FcEndElement);
3312
+ XML_SetCharacterDataHandler (p, FcCharacterData);
3313
+
3314
+ #endif /* ENABLE_LIBXML2 */
3315
+
3316
+ #ifndef ENABLE_LIBXML2
3317
+ s = buffer;
3318
+ do {
3319
+ buf = XML_GetBuffer (p, BUFSIZ);
3320
+ if (!buf)
3321
+ {
3322
+ FcConfigMessage (&parse, FcSevereError, "cannot get parse buffer");
3323
+ goto bail3;
3324
+ }
3325
+ if (len > BUFSIZ)
3326
+ {
3327
+ buflen = BUFSIZ;
3328
+ len -= BUFSIZ;
3329
+ }
3330
+ else
3331
+ {
3332
+ buflen = len;
3333
+ len = 0;
3334
+ }
3335
+ memcpy (buf, s, buflen);
3336
+ s = s + buflen;
3337
+ #endif
3338
+
3339
+ #ifdef ENABLE_LIBXML2
3340
+ if (xmlParseChunk (p, (const char *)buffer, len, len == 0))
3341
+ #else
3342
+ if (!XML_ParseBuffer (p, buflen, buflen == 0))
3343
+ #endif
3344
+ {
3345
+ FcConfigMessage (&parse, FcSevereError, "%s",
3346
+ XML_ErrorString (XML_GetErrorCode (p)));
3347
+ goto bail3;
3348
+ }
3349
+ #ifndef ENABLE_LIBXML2
3350
+ } while (buflen != 0);
3351
+ #endif
3352
+ error = parse.error;
3353
+ if (load)
3354
+ {
3355
+ for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
3356
+ {
3357
+ FcPtrListIter iter;
3358
+
3359
+ FcPtrListIterInit (parse.ruleset->subst[k], &iter);
3360
+ if (FcPtrListIterIsValid (parse.ruleset->subst[k], &iter))
3361
+ {
3362
+ FcPtrListIterInitAtLast (parse.config->subst[k], &iter);
3363
+ FcRuleSetReference (parse.ruleset);
3364
+ FcPtrListIterAdd (parse.config->subst[k], &iter, parse.ruleset);
3365
+ }
3366
+ }
3367
+ }
3368
+ FcPtrListIterInitAtLast (parse.config->rulesetList, &liter);
3369
+ FcRuleSetReference (parse.ruleset);
3370
+ FcPtrListIterAdd (parse.config->rulesetList, &liter, parse.ruleset);
3371
+ bail3:
3372
+ FcConfigCleanup (&parse);
3373
+ bail2:
3374
+ XML_ParserFree (p);
3375
+ bail1:
3376
+ if (error && complain)
3377
+ {
3378
+ FcConfigMessage (0, FcSevereError, "Cannot %s config file from %s", load ? "load" : "scan", filename);
3379
+ return FcFalse;
3380
+ }
3381
+ if (FcDebug () & FC_DBG_CONFIG)
3382
+ printf ("\t%s config file from %s done\n", load ? "Loading" : "Scanning", filename);
3383
+ return FcTrue;
3384
+ }
3385
+
3386
+ static FcBool
3387
+ _FcConfigParse (FcConfig *config,
3388
+ const FcChar8 *name,
3389
+ FcBool complain,
3390
+ FcBool load)
3391
+ {
3392
+ FcChar8 *filename = NULL, *realfilename = NULL;
3393
+ int fd;
3394
+ int len;
3395
+ FcStrBuf sbuf;
3396
+ char buf[BUFSIZ];
3397
+ FcBool ret = FcFalse;
3398
+
3399
+ #ifdef _WIN32
3400
+ if (!pGetSystemWindowsDirectory)
3401
+ {
3402
+ HMODULE hk32 = GetModuleHandleA("kernel32.dll");
3403
+ if (!(pGetSystemWindowsDirectory = (pfnGetSystemWindowsDirectory) GetProcAddress(hk32, "GetSystemWindowsDirectoryA")))
3404
+ pGetSystemWindowsDirectory = (pfnGetSystemWindowsDirectory) GetWindowsDirectory;
3405
+ }
3406
+ if (!pSHGetFolderPathA)
3407
+ {
3408
+ HMODULE hSh = LoadLibraryA("shfolder.dll");
3409
+ /* the check is done later, because there is no provided fallback */
3410
+ if (hSh)
3411
+ pSHGetFolderPathA = (pfnSHGetFolderPathA) GetProcAddress(hSh, "SHGetFolderPathA");
3412
+ }
3413
+ #endif
3414
+
3415
+ filename = FcConfigFilename (name);
3416
+ if (!filename)
3417
+ goto bail0;
3418
+ realfilename = FcConfigRealFilename (config, name);
3419
+ if (!realfilename)
3420
+ goto bail0;
3421
+ if (FcStrSetMember (config->availConfigFiles, realfilename))
3422
+ {
3423
+ FcStrFree (filename);
3424
+ FcStrFree (realfilename);
3425
+ return FcTrue;
3426
+ }
3427
+
3428
+ if (load)
3429
+ {
3430
+ if (!FcStrSetAdd (config->configFiles, filename))
3431
+ goto bail0;
3432
+ }
3433
+ if (!FcStrSetAdd (config->availConfigFiles, realfilename))
3434
+ goto bail0;
3435
+
3436
+ if (FcFileIsDir (realfilename))
3437
+ {
3438
+ ret = FcConfigParseAndLoadDir (config, name, realfilename, complain, load);
3439
+ FcStrFree (filename);
3440
+ FcStrFree (realfilename);
3441
+ return ret;
3442
+ }
3443
+
3444
+ FcStrBufInit (&sbuf, NULL, 0);
3445
+
3446
+ fd = FcOpen ((char *) filename, O_RDONLY);
3447
+ if (fd == -1)
3448
+ goto bail1;
3449
+
3450
+ do {
3451
+ len = read (fd, buf, BUFSIZ);
3452
+ if (len < 0)
3453
+ {
3454
+ FcConfigMessage (0, FcSevereError, "failed reading config file");
3455
+ close (fd);
3456
+ goto bail1;
3457
+ }
3458
+ FcStrBufData (&sbuf, (const FcChar8 *)buf, len);
3459
+ } while (len != 0);
3460
+ close (fd);
3461
+
3462
+ ret = FcConfigParseAndLoadFromMemoryInternal (config, filename, FcStrBufDoneStatic (&sbuf), complain, load);
3463
+ complain = FcFalse; /* no need to reclaim here */
3464
+ bail1:
3465
+ FcStrBufDestroy (&sbuf);
3466
+ bail0:
3467
+ if (filename)
3468
+ FcStrFree (filename);
3469
+ if (realfilename)
3470
+ FcStrFree (realfilename);
3471
+ if (!ret && complain)
3472
+ {
3473
+ if (name)
3474
+ FcConfigMessage (0, FcSevereError, "Cannot %s config file \"%s\"", load ? "load" : "scan", name);
3475
+ else
3476
+ FcConfigMessage (0, FcSevereError, "Cannot %s default config file", load ? "load" : "scan");
3477
+ return FcFalse;
3478
+ }
3479
+ return FcTrue;
3480
+ }
3481
+
3482
+ FcBool
3483
+ FcConfigParseOnly (FcConfig *config,
3484
+ const FcChar8 *name,
3485
+ FcBool complain)
3486
+ {
3487
+ return _FcConfigParse (config, name, complain, FcFalse);
3488
+ }
3489
+
3490
+ FcBool
3491
+ FcConfigParseAndLoad (FcConfig *config,
3492
+ const FcChar8 *name,
3493
+ FcBool complain)
3494
+ {
3495
+ return _FcConfigParse (config, name, complain, FcTrue);
3496
+ }
3497
+
3498
+ FcBool
3499
+ FcConfigParseAndLoadFromMemory (FcConfig *config,
3500
+ const FcChar8 *buffer,
3501
+ FcBool complain)
3502
+ {
3503
+ return FcConfigParseAndLoadFromMemoryInternal (config, (const FcChar8 *)"memory", buffer, complain, FcTrue);
3504
+ }
3505
+
3506
+ #define __fcxml__
3507
+ #include "fcaliastail.h"
3508
+ #undef __fcxml__