laag-fontconfig 2.13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +57 -0
- data/LICENSE.txt +28 -0
- data/README.org +34 -0
- data/ext/laag/fontconfig/extconf.rb +13 -0
- data/laag-fontconfig.gemspec +20 -0
- data/lib/laag/fontconfig.rb +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/AUTHORS +3 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/COPYING +28 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/INSTALL +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/Makefile.am +158 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/NEWS +0 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/README +2016 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/Tools.mk +64 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/autogen.sh +126 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-autohint.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-full.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-medium.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-none.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-hinting-slight.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-no-sub-pixel.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-scale-bitmap-fonts.conf +87 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-bgr.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-rgb.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-vbgr.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-sub-pixel-vrgb.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/10-unhinted.conf +19 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/11-lcdfilter-default.conf +21 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/11-lcdfilter-legacy.conf +21 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/11-lcdfilter-light.conf +21 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/20-unhint-small-vera.conf +53 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/25-unhint-nonlatin.conf +132 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/30-metric-aliases.conf +634 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/40-nonlatin.conf +236 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/45-generic.conf +136 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/45-latin.conf +278 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/49-sansserif.conf +26 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/50-user.conf +20 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/51-local.conf +11 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/60-generic.conf +67 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/60-latin.conf +79 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/65-fonts-persian.conf +423 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/65-khmer.conf +20 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/65-nonlatin.conf +200 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/69-unifont.conf +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/70-no-bitmaps.conf +17 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/70-yes-bitmaps.conf +17 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/80-delicious.conf +23 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/90-synthetic.conf +68 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/Makefile.am +110 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/conf.d/README.in +23 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/config-fixups.h +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/configure.ac +793 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/Makefile.am +224 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/check-missing-doc +24 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/confdir.sgml.in +26 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/edit-sgml.c +546 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcatomic.fncs +95 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcblanks.fncs +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fccache.fncs +104 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fccharset.fncs +242 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcconfig.fncs +447 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcconstant.fncs +58 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcdircache.fncs +99 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcfile.fncs +88 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcfontset.fncs +140 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcformat.fncs +309 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcfreetype.fncs +135 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcinit.fncs +92 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fclangset.fncs +201 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcmatrix.fncs +125 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcobjectset.fncs +73 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcobjecttype.fncs +48 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcpattern.fncs +433 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcrange.fncs +75 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcstring.fncs +244 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcstrset.fncs +124 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcvalue.fncs +61 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fcweight.fncs +69 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fontconfig-devel.sgml +613 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/fontconfig-user.sgml +812 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/func.sgml +91 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/doc/version.sgml.in +24 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cache/Makefile.am +69 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cache/fc-cache.c +423 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cache/fc-cache.sgml +249 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/CaseFolding.txt +1495 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/Makefile.am +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/fc-case.c +363 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-case/fccase.tmpl.h +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cat/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cat/fc-cat.c +400 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-cat/fc-cat.sgml +169 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-conflist/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-conflist/fc-conflist.c +142 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-conflist/fc-conflist.sgml +135 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/Makefile.am +288 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/README +28 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/aa.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ab.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/af.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ak.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/am.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/an.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ar.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/as.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ast.orth +47 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/av.orth +97 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ay.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/az_az.orth +53 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/az_ir.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ba.orth +56 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/be.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ber_dz.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ber_ma.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bg.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bh.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bho.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bi.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bin.orth +55 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bm.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bn.orth +44 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bo.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/br.orth +47 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/brx.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bs.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/bua.orth +102 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/byn.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ca.orth +58 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ce.orth +97 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ch.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/chm.orth +109 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/chr.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/co.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/crh.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cs.orth +67 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/csb.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cu.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cv.orth +109 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/cy.orth +63 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/da.orth +89 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/de.orth +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/doi.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/dv.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/dz.orth +28 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ee.orth +77 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/el.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/en.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/eo.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/es.orth +50 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/et.orth +47 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/eu.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fa.orth +73 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fat.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fc-lang.c +595 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fc-lang.man +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fclang.tmpl.h +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ff.orth +38 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fi.orth +51 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fil.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fj.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fo.orth +59 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fr.orth +58 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fur.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/fy.orth +61 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ga.orth +84 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gd.orth +51 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gez.orth +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gl.orth +50 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gn.orth +48 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gu.orth +41 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/gv.orth +31 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ha.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/haw.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/he.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hi.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hne.orth +28 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ho.orth +33 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hr.orth +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hsb.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ht.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hu.orth +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hy.orth +26 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/hz.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ia.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/id.orth +31 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ie.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ig.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ii.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ik.orth +100 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/io.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/is.orth +64 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iso-3166.txt +242 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iso639-1 +139 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iso639-2 +473 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/it.orth +51 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/iu.orth +77 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ja.orth +2345 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/jv.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ka.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kaa.orth +110 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kab.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ki.orth +33 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kj.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kk.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kl.orth +63 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/km.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kn.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ko.orth +2537 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kok.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kr.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ks.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_am.orth +91 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_iq.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_ir.orth +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ku_tr.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kum.orth +96 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kv.orth +101 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kw.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/kwm.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ky.orth +102 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/la.orth +31 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lah.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lb.orth +62 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lez.orth +97 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lg.orth +33 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/li.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ln.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lo.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lt.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/lv.orth +44 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mai.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mg.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mh.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mi.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mk.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ml.orth +38 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mn_cn.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mn_mn.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mni.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mo.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mr.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ms.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/mt.orth +67 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/my.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/na.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nb.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nds.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ne.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ng.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nl.orth +63 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nn.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/no.orth +68 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nqo.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nr.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nso.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/nv.orth +48 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ny.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/oc.orth +53 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/om.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/or.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/os.orth +96 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ota.orth +41 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pa.orth +53 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pa_pk.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pap_an.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pap_aw.orth +31 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pes.orth +26 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pl.orth +41 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/prs.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ps_af.orth +52 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ps_pk.orth +52 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/pt.orth +64 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/qu.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/quz.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/rm.orth +45 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/rn.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ro.orth +38 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ru.orth +38 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/rw.orth +31 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sa.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sah.orth +108 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sat.orth +44 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sc.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sco.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sd.orth +58 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/se.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sel.orth +96 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sg.orth +47 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sh.orth +33 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/shs.orth +48 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/si.orth +75 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sid.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sk.orth +63 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sl.orth +88 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sm.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sma.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/smj.orth +37 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/smn.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sms.orth +48 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sn.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/so.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sq.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sr.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ss.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/st.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/su.orth +33 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sv.orth +100 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/sw.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/syr.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ta.orth +46 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/te.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tg.orth +108 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/th.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ti_er.orth +56 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ti_et.orth +33 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tig.orth +52 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tk.orth +44 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tl.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tn.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/to.orth +30 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tr.orth +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ts.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tt.orth +108 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tw.orth +50 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ty.orth +41 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/tyv.orth +102 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ug.orth +50 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/uk.orth +43 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/und_zmth.orth +144 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/und_zsye.orth +151 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ur.orth +68 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/uz.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/ve.orth +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/vi.orth +58 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/vo.orth +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/vot.orth +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wa.orth +47 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wal.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wen.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/wo.orth +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/xh.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/yap.orth +35 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/yi.orth +25 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/yo.orth +86 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/za.orth +39 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_cn.orth +6792 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_hk.orth +1119 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_mo.orth +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_sg.orth +27 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zh_tw.orth +13105 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-lang/zu.orth +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-list/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-list/fc-list.c +220 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-list/fc-list.sgml +227 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-match/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-match/fc-match.c +268 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-match/fc-match.sgml +217 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-pattern/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-pattern/fc-pattern.c +203 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-pattern/fc-pattern.sgml +204 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-query/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-query/fc-query.c +194 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-query/fc-query.sgml +204 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-scan/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-scan/fc-scan.c +197 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-scan/fc-scan.sgml +177 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-validate/Makefile.am +60 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-validate/fc-validate.c +250 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fc-validate/fc-validate.sgml +182 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig-zip.in +29 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig.pc.in +18 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig.spec.in +138 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/Makefile.am +10 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/fcfreetype.h +59 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/fcprivate.h +134 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fontconfig/fontconfig.h +1107 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fonts.conf.in +94 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/fonts.dtd +233 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/git.mk +254 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/its/Makefile.am +11 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/its/fontconfig.its +4 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/its/fontconfig.loc +6 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/local.conf +42 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/m4/.gitkeep +0 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ac_check_symbol.m4 +48 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ax_cc_for_build.m4 +77 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ax_create_stdint_h.m4 +695 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/m4/ax_pthread.m4 +337 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/m4/pkg.m4 +214 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/new-version.sh +139 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/ChangeLog +12 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/LINGUAS +2 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/Makevars +80 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/POTFILES.in +34 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po-conf/zh_CN.po +140 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po/ChangeLog +12 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po/LINGUAS +2 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po/Makevars +78 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po/POTFILES.in +11 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/po/zh_CN.po +608 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/Makefile.am +222 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcarch.c +59 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcarch.h +76 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcatomic.c +229 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcatomic.h +145 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccache.c +1880 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccfg.c +2668 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccharset.c +1400 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fccompat.c +280 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdbg.c +587 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdefault.c +343 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdeprecate.h +36 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcdir.c +435 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcformat.c +1220 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcfreetype.c +2626 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcfs.c +149 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcftint.h +54 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fchash.c +216 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcinit.c +258 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcint.h +1344 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fclang.c +1110 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fclist.c +645 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcmatch.c +1240 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcmatrix.c +116 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcmutex.h +127 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcname.c +634 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcobjs.c +168 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcobjs.h +75 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcobjshash.gperf.h +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcpat.c +1420 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcptrlist.c +198 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcrange.c +160 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcserialize.c +155 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcstat.c +442 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcstr.c +1371 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcweight.c +103 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcwindows.h +49 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/fcxml.c +3508 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/ftglue.c +261 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/ftglue.h +111 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/src/makealias +38 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/4x6.pcf +0 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/8x16.pcf +0 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/Makefile.am +64 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/fonts.conf.in +4 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/out.expected-long-family-names +8 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/out.expected-no-long-family-names +8 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/run-test.sh +205 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-bz131804.c +135 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-bz89617.c +40 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-bz96676.c +32 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-migration.c +230 -0
- data/vendor/anongit.freedesktop.org/git/fontconfig/test/test-pthread.c +101 -0
- metadata +518 -0
@@ -0,0 +1,2668 @@
|
|
1
|
+
/*
|
2
|
+
* fontconfig/src/fccfg.c
|
3
|
+
*
|
4
|
+
* Copyright © 2000 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
|
+
/* Objects MT-safe for readonly access. */
|
26
|
+
|
27
|
+
#include "fcint.h"
|
28
|
+
#include <dirent.h>
|
29
|
+
#include <locale.h>
|
30
|
+
#include <sys/types.h>
|
31
|
+
|
32
|
+
#if defined (_WIN32) && !defined (R_OK)
|
33
|
+
#define R_OK 4
|
34
|
+
#endif
|
35
|
+
|
36
|
+
static FcConfig *_fcConfig; /* MT-safe */
|
37
|
+
|
38
|
+
static FcConfig *
|
39
|
+
FcConfigEnsure (void)
|
40
|
+
{
|
41
|
+
FcConfig *config;
|
42
|
+
FcBool is_locale_initialized;
|
43
|
+
static void *static_is_locale_initialized;
|
44
|
+
retry_locale:
|
45
|
+
is_locale_initialized = (intptr_t) fc_atomic_ptr_get (&static_is_locale_initialized);
|
46
|
+
if (!is_locale_initialized)
|
47
|
+
{
|
48
|
+
is_locale_initialized = FcTrue;
|
49
|
+
if (!fc_atomic_ptr_cmpexch (&static_is_locale_initialized, NULL,
|
50
|
+
(void *)(intptr_t) is_locale_initialized))
|
51
|
+
goto retry_locale;
|
52
|
+
setlocale (LC_ALL, "");
|
53
|
+
}
|
54
|
+
retry_config:
|
55
|
+
config = fc_atomic_ptr_get (&_fcConfig);
|
56
|
+
if (!config)
|
57
|
+
{
|
58
|
+
config = FcInitLoadConfigAndFonts ();
|
59
|
+
|
60
|
+
if (!fc_atomic_ptr_cmpexch (&_fcConfig, NULL, config)) {
|
61
|
+
FcConfigDestroy (config);
|
62
|
+
goto retry_config;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return config;
|
66
|
+
}
|
67
|
+
|
68
|
+
FcBool
|
69
|
+
FcConfigInit (void)
|
70
|
+
{
|
71
|
+
return FcConfigEnsure () ? FcTrue : FcFalse;
|
72
|
+
}
|
73
|
+
|
74
|
+
void
|
75
|
+
FcConfigFini (void)
|
76
|
+
{
|
77
|
+
FcConfig *cfg = fc_atomic_ptr_get (&_fcConfig);
|
78
|
+
if (cfg && fc_atomic_ptr_cmpexch (&_fcConfig, cfg, NULL))
|
79
|
+
FcConfigDestroy (cfg);
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
FcConfig *
|
84
|
+
FcConfigCreate (void)
|
85
|
+
{
|
86
|
+
FcSetName set;
|
87
|
+
FcConfig *config;
|
88
|
+
FcMatchKind k;
|
89
|
+
FcBool err = FcFalse;
|
90
|
+
|
91
|
+
config = malloc (sizeof (FcConfig));
|
92
|
+
if (!config)
|
93
|
+
goto bail0;
|
94
|
+
|
95
|
+
config->configDirs = FcStrSetCreate ();
|
96
|
+
if (!config->configDirs)
|
97
|
+
goto bail1;
|
98
|
+
|
99
|
+
config->configFiles = FcStrSetCreate ();
|
100
|
+
if (!config->configFiles)
|
101
|
+
goto bail2;
|
102
|
+
|
103
|
+
config->fontDirs = FcStrSetCreate ();
|
104
|
+
if (!config->fontDirs)
|
105
|
+
goto bail3;
|
106
|
+
|
107
|
+
config->acceptGlobs = FcStrSetCreate ();
|
108
|
+
if (!config->acceptGlobs)
|
109
|
+
goto bail4;
|
110
|
+
|
111
|
+
config->rejectGlobs = FcStrSetCreate ();
|
112
|
+
if (!config->rejectGlobs)
|
113
|
+
goto bail5;
|
114
|
+
|
115
|
+
config->acceptPatterns = FcFontSetCreate ();
|
116
|
+
if (!config->acceptPatterns)
|
117
|
+
goto bail6;
|
118
|
+
|
119
|
+
config->rejectPatterns = FcFontSetCreate ();
|
120
|
+
if (!config->rejectPatterns)
|
121
|
+
goto bail7;
|
122
|
+
|
123
|
+
config->cacheDirs = FcStrSetCreate ();
|
124
|
+
if (!config->cacheDirs)
|
125
|
+
goto bail8;
|
126
|
+
|
127
|
+
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
|
128
|
+
{
|
129
|
+
config->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
|
130
|
+
if (!config->subst[k])
|
131
|
+
err = FcTrue;
|
132
|
+
}
|
133
|
+
if (err)
|
134
|
+
goto bail9;
|
135
|
+
|
136
|
+
config->maxObjects = 0;
|
137
|
+
for (set = FcSetSystem; set <= FcSetApplication; set++)
|
138
|
+
config->fonts[set] = 0;
|
139
|
+
|
140
|
+
config->rescanTime = time(0);
|
141
|
+
config->rescanInterval = 30;
|
142
|
+
|
143
|
+
config->expr_pool = NULL;
|
144
|
+
|
145
|
+
config->sysRoot = NULL;
|
146
|
+
|
147
|
+
config->rulesetList = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
|
148
|
+
if (!config->rulesetList)
|
149
|
+
goto bail9;
|
150
|
+
config->availConfigFiles = FcStrSetCreate ();
|
151
|
+
if (!config->availConfigFiles)
|
152
|
+
goto bail10;
|
153
|
+
|
154
|
+
config->uuid_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
|
155
|
+
(FcCompareFunc) FcStrCmp,
|
156
|
+
FcHashStrCopy,
|
157
|
+
FcHashUuidCopy,
|
158
|
+
(FcDestroyFunc) FcStrFree,
|
159
|
+
FcHashUuidFree);
|
160
|
+
config->alias_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
|
161
|
+
(FcCompareFunc) FcStrCmp,
|
162
|
+
FcHashStrCopy,
|
163
|
+
FcHashStrCopy,
|
164
|
+
(FcDestroyFunc) FcStrFree,
|
165
|
+
(FcDestroyFunc) FcStrFree);
|
166
|
+
|
167
|
+
FcRefInit (&config->ref, 1);
|
168
|
+
|
169
|
+
return config;
|
170
|
+
|
171
|
+
bail10:
|
172
|
+
FcPtrListDestroy (config->rulesetList);
|
173
|
+
bail9:
|
174
|
+
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
|
175
|
+
if (config->subst[k])
|
176
|
+
FcPtrListDestroy (config->subst[k]);
|
177
|
+
FcStrSetDestroy (config->cacheDirs);
|
178
|
+
bail8:
|
179
|
+
FcFontSetDestroy (config->rejectPatterns);
|
180
|
+
bail7:
|
181
|
+
FcFontSetDestroy (config->acceptPatterns);
|
182
|
+
bail6:
|
183
|
+
FcStrSetDestroy (config->rejectGlobs);
|
184
|
+
bail5:
|
185
|
+
FcStrSetDestroy (config->acceptGlobs);
|
186
|
+
bail4:
|
187
|
+
FcStrSetDestroy (config->fontDirs);
|
188
|
+
bail3:
|
189
|
+
FcStrSetDestroy (config->configFiles);
|
190
|
+
bail2:
|
191
|
+
FcStrSetDestroy (config->configDirs);
|
192
|
+
bail1:
|
193
|
+
free (config);
|
194
|
+
bail0:
|
195
|
+
return 0;
|
196
|
+
}
|
197
|
+
|
198
|
+
static FcFileTime
|
199
|
+
FcConfigNewestFile (FcStrSet *files)
|
200
|
+
{
|
201
|
+
FcStrList *list = FcStrListCreate (files);
|
202
|
+
FcFileTime newest = { 0, FcFalse };
|
203
|
+
FcChar8 *file;
|
204
|
+
struct stat statb;
|
205
|
+
|
206
|
+
if (list)
|
207
|
+
{
|
208
|
+
while ((file = FcStrListNext (list)))
|
209
|
+
if (FcStat (file, &statb) == 0)
|
210
|
+
if (!newest.set || statb.st_mtime - newest.time > 0)
|
211
|
+
{
|
212
|
+
newest.set = FcTrue;
|
213
|
+
newest.time = statb.st_mtime;
|
214
|
+
}
|
215
|
+
FcStrListDone (list);
|
216
|
+
}
|
217
|
+
return newest;
|
218
|
+
}
|
219
|
+
|
220
|
+
FcBool
|
221
|
+
FcConfigUptoDate (FcConfig *config)
|
222
|
+
{
|
223
|
+
FcFileTime config_time, config_dir_time, font_time;
|
224
|
+
time_t now = time(0);
|
225
|
+
if (!config)
|
226
|
+
{
|
227
|
+
config = FcConfigGetCurrent ();
|
228
|
+
if (!config)
|
229
|
+
return FcFalse;
|
230
|
+
}
|
231
|
+
config_time = FcConfigNewestFile (config->configFiles);
|
232
|
+
config_dir_time = FcConfigNewestFile (config->configDirs);
|
233
|
+
font_time = FcConfigNewestFile (config->fontDirs);
|
234
|
+
if ((config_time.set && config_time.time - config->rescanTime > 0) ||
|
235
|
+
(config_dir_time.set && (config_dir_time.time - config->rescanTime) > 0) ||
|
236
|
+
(font_time.set && (font_time.time - config->rescanTime) > 0))
|
237
|
+
{
|
238
|
+
/* We need to check for potential clock problems here (OLPC ticket #6046) */
|
239
|
+
if ((config_time.set && (config_time.time - now) > 0) ||
|
240
|
+
(config_dir_time.set && (config_dir_time.time - now) > 0) ||
|
241
|
+
(font_time.set && (font_time.time - now) > 0))
|
242
|
+
{
|
243
|
+
fprintf (stderr,
|
244
|
+
"Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected.\n");
|
245
|
+
config->rescanTime = now;
|
246
|
+
return FcTrue;
|
247
|
+
}
|
248
|
+
else
|
249
|
+
return FcFalse;
|
250
|
+
}
|
251
|
+
config->rescanTime = now;
|
252
|
+
return FcTrue;
|
253
|
+
}
|
254
|
+
|
255
|
+
FcExpr *
|
256
|
+
FcConfigAllocExpr (FcConfig *config)
|
257
|
+
{
|
258
|
+
if (!config->expr_pool || config->expr_pool->next == config->expr_pool->end)
|
259
|
+
{
|
260
|
+
FcExprPage *new_page;
|
261
|
+
|
262
|
+
new_page = malloc (sizeof (FcExprPage));
|
263
|
+
if (!new_page)
|
264
|
+
return 0;
|
265
|
+
|
266
|
+
new_page->next_page = config->expr_pool;
|
267
|
+
new_page->next = new_page->exprs;
|
268
|
+
config->expr_pool = new_page;
|
269
|
+
}
|
270
|
+
|
271
|
+
return config->expr_pool->next++;
|
272
|
+
}
|
273
|
+
|
274
|
+
FcConfig *
|
275
|
+
FcConfigReference (FcConfig *config)
|
276
|
+
{
|
277
|
+
if (!config)
|
278
|
+
{
|
279
|
+
config = FcConfigGetCurrent ();
|
280
|
+
if (!config)
|
281
|
+
return 0;
|
282
|
+
}
|
283
|
+
|
284
|
+
FcRefInc (&config->ref);
|
285
|
+
|
286
|
+
return config;
|
287
|
+
}
|
288
|
+
|
289
|
+
void
|
290
|
+
FcConfigDestroy (FcConfig *config)
|
291
|
+
{
|
292
|
+
FcSetName set;
|
293
|
+
FcExprPage *page;
|
294
|
+
FcMatchKind k;
|
295
|
+
|
296
|
+
if (FcRefDec (&config->ref) != 1)
|
297
|
+
return;
|
298
|
+
|
299
|
+
(void) fc_atomic_ptr_cmpexch (&_fcConfig, config, NULL);
|
300
|
+
|
301
|
+
FcStrSetDestroy (config->configDirs);
|
302
|
+
FcStrSetDestroy (config->fontDirs);
|
303
|
+
FcStrSetDestroy (config->cacheDirs);
|
304
|
+
FcStrSetDestroy (config->configFiles);
|
305
|
+
FcStrSetDestroy (config->acceptGlobs);
|
306
|
+
FcStrSetDestroy (config->rejectGlobs);
|
307
|
+
FcFontSetDestroy (config->acceptPatterns);
|
308
|
+
FcFontSetDestroy (config->rejectPatterns);
|
309
|
+
|
310
|
+
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
|
311
|
+
FcPtrListDestroy (config->subst[k]);
|
312
|
+
FcPtrListDestroy (config->rulesetList);
|
313
|
+
FcStrSetDestroy (config->availConfigFiles);
|
314
|
+
for (set = FcSetSystem; set <= FcSetApplication; set++)
|
315
|
+
if (config->fonts[set])
|
316
|
+
FcFontSetDestroy (config->fonts[set]);
|
317
|
+
|
318
|
+
page = config->expr_pool;
|
319
|
+
while (page)
|
320
|
+
{
|
321
|
+
FcExprPage *next = page->next_page;
|
322
|
+
free (page);
|
323
|
+
page = next;
|
324
|
+
}
|
325
|
+
if (config->sysRoot)
|
326
|
+
FcStrFree (config->sysRoot);
|
327
|
+
|
328
|
+
FcHashTableDestroy (config->uuid_table);
|
329
|
+
FcHashTableDestroy (config->alias_table);
|
330
|
+
|
331
|
+
free (config);
|
332
|
+
}
|
333
|
+
|
334
|
+
/*
|
335
|
+
* Add cache to configuration, adding fonts and directories
|
336
|
+
*/
|
337
|
+
|
338
|
+
FcBool
|
339
|
+
FcConfigAddCache (FcConfig *config, FcCache *cache,
|
340
|
+
FcSetName set, FcStrSet *dirSet)
|
341
|
+
{
|
342
|
+
FcFontSet *fs;
|
343
|
+
intptr_t *dirs;
|
344
|
+
int i;
|
345
|
+
|
346
|
+
/*
|
347
|
+
* Add fonts
|
348
|
+
*/
|
349
|
+
fs = FcCacheSet (cache);
|
350
|
+
if (fs)
|
351
|
+
{
|
352
|
+
int nref = 0;
|
353
|
+
|
354
|
+
for (i = 0; i < fs->nfont; i++)
|
355
|
+
{
|
356
|
+
FcPattern *font = FcFontSetFont (fs, i);
|
357
|
+
FcChar8 *font_file;
|
358
|
+
|
359
|
+
/*
|
360
|
+
* Check to see if font is banned by filename
|
361
|
+
*/
|
362
|
+
if (FcPatternObjectGetString (font, FC_FILE_OBJECT,
|
363
|
+
0, &font_file) == FcResultMatch &&
|
364
|
+
!FcConfigAcceptFilename (config, font_file))
|
365
|
+
{
|
366
|
+
continue;
|
367
|
+
}
|
368
|
+
|
369
|
+
/*
|
370
|
+
* Check to see if font is banned by pattern
|
371
|
+
*/
|
372
|
+
if (!FcConfigAcceptFont (config, font))
|
373
|
+
continue;
|
374
|
+
|
375
|
+
if (FcFontSetAdd (config->fonts[set], font))
|
376
|
+
nref++;
|
377
|
+
}
|
378
|
+
FcDirCacheReference (cache, nref);
|
379
|
+
}
|
380
|
+
|
381
|
+
/*
|
382
|
+
* Add directories
|
383
|
+
*/
|
384
|
+
dirs = FcCacheDirs (cache);
|
385
|
+
if (dirs)
|
386
|
+
{
|
387
|
+
for (i = 0; i < cache->dirs_count; i++)
|
388
|
+
{
|
389
|
+
const FcChar8 *dir = FcCacheSubdir (cache, i);
|
390
|
+
FcChar8 *alias;
|
391
|
+
FcChar8 *d = FcStrDirname (dir);
|
392
|
+
FcChar8 *s = NULL;
|
393
|
+
|
394
|
+
if (FcHashTableFind (config->alias_table, d, (void **)&alias))
|
395
|
+
{
|
396
|
+
FcChar8 *base = FcStrBasename (dir);
|
397
|
+
dir = s = FcStrBuildFilename (alias, base, NULL);
|
398
|
+
FcStrFree (alias);
|
399
|
+
FcStrFree (base);
|
400
|
+
}
|
401
|
+
FcStrFree (d);
|
402
|
+
if (FcConfigAcceptFilename (config, dir))
|
403
|
+
FcStrSetAddFilename (dirSet, dir);
|
404
|
+
if (s)
|
405
|
+
FcStrFree (s);
|
406
|
+
}
|
407
|
+
}
|
408
|
+
return FcTrue;
|
409
|
+
}
|
410
|
+
|
411
|
+
static FcBool
|
412
|
+
FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet)
|
413
|
+
{
|
414
|
+
FcStrList *dirlist;
|
415
|
+
FcChar8 *dir;
|
416
|
+
FcCache *cache;
|
417
|
+
|
418
|
+
dirlist = FcStrListCreate (dirSet);
|
419
|
+
if (!dirlist)
|
420
|
+
return FcFalse;
|
421
|
+
|
422
|
+
while ((dir = FcStrListNext (dirlist)))
|
423
|
+
{
|
424
|
+
if (FcDebug () & FC_DBG_FONTSET)
|
425
|
+
printf ("adding fonts from %s\n", dir);
|
426
|
+
cache = FcDirCacheRead (dir, FcFalse, config);
|
427
|
+
if (!cache)
|
428
|
+
continue;
|
429
|
+
FcConfigAddCache (config, cache, set, dirSet);
|
430
|
+
FcDirCacheUnload (cache);
|
431
|
+
}
|
432
|
+
FcStrListDone (dirlist);
|
433
|
+
return FcTrue;
|
434
|
+
}
|
435
|
+
|
436
|
+
/*
|
437
|
+
* Scan the current list of directories in the configuration
|
438
|
+
* and build the set of available fonts.
|
439
|
+
*/
|
440
|
+
|
441
|
+
FcBool
|
442
|
+
FcConfigBuildFonts (FcConfig *config)
|
443
|
+
{
|
444
|
+
FcFontSet *fonts;
|
445
|
+
|
446
|
+
if (!config)
|
447
|
+
{
|
448
|
+
config = FcConfigGetCurrent ();
|
449
|
+
if (!config)
|
450
|
+
return FcFalse;
|
451
|
+
}
|
452
|
+
|
453
|
+
fonts = FcFontSetCreate ();
|
454
|
+
if (!fonts)
|
455
|
+
return FcFalse;
|
456
|
+
|
457
|
+
FcConfigSetFonts (config, fonts, FcSetSystem);
|
458
|
+
|
459
|
+
if (!FcConfigAddDirList (config, FcSetSystem, config->fontDirs))
|
460
|
+
return FcFalse;
|
461
|
+
if (FcDebug () & FC_DBG_FONTSET)
|
462
|
+
FcFontSetPrint (fonts);
|
463
|
+
return FcTrue;
|
464
|
+
}
|
465
|
+
|
466
|
+
FcBool
|
467
|
+
FcConfigSetCurrent (FcConfig *config)
|
468
|
+
{
|
469
|
+
FcConfig *cfg;
|
470
|
+
|
471
|
+
retry:
|
472
|
+
cfg = fc_atomic_ptr_get (&_fcConfig);
|
473
|
+
|
474
|
+
if (config == cfg)
|
475
|
+
return FcTrue;
|
476
|
+
|
477
|
+
if (config && !config->fonts[FcSetSystem])
|
478
|
+
if (!FcConfigBuildFonts (config))
|
479
|
+
return FcFalse;
|
480
|
+
|
481
|
+
if (!fc_atomic_ptr_cmpexch (&_fcConfig, cfg, config))
|
482
|
+
goto retry;
|
483
|
+
|
484
|
+
FcConfigReference (config);
|
485
|
+
if (cfg)
|
486
|
+
FcConfigDestroy (cfg);
|
487
|
+
|
488
|
+
return FcTrue;
|
489
|
+
}
|
490
|
+
|
491
|
+
FcConfig *
|
492
|
+
FcConfigGetCurrent (void)
|
493
|
+
{
|
494
|
+
return FcConfigEnsure ();
|
495
|
+
}
|
496
|
+
|
497
|
+
FcBool
|
498
|
+
FcConfigAddConfigDir (FcConfig *config,
|
499
|
+
const FcChar8 *d)
|
500
|
+
{
|
501
|
+
return FcStrSetAddFilename (config->configDirs, d);
|
502
|
+
}
|
503
|
+
|
504
|
+
FcStrList *
|
505
|
+
FcConfigGetConfigDirs (FcConfig *config)
|
506
|
+
{
|
507
|
+
if (!config)
|
508
|
+
{
|
509
|
+
config = FcConfigGetCurrent ();
|
510
|
+
if (!config)
|
511
|
+
return 0;
|
512
|
+
}
|
513
|
+
return FcStrListCreate (config->configDirs);
|
514
|
+
}
|
515
|
+
|
516
|
+
FcBool
|
517
|
+
FcConfigAddFontDir (FcConfig *config,
|
518
|
+
const FcChar8 *d)
|
519
|
+
{
|
520
|
+
return FcStrSetAddFilename (config->fontDirs, d);
|
521
|
+
}
|
522
|
+
|
523
|
+
FcStrList *
|
524
|
+
FcConfigGetFontDirs (FcConfig *config)
|
525
|
+
{
|
526
|
+
if (!config)
|
527
|
+
{
|
528
|
+
config = FcConfigGetCurrent ();
|
529
|
+
if (!config)
|
530
|
+
return 0;
|
531
|
+
}
|
532
|
+
return FcStrListCreate (config->fontDirs);
|
533
|
+
}
|
534
|
+
|
535
|
+
FcBool
|
536
|
+
FcConfigAddCacheDir (FcConfig *config,
|
537
|
+
const FcChar8 *d)
|
538
|
+
{
|
539
|
+
return FcStrSetAddFilename (config->cacheDirs, d);
|
540
|
+
}
|
541
|
+
|
542
|
+
FcStrList *
|
543
|
+
FcConfigGetCacheDirs (const FcConfig *config)
|
544
|
+
{
|
545
|
+
if (!config)
|
546
|
+
{
|
547
|
+
config = FcConfigGetCurrent ();
|
548
|
+
if (!config)
|
549
|
+
return 0;
|
550
|
+
}
|
551
|
+
return FcStrListCreate (config->cacheDirs);
|
552
|
+
}
|
553
|
+
|
554
|
+
FcBool
|
555
|
+
FcConfigAddConfigFile (FcConfig *config,
|
556
|
+
const FcChar8 *f)
|
557
|
+
{
|
558
|
+
FcBool ret;
|
559
|
+
FcChar8 *file = FcConfigFilename (f);
|
560
|
+
|
561
|
+
if (!file)
|
562
|
+
return FcFalse;
|
563
|
+
|
564
|
+
ret = FcStrSetAdd (config->configFiles, file);
|
565
|
+
FcStrFree (file);
|
566
|
+
return ret;
|
567
|
+
}
|
568
|
+
|
569
|
+
FcStrList *
|
570
|
+
FcConfigGetConfigFiles (FcConfig *config)
|
571
|
+
{
|
572
|
+
if (!config)
|
573
|
+
{
|
574
|
+
config = FcConfigGetCurrent ();
|
575
|
+
if (!config)
|
576
|
+
return 0;
|
577
|
+
}
|
578
|
+
return FcStrListCreate (config->configFiles);
|
579
|
+
}
|
580
|
+
|
581
|
+
FcChar8 *
|
582
|
+
FcConfigGetCache (FcConfig *config FC_UNUSED)
|
583
|
+
{
|
584
|
+
return NULL;
|
585
|
+
}
|
586
|
+
|
587
|
+
FcFontSet *
|
588
|
+
FcConfigGetFonts (FcConfig *config,
|
589
|
+
FcSetName set)
|
590
|
+
{
|
591
|
+
if (!config)
|
592
|
+
{
|
593
|
+
config = FcConfigGetCurrent ();
|
594
|
+
if (!config)
|
595
|
+
return 0;
|
596
|
+
}
|
597
|
+
return config->fonts[set];
|
598
|
+
}
|
599
|
+
|
600
|
+
void
|
601
|
+
FcConfigSetFonts (FcConfig *config,
|
602
|
+
FcFontSet *fonts,
|
603
|
+
FcSetName set)
|
604
|
+
{
|
605
|
+
if (config->fonts[set])
|
606
|
+
FcFontSetDestroy (config->fonts[set]);
|
607
|
+
config->fonts[set] = fonts;
|
608
|
+
}
|
609
|
+
|
610
|
+
|
611
|
+
FcBlanks *
|
612
|
+
FcBlanksCreate (void)
|
613
|
+
{
|
614
|
+
/* Deprecated. */
|
615
|
+
return NULL;
|
616
|
+
}
|
617
|
+
|
618
|
+
void
|
619
|
+
FcBlanksDestroy (FcBlanks *b FC_UNUSED)
|
620
|
+
{
|
621
|
+
/* Deprecated. */
|
622
|
+
}
|
623
|
+
|
624
|
+
FcBool
|
625
|
+
FcBlanksAdd (FcBlanks *b FC_UNUSED, FcChar32 ucs4 FC_UNUSED)
|
626
|
+
{
|
627
|
+
/* Deprecated. */
|
628
|
+
return FcFalse;
|
629
|
+
}
|
630
|
+
|
631
|
+
FcBool
|
632
|
+
FcBlanksIsMember (FcBlanks *b FC_UNUSED, FcChar32 ucs4 FC_UNUSED)
|
633
|
+
{
|
634
|
+
/* Deprecated. */
|
635
|
+
return FcFalse;
|
636
|
+
}
|
637
|
+
|
638
|
+
FcBlanks *
|
639
|
+
FcConfigGetBlanks (FcConfig *config FC_UNUSED)
|
640
|
+
{
|
641
|
+
/* Deprecated. */
|
642
|
+
return NULL;
|
643
|
+
}
|
644
|
+
|
645
|
+
FcBool
|
646
|
+
FcConfigAddBlank (FcConfig *config FC_UNUSED,
|
647
|
+
FcChar32 blank FC_UNUSED)
|
648
|
+
{
|
649
|
+
/* Deprecated. */
|
650
|
+
return FcFalse;
|
651
|
+
}
|
652
|
+
|
653
|
+
|
654
|
+
int
|
655
|
+
FcConfigGetRescanInterval (FcConfig *config)
|
656
|
+
{
|
657
|
+
if (!config)
|
658
|
+
{
|
659
|
+
config = FcConfigGetCurrent ();
|
660
|
+
if (!config)
|
661
|
+
return 0;
|
662
|
+
}
|
663
|
+
return config->rescanInterval;
|
664
|
+
}
|
665
|
+
|
666
|
+
FcBool
|
667
|
+
FcConfigSetRescanInterval (FcConfig *config, int rescanInterval)
|
668
|
+
{
|
669
|
+
if (!config)
|
670
|
+
{
|
671
|
+
config = FcConfigGetCurrent ();
|
672
|
+
if (!config)
|
673
|
+
return FcFalse;
|
674
|
+
}
|
675
|
+
config->rescanInterval = rescanInterval;
|
676
|
+
return FcTrue;
|
677
|
+
}
|
678
|
+
|
679
|
+
/*
|
680
|
+
* A couple of typos escaped into the library
|
681
|
+
*/
|
682
|
+
int
|
683
|
+
FcConfigGetRescanInverval (FcConfig *config)
|
684
|
+
{
|
685
|
+
return FcConfigGetRescanInterval (config);
|
686
|
+
}
|
687
|
+
|
688
|
+
FcBool
|
689
|
+
FcConfigSetRescanInverval (FcConfig *config, int rescanInterval)
|
690
|
+
{
|
691
|
+
return FcConfigSetRescanInterval (config, rescanInterval);
|
692
|
+
}
|
693
|
+
|
694
|
+
FcBool
|
695
|
+
FcConfigAddRule (FcConfig *config,
|
696
|
+
FcRule *rule,
|
697
|
+
FcMatchKind kind)
|
698
|
+
{
|
699
|
+
/* deprecated */
|
700
|
+
return FcFalse;
|
701
|
+
}
|
702
|
+
|
703
|
+
static FcValue
|
704
|
+
FcConfigPromote (FcValue v, FcValue u, FcValuePromotionBuffer *buf)
|
705
|
+
{
|
706
|
+
if (v.type == FcTypeInteger)
|
707
|
+
{
|
708
|
+
v.type = FcTypeDouble;
|
709
|
+
v.u.d = (double) v.u.i;
|
710
|
+
}
|
711
|
+
else if (v.type == FcTypeVoid && u.type == FcTypeMatrix)
|
712
|
+
{
|
713
|
+
v.u.m = &FcIdentityMatrix;
|
714
|
+
v.type = FcTypeMatrix;
|
715
|
+
}
|
716
|
+
else if (buf && v.type == FcTypeString && u.type == FcTypeLangSet)
|
717
|
+
{
|
718
|
+
v.u.l = FcLangSetPromote (v.u.s, buf);
|
719
|
+
v.type = FcTypeLangSet;
|
720
|
+
}
|
721
|
+
else if (v.type == FcTypeVoid && u.type == FcTypeLangSet)
|
722
|
+
{
|
723
|
+
v.u.l = FcLangSetPromote (NULL, buf);
|
724
|
+
v.type = FcTypeLangSet;
|
725
|
+
}
|
726
|
+
else if (v.type == FcTypeVoid && u.type == FcTypeCharSet)
|
727
|
+
{
|
728
|
+
v.u.c = FcCharSetPromote (buf);
|
729
|
+
v.type = FcTypeCharSet;
|
730
|
+
}
|
731
|
+
if (buf && v.type == FcTypeDouble && u.type == FcTypeRange)
|
732
|
+
{
|
733
|
+
v.u.r = FcRangePromote (v.u.d, buf);
|
734
|
+
v.type = FcTypeRange;
|
735
|
+
}
|
736
|
+
return v;
|
737
|
+
}
|
738
|
+
|
739
|
+
FcBool
|
740
|
+
FcConfigCompareValue (const FcValue *left_o,
|
741
|
+
unsigned int op_,
|
742
|
+
const FcValue *right_o)
|
743
|
+
{
|
744
|
+
FcValue left = FcValueCanonicalize(left_o);
|
745
|
+
FcValue right = FcValueCanonicalize(right_o);
|
746
|
+
FcBool ret = FcFalse;
|
747
|
+
FcOp op = FC_OP_GET_OP (op_);
|
748
|
+
int flags = FC_OP_GET_FLAGS (op_);
|
749
|
+
FcValuePromotionBuffer buf1, buf2;
|
750
|
+
|
751
|
+
left = FcConfigPromote (left, right, &buf1);
|
752
|
+
right = FcConfigPromote (right, left, &buf2);
|
753
|
+
if (left.type == right.type)
|
754
|
+
{
|
755
|
+
switch (left.type) {
|
756
|
+
case FcTypeUnknown:
|
757
|
+
break; /* No way to guess how to compare for this object */
|
758
|
+
case FcTypeInteger:
|
759
|
+
break; /* FcConfigPromote prevents this from happening */
|
760
|
+
case FcTypeDouble:
|
761
|
+
switch ((int) op) {
|
762
|
+
case FcOpEqual:
|
763
|
+
case FcOpContains:
|
764
|
+
case FcOpListing:
|
765
|
+
ret = left.u.d == right.u.d;
|
766
|
+
break;
|
767
|
+
case FcOpNotEqual:
|
768
|
+
case FcOpNotContains:
|
769
|
+
ret = left.u.d != right.u.d;
|
770
|
+
break;
|
771
|
+
case FcOpLess:
|
772
|
+
ret = left.u.d < right.u.d;
|
773
|
+
break;
|
774
|
+
case FcOpLessEqual:
|
775
|
+
ret = left.u.d <= right.u.d;
|
776
|
+
break;
|
777
|
+
case FcOpMore:
|
778
|
+
ret = left.u.d > right.u.d;
|
779
|
+
break;
|
780
|
+
case FcOpMoreEqual:
|
781
|
+
ret = left.u.d >= right.u.d;
|
782
|
+
break;
|
783
|
+
default:
|
784
|
+
break;
|
785
|
+
}
|
786
|
+
break;
|
787
|
+
case FcTypeBool:
|
788
|
+
switch ((int) op) {
|
789
|
+
case FcOpEqual:
|
790
|
+
ret = left.u.b == right.u.b;
|
791
|
+
break;
|
792
|
+
case FcOpContains:
|
793
|
+
case FcOpListing:
|
794
|
+
ret = left.u.b == right.u.b || left.u.b == FcDontCare;
|
795
|
+
break;
|
796
|
+
case FcOpNotEqual:
|
797
|
+
ret = left.u.b != right.u.b;
|
798
|
+
break;
|
799
|
+
case FcOpNotContains:
|
800
|
+
ret = !(left.u.b == right.u.b || left.u.b == FcDontCare);
|
801
|
+
break;
|
802
|
+
case FcOpLess:
|
803
|
+
ret = left.u.b != right.u.b && right.u.b == FcDontCare;
|
804
|
+
break;
|
805
|
+
case FcOpLessEqual:
|
806
|
+
ret = left.u.b == right.u.b || right.u.b == FcDontCare;
|
807
|
+
break;
|
808
|
+
case FcOpMore:
|
809
|
+
ret = left.u.b != right.u.b && left.u.b == FcDontCare;
|
810
|
+
break;
|
811
|
+
case FcOpMoreEqual:
|
812
|
+
ret = left.u.b == right.u.b || left.u.b == FcDontCare;
|
813
|
+
break;
|
814
|
+
default:
|
815
|
+
break;
|
816
|
+
}
|
817
|
+
break;
|
818
|
+
case FcTypeString:
|
819
|
+
switch ((int) op) {
|
820
|
+
case FcOpEqual:
|
821
|
+
case FcOpListing:
|
822
|
+
if (flags & FcOpFlagIgnoreBlanks)
|
823
|
+
ret = FcStrCmpIgnoreBlanksAndCase (left.u.s, right.u.s) == 0;
|
824
|
+
else
|
825
|
+
ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) == 0;
|
826
|
+
break;
|
827
|
+
case FcOpContains:
|
828
|
+
ret = FcStrStrIgnoreCase (left.u.s, right.u.s) != 0;
|
829
|
+
break;
|
830
|
+
case FcOpNotEqual:
|
831
|
+
if (flags & FcOpFlagIgnoreBlanks)
|
832
|
+
ret = FcStrCmpIgnoreBlanksAndCase (left.u.s, right.u.s) != 0;
|
833
|
+
else
|
834
|
+
ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) != 0;
|
835
|
+
break;
|
836
|
+
case FcOpNotContains:
|
837
|
+
ret = FcStrStrIgnoreCase (left.u.s, right.u.s) == 0;
|
838
|
+
break;
|
839
|
+
default:
|
840
|
+
break;
|
841
|
+
}
|
842
|
+
break;
|
843
|
+
case FcTypeMatrix:
|
844
|
+
switch ((int) op) {
|
845
|
+
case FcOpEqual:
|
846
|
+
case FcOpContains:
|
847
|
+
case FcOpListing:
|
848
|
+
ret = FcMatrixEqual (left.u.m, right.u.m);
|
849
|
+
break;
|
850
|
+
case FcOpNotEqual:
|
851
|
+
case FcOpNotContains:
|
852
|
+
ret = !FcMatrixEqual (left.u.m, right.u.m);
|
853
|
+
break;
|
854
|
+
default:
|
855
|
+
break;
|
856
|
+
}
|
857
|
+
break;
|
858
|
+
case FcTypeCharSet:
|
859
|
+
switch ((int) op) {
|
860
|
+
case FcOpContains:
|
861
|
+
case FcOpListing:
|
862
|
+
/* left contains right if right is a subset of left */
|
863
|
+
ret = FcCharSetIsSubset (right.u.c, left.u.c);
|
864
|
+
break;
|
865
|
+
case FcOpNotContains:
|
866
|
+
/* left contains right if right is a subset of left */
|
867
|
+
ret = !FcCharSetIsSubset (right.u.c, left.u.c);
|
868
|
+
break;
|
869
|
+
case FcOpEqual:
|
870
|
+
ret = FcCharSetEqual (left.u.c, right.u.c);
|
871
|
+
break;
|
872
|
+
case FcOpNotEqual:
|
873
|
+
ret = !FcCharSetEqual (left.u.c, right.u.c);
|
874
|
+
break;
|
875
|
+
default:
|
876
|
+
break;
|
877
|
+
}
|
878
|
+
break;
|
879
|
+
case FcTypeLangSet:
|
880
|
+
switch ((int) op) {
|
881
|
+
case FcOpContains:
|
882
|
+
case FcOpListing:
|
883
|
+
ret = FcLangSetContains (left.u.l, right.u.l);
|
884
|
+
break;
|
885
|
+
case FcOpNotContains:
|
886
|
+
ret = !FcLangSetContains (left.u.l, right.u.l);
|
887
|
+
break;
|
888
|
+
case FcOpEqual:
|
889
|
+
ret = FcLangSetEqual (left.u.l, right.u.l);
|
890
|
+
break;
|
891
|
+
case FcOpNotEqual:
|
892
|
+
ret = !FcLangSetEqual (left.u.l, right.u.l);
|
893
|
+
break;
|
894
|
+
default:
|
895
|
+
break;
|
896
|
+
}
|
897
|
+
break;
|
898
|
+
case FcTypeVoid:
|
899
|
+
switch ((int) op) {
|
900
|
+
case FcOpEqual:
|
901
|
+
case FcOpContains:
|
902
|
+
case FcOpListing:
|
903
|
+
ret = FcTrue;
|
904
|
+
break;
|
905
|
+
default:
|
906
|
+
break;
|
907
|
+
}
|
908
|
+
break;
|
909
|
+
case FcTypeFTFace:
|
910
|
+
switch ((int) op) {
|
911
|
+
case FcOpEqual:
|
912
|
+
case FcOpContains:
|
913
|
+
case FcOpListing:
|
914
|
+
ret = left.u.f == right.u.f;
|
915
|
+
break;
|
916
|
+
case FcOpNotEqual:
|
917
|
+
case FcOpNotContains:
|
918
|
+
ret = left.u.f != right.u.f;
|
919
|
+
break;
|
920
|
+
default:
|
921
|
+
break;
|
922
|
+
}
|
923
|
+
break;
|
924
|
+
case FcTypeRange:
|
925
|
+
ret = FcRangeCompare (op, left.u.r, right.u.r);
|
926
|
+
break;
|
927
|
+
}
|
928
|
+
}
|
929
|
+
else
|
930
|
+
{
|
931
|
+
if (op == FcOpNotEqual || op == FcOpNotContains)
|
932
|
+
ret = FcTrue;
|
933
|
+
}
|
934
|
+
return ret;
|
935
|
+
}
|
936
|
+
|
937
|
+
|
938
|
+
#define _FcDoubleFloor(d) ((int) (d))
|
939
|
+
#define _FcDoubleCeil(d) ((double) (int) (d) == (d) ? (int) (d) : (int) ((d) + 1))
|
940
|
+
#define FcDoubleFloor(d) ((d) >= 0 ? _FcDoubleFloor(d) : -_FcDoubleCeil(-(d)))
|
941
|
+
#define FcDoubleCeil(d) ((d) >= 0 ? _FcDoubleCeil(d) : -_FcDoubleFloor(-(d)))
|
942
|
+
#define FcDoubleRound(d) FcDoubleFloor ((d) + 0.5)
|
943
|
+
#define FcDoubleTrunc(d) ((d) >= 0 ? _FcDoubleFloor (d) : -_FcDoubleFloor (-(d)))
|
944
|
+
|
945
|
+
static FcValue
|
946
|
+
FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e)
|
947
|
+
{
|
948
|
+
FcValue v, vl, vr, vle, vre;
|
949
|
+
FcMatrix *m;
|
950
|
+
FcChar8 *str;
|
951
|
+
FcOp op = FC_OP_GET_OP (e->op);
|
952
|
+
FcValuePromotionBuffer buf1, buf2;
|
953
|
+
|
954
|
+
switch ((int) op) {
|
955
|
+
case FcOpInteger:
|
956
|
+
v.type = FcTypeInteger;
|
957
|
+
v.u.i = e->u.ival;
|
958
|
+
break;
|
959
|
+
case FcOpDouble:
|
960
|
+
v.type = FcTypeDouble;
|
961
|
+
v.u.d = e->u.dval;
|
962
|
+
break;
|
963
|
+
case FcOpString:
|
964
|
+
v.type = FcTypeString;
|
965
|
+
v.u.s = e->u.sval;
|
966
|
+
v = FcValueSave (v);
|
967
|
+
break;
|
968
|
+
case FcOpMatrix:
|
969
|
+
{
|
970
|
+
FcMatrix m;
|
971
|
+
FcValue xx, xy, yx, yy;
|
972
|
+
v.type = FcTypeMatrix;
|
973
|
+
xx = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->xx), v, NULL);
|
974
|
+
xy = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->xy), v, NULL);
|
975
|
+
yx = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->yx), v, NULL);
|
976
|
+
yy = FcConfigPromote (FcConfigEvaluate (p, p_pat, kind, e->u.mexpr->yy), v, NULL);
|
977
|
+
if (xx.type == FcTypeDouble && xy.type == FcTypeDouble &&
|
978
|
+
yx.type == FcTypeDouble && yy.type == FcTypeDouble)
|
979
|
+
{
|
980
|
+
m.xx = xx.u.d;
|
981
|
+
m.xy = xy.u.d;
|
982
|
+
m.yx = yx.u.d;
|
983
|
+
m.yy = yy.u.d;
|
984
|
+
v.u.m = &m;
|
985
|
+
}
|
986
|
+
else
|
987
|
+
v.type = FcTypeVoid;
|
988
|
+
v = FcValueSave (v);
|
989
|
+
}
|
990
|
+
break;
|
991
|
+
case FcOpCharSet:
|
992
|
+
v.type = FcTypeCharSet;
|
993
|
+
v.u.c = e->u.cval;
|
994
|
+
v = FcValueSave (v);
|
995
|
+
break;
|
996
|
+
case FcOpLangSet:
|
997
|
+
v.type = FcTypeLangSet;
|
998
|
+
v.u.l = e->u.lval;
|
999
|
+
v = FcValueSave (v);
|
1000
|
+
break;
|
1001
|
+
case FcOpRange:
|
1002
|
+
v.type = FcTypeRange;
|
1003
|
+
v.u.r = e->u.rval;
|
1004
|
+
v = FcValueSave (v);
|
1005
|
+
break;
|
1006
|
+
case FcOpBool:
|
1007
|
+
v.type = FcTypeBool;
|
1008
|
+
v.u.b = e->u.bval;
|
1009
|
+
break;
|
1010
|
+
case FcOpField:
|
1011
|
+
if (kind == FcMatchFont && e->u.name.kind == FcMatchPattern)
|
1012
|
+
{
|
1013
|
+
if (FcResultMatch != FcPatternObjectGet (p_pat, e->u.name.object, 0, &v))
|
1014
|
+
v.type = FcTypeVoid;
|
1015
|
+
}
|
1016
|
+
else if (kind == FcMatchPattern && e->u.name.kind == FcMatchFont)
|
1017
|
+
{
|
1018
|
+
fprintf (stderr,
|
1019
|
+
"Fontconfig warning: <name> tag has target=\"font\" in a <match target=\"pattern\">.\n");
|
1020
|
+
v.type = FcTypeVoid;
|
1021
|
+
}
|
1022
|
+
else
|
1023
|
+
{
|
1024
|
+
if (FcResultMatch != FcPatternObjectGet (p, e->u.name.object, 0, &v))
|
1025
|
+
v.type = FcTypeVoid;
|
1026
|
+
}
|
1027
|
+
v = FcValueSave (v);
|
1028
|
+
break;
|
1029
|
+
case FcOpConst:
|
1030
|
+
if (FcNameConstant (e->u.constant, &v.u.i))
|
1031
|
+
v.type = FcTypeInteger;
|
1032
|
+
else
|
1033
|
+
v.type = FcTypeVoid;
|
1034
|
+
break;
|
1035
|
+
case FcOpQuest:
|
1036
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1037
|
+
if (vl.type == FcTypeBool)
|
1038
|
+
{
|
1039
|
+
if (vl.u.b)
|
1040
|
+
v = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right->u.tree.left);
|
1041
|
+
else
|
1042
|
+
v = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right->u.tree.right);
|
1043
|
+
}
|
1044
|
+
else
|
1045
|
+
v.type = FcTypeVoid;
|
1046
|
+
FcValueDestroy (vl);
|
1047
|
+
break;
|
1048
|
+
case FcOpEqual:
|
1049
|
+
case FcOpNotEqual:
|
1050
|
+
case FcOpLess:
|
1051
|
+
case FcOpLessEqual:
|
1052
|
+
case FcOpMore:
|
1053
|
+
case FcOpMoreEqual:
|
1054
|
+
case FcOpContains:
|
1055
|
+
case FcOpNotContains:
|
1056
|
+
case FcOpListing:
|
1057
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1058
|
+
vr = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right);
|
1059
|
+
v.type = FcTypeBool;
|
1060
|
+
v.u.b = FcConfigCompareValue (&vl, e->op, &vr);
|
1061
|
+
FcValueDestroy (vl);
|
1062
|
+
FcValueDestroy (vr);
|
1063
|
+
break;
|
1064
|
+
case FcOpOr:
|
1065
|
+
case FcOpAnd:
|
1066
|
+
case FcOpPlus:
|
1067
|
+
case FcOpMinus:
|
1068
|
+
case FcOpTimes:
|
1069
|
+
case FcOpDivide:
|
1070
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1071
|
+
vr = FcConfigEvaluate (p, p_pat, kind, e->u.tree.right);
|
1072
|
+
vle = FcConfigPromote (vl, vr, &buf1);
|
1073
|
+
vre = FcConfigPromote (vr, vle, &buf2);
|
1074
|
+
if (vle.type == vre.type)
|
1075
|
+
{
|
1076
|
+
switch ((int) vle.type) {
|
1077
|
+
case FcTypeDouble:
|
1078
|
+
switch ((int) op) {
|
1079
|
+
case FcOpPlus:
|
1080
|
+
v.type = FcTypeDouble;
|
1081
|
+
v.u.d = vle.u.d + vre.u.d;
|
1082
|
+
break;
|
1083
|
+
case FcOpMinus:
|
1084
|
+
v.type = FcTypeDouble;
|
1085
|
+
v.u.d = vle.u.d - vre.u.d;
|
1086
|
+
break;
|
1087
|
+
case FcOpTimes:
|
1088
|
+
v.type = FcTypeDouble;
|
1089
|
+
v.u.d = vle.u.d * vre.u.d;
|
1090
|
+
break;
|
1091
|
+
case FcOpDivide:
|
1092
|
+
v.type = FcTypeDouble;
|
1093
|
+
v.u.d = vle.u.d / vre.u.d;
|
1094
|
+
break;
|
1095
|
+
default:
|
1096
|
+
v.type = FcTypeVoid;
|
1097
|
+
break;
|
1098
|
+
}
|
1099
|
+
if (v.type == FcTypeDouble &&
|
1100
|
+
v.u.d == (double) (int) v.u.d)
|
1101
|
+
{
|
1102
|
+
v.type = FcTypeInteger;
|
1103
|
+
v.u.i = (int) v.u.d;
|
1104
|
+
}
|
1105
|
+
break;
|
1106
|
+
case FcTypeBool:
|
1107
|
+
switch ((int) op) {
|
1108
|
+
case FcOpOr:
|
1109
|
+
v.type = FcTypeBool;
|
1110
|
+
v.u.b = vle.u.b || vre.u.b;
|
1111
|
+
break;
|
1112
|
+
case FcOpAnd:
|
1113
|
+
v.type = FcTypeBool;
|
1114
|
+
v.u.b = vle.u.b && vre.u.b;
|
1115
|
+
break;
|
1116
|
+
default:
|
1117
|
+
v.type = FcTypeVoid;
|
1118
|
+
break;
|
1119
|
+
}
|
1120
|
+
break;
|
1121
|
+
case FcTypeString:
|
1122
|
+
switch ((int) op) {
|
1123
|
+
case FcOpPlus:
|
1124
|
+
v.type = FcTypeString;
|
1125
|
+
str = FcStrPlus (vle.u.s, vre.u.s);
|
1126
|
+
v.u.s = FcStrdup (str);
|
1127
|
+
FcStrFree (str);
|
1128
|
+
|
1129
|
+
if (!v.u.s)
|
1130
|
+
v.type = FcTypeVoid;
|
1131
|
+
break;
|
1132
|
+
default:
|
1133
|
+
v.type = FcTypeVoid;
|
1134
|
+
break;
|
1135
|
+
}
|
1136
|
+
break;
|
1137
|
+
case FcTypeMatrix:
|
1138
|
+
switch ((int) op) {
|
1139
|
+
case FcOpTimes:
|
1140
|
+
v.type = FcTypeMatrix;
|
1141
|
+
m = malloc (sizeof (FcMatrix));
|
1142
|
+
if (m)
|
1143
|
+
{
|
1144
|
+
FcMatrixMultiply (m, vle.u.m, vre.u.m);
|
1145
|
+
v.u.m = m;
|
1146
|
+
}
|
1147
|
+
else
|
1148
|
+
{
|
1149
|
+
v.type = FcTypeVoid;
|
1150
|
+
}
|
1151
|
+
break;
|
1152
|
+
default:
|
1153
|
+
v.type = FcTypeVoid;
|
1154
|
+
break;
|
1155
|
+
}
|
1156
|
+
break;
|
1157
|
+
case FcTypeCharSet:
|
1158
|
+
switch ((int) op) {
|
1159
|
+
case FcOpPlus:
|
1160
|
+
v.type = FcTypeCharSet;
|
1161
|
+
v.u.c = FcCharSetUnion (vle.u.c, vre.u.c);
|
1162
|
+
if (!v.u.c)
|
1163
|
+
v.type = FcTypeVoid;
|
1164
|
+
break;
|
1165
|
+
case FcOpMinus:
|
1166
|
+
v.type = FcTypeCharSet;
|
1167
|
+
v.u.c = FcCharSetSubtract (vle.u.c, vre.u.c);
|
1168
|
+
if (!v.u.c)
|
1169
|
+
v.type = FcTypeVoid;
|
1170
|
+
break;
|
1171
|
+
default:
|
1172
|
+
v.type = FcTypeVoid;
|
1173
|
+
break;
|
1174
|
+
}
|
1175
|
+
break;
|
1176
|
+
case FcTypeLangSet:
|
1177
|
+
switch ((int) op) {
|
1178
|
+
case FcOpPlus:
|
1179
|
+
v.type = FcTypeLangSet;
|
1180
|
+
v.u.l = FcLangSetUnion (vle.u.l, vre.u.l);
|
1181
|
+
if (!v.u.l)
|
1182
|
+
v.type = FcTypeVoid;
|
1183
|
+
break;
|
1184
|
+
case FcOpMinus:
|
1185
|
+
v.type = FcTypeLangSet;
|
1186
|
+
v.u.l = FcLangSetSubtract (vle.u.l, vre.u.l);
|
1187
|
+
if (!v.u.l)
|
1188
|
+
v.type = FcTypeVoid;
|
1189
|
+
break;
|
1190
|
+
default:
|
1191
|
+
v.type = FcTypeVoid;
|
1192
|
+
break;
|
1193
|
+
}
|
1194
|
+
break;
|
1195
|
+
default:
|
1196
|
+
v.type = FcTypeVoid;
|
1197
|
+
break;
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
else
|
1201
|
+
v.type = FcTypeVoid;
|
1202
|
+
FcValueDestroy (vl);
|
1203
|
+
FcValueDestroy (vr);
|
1204
|
+
break;
|
1205
|
+
case FcOpNot:
|
1206
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1207
|
+
switch ((int) vl.type) {
|
1208
|
+
case FcTypeBool:
|
1209
|
+
v.type = FcTypeBool;
|
1210
|
+
v.u.b = !vl.u.b;
|
1211
|
+
break;
|
1212
|
+
default:
|
1213
|
+
v.type = FcTypeVoid;
|
1214
|
+
break;
|
1215
|
+
}
|
1216
|
+
FcValueDestroy (vl);
|
1217
|
+
break;
|
1218
|
+
case FcOpFloor:
|
1219
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1220
|
+
switch ((int) vl.type) {
|
1221
|
+
case FcTypeInteger:
|
1222
|
+
v = vl;
|
1223
|
+
break;
|
1224
|
+
case FcTypeDouble:
|
1225
|
+
v.type = FcTypeInteger;
|
1226
|
+
v.u.i = FcDoubleFloor (vl.u.d);
|
1227
|
+
break;
|
1228
|
+
default:
|
1229
|
+
v.type = FcTypeVoid;
|
1230
|
+
break;
|
1231
|
+
}
|
1232
|
+
FcValueDestroy (vl);
|
1233
|
+
break;
|
1234
|
+
case FcOpCeil:
|
1235
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1236
|
+
switch ((int) vl.type) {
|
1237
|
+
case FcTypeInteger:
|
1238
|
+
v = vl;
|
1239
|
+
break;
|
1240
|
+
case FcTypeDouble:
|
1241
|
+
v.type = FcTypeInteger;
|
1242
|
+
v.u.i = FcDoubleCeil (vl.u.d);
|
1243
|
+
break;
|
1244
|
+
default:
|
1245
|
+
v.type = FcTypeVoid;
|
1246
|
+
break;
|
1247
|
+
}
|
1248
|
+
FcValueDestroy (vl);
|
1249
|
+
break;
|
1250
|
+
case FcOpRound:
|
1251
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1252
|
+
switch ((int) vl.type) {
|
1253
|
+
case FcTypeInteger:
|
1254
|
+
v = vl;
|
1255
|
+
break;
|
1256
|
+
case FcTypeDouble:
|
1257
|
+
v.type = FcTypeInteger;
|
1258
|
+
v.u.i = FcDoubleRound (vl.u.d);
|
1259
|
+
break;
|
1260
|
+
default:
|
1261
|
+
v.type = FcTypeVoid;
|
1262
|
+
break;
|
1263
|
+
}
|
1264
|
+
FcValueDestroy (vl);
|
1265
|
+
break;
|
1266
|
+
case FcOpTrunc:
|
1267
|
+
vl = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1268
|
+
switch ((int) vl.type) {
|
1269
|
+
case FcTypeInteger:
|
1270
|
+
v = vl;
|
1271
|
+
break;
|
1272
|
+
case FcTypeDouble:
|
1273
|
+
v.type = FcTypeInteger;
|
1274
|
+
v.u.i = FcDoubleTrunc (vl.u.d);
|
1275
|
+
break;
|
1276
|
+
default:
|
1277
|
+
v.type = FcTypeVoid;
|
1278
|
+
break;
|
1279
|
+
}
|
1280
|
+
FcValueDestroy (vl);
|
1281
|
+
break;
|
1282
|
+
default:
|
1283
|
+
v.type = FcTypeVoid;
|
1284
|
+
break;
|
1285
|
+
}
|
1286
|
+
return v;
|
1287
|
+
}
|
1288
|
+
|
1289
|
+
static FcValueList *
|
1290
|
+
FcConfigMatchValueList (FcPattern *p,
|
1291
|
+
FcPattern *p_pat,
|
1292
|
+
FcMatchKind kind,
|
1293
|
+
FcTest *t,
|
1294
|
+
FcValueList *values)
|
1295
|
+
{
|
1296
|
+
FcValueList *ret = 0;
|
1297
|
+
FcExpr *e = t->expr;
|
1298
|
+
FcValue value;
|
1299
|
+
FcValueList *v;
|
1300
|
+
|
1301
|
+
while (e)
|
1302
|
+
{
|
1303
|
+
/* Compute the value of the match expression */
|
1304
|
+
if (FC_OP_GET_OP (e->op) == FcOpComma)
|
1305
|
+
{
|
1306
|
+
value = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1307
|
+
e = e->u.tree.right;
|
1308
|
+
}
|
1309
|
+
else
|
1310
|
+
{
|
1311
|
+
value = FcConfigEvaluate (p, p_pat, kind, e);
|
1312
|
+
e = 0;
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
for (v = values; v; v = FcValueListNext(v))
|
1316
|
+
{
|
1317
|
+
/* Compare the pattern value to the match expression value */
|
1318
|
+
if (FcConfigCompareValue (&v->value, t->op, &value))
|
1319
|
+
{
|
1320
|
+
if (!ret)
|
1321
|
+
ret = v;
|
1322
|
+
}
|
1323
|
+
else
|
1324
|
+
{
|
1325
|
+
if (t->qual == FcQualAll)
|
1326
|
+
{
|
1327
|
+
ret = 0;
|
1328
|
+
break;
|
1329
|
+
}
|
1330
|
+
}
|
1331
|
+
}
|
1332
|
+
FcValueDestroy (value);
|
1333
|
+
}
|
1334
|
+
return ret;
|
1335
|
+
}
|
1336
|
+
|
1337
|
+
static FcValueList *
|
1338
|
+
FcConfigValues (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e, FcValueBinding binding)
|
1339
|
+
{
|
1340
|
+
FcValueList *l;
|
1341
|
+
|
1342
|
+
if (!e)
|
1343
|
+
return 0;
|
1344
|
+
l = (FcValueList *) malloc (sizeof (FcValueList));
|
1345
|
+
if (!l)
|
1346
|
+
return 0;
|
1347
|
+
if (FC_OP_GET_OP (e->op) == FcOpComma)
|
1348
|
+
{
|
1349
|
+
l->value = FcConfigEvaluate (p, p_pat, kind, e->u.tree.left);
|
1350
|
+
l->next = FcConfigValues (p, p_pat, kind, e->u.tree.right, binding);
|
1351
|
+
}
|
1352
|
+
else
|
1353
|
+
{
|
1354
|
+
l->value = FcConfigEvaluate (p, p_pat, kind, e);
|
1355
|
+
l->next = NULL;
|
1356
|
+
}
|
1357
|
+
l->binding = binding;
|
1358
|
+
if (l->value.type == FcTypeVoid)
|
1359
|
+
{
|
1360
|
+
FcValueList *next = FcValueListNext(l);
|
1361
|
+
|
1362
|
+
free (l);
|
1363
|
+
l = next;
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
return l;
|
1367
|
+
}
|
1368
|
+
|
1369
|
+
static FcBool
|
1370
|
+
FcConfigAdd (FcValueListPtr *head,
|
1371
|
+
FcValueList *position,
|
1372
|
+
FcBool append,
|
1373
|
+
FcValueList *new,
|
1374
|
+
FcObject object)
|
1375
|
+
{
|
1376
|
+
FcValueListPtr *prev, l, last, v;
|
1377
|
+
FcValueBinding sameBinding;
|
1378
|
+
|
1379
|
+
/*
|
1380
|
+
* Make sure the stored type is valid for built-in objects
|
1381
|
+
*/
|
1382
|
+
for (l = new; l != NULL; l = FcValueListNext (l))
|
1383
|
+
{
|
1384
|
+
if (!FcObjectValidType (object, l->value.type))
|
1385
|
+
{
|
1386
|
+
fprintf (stderr,
|
1387
|
+
"Fontconfig warning: FcPattern object %s does not accept value", FcObjectName (object));
|
1388
|
+
FcValuePrintFile (stderr, l->value);
|
1389
|
+
fprintf (stderr, "\n");
|
1390
|
+
|
1391
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1392
|
+
{
|
1393
|
+
printf ("Not adding\n");
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
return FcFalse;
|
1397
|
+
}
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
if (position)
|
1401
|
+
sameBinding = position->binding;
|
1402
|
+
else
|
1403
|
+
sameBinding = FcValueBindingWeak;
|
1404
|
+
for (v = new; v != NULL; v = FcValueListNext(v))
|
1405
|
+
if (v->binding == FcValueBindingSame)
|
1406
|
+
v->binding = sameBinding;
|
1407
|
+
if (append)
|
1408
|
+
{
|
1409
|
+
if (position)
|
1410
|
+
prev = &position->next;
|
1411
|
+
else
|
1412
|
+
for (prev = head; *prev != NULL;
|
1413
|
+
prev = &(*prev)->next)
|
1414
|
+
;
|
1415
|
+
}
|
1416
|
+
else
|
1417
|
+
{
|
1418
|
+
if (position)
|
1419
|
+
{
|
1420
|
+
for (prev = head; *prev != NULL;
|
1421
|
+
prev = &(*prev)->next)
|
1422
|
+
{
|
1423
|
+
if (*prev == position)
|
1424
|
+
break;
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
else
|
1428
|
+
prev = head;
|
1429
|
+
|
1430
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1431
|
+
{
|
1432
|
+
if (*prev == NULL)
|
1433
|
+
printf ("position not on list\n");
|
1434
|
+
}
|
1435
|
+
}
|
1436
|
+
|
1437
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1438
|
+
{
|
1439
|
+
printf ("%s list before ", append ? "Append" : "Prepend");
|
1440
|
+
FcValueListPrintWithPosition (*head, *prev);
|
1441
|
+
printf ("\n");
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
if (new)
|
1445
|
+
{
|
1446
|
+
last = new;
|
1447
|
+
while (last->next != NULL)
|
1448
|
+
last = last->next;
|
1449
|
+
|
1450
|
+
last->next = *prev;
|
1451
|
+
*prev = new;
|
1452
|
+
}
|
1453
|
+
|
1454
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1455
|
+
{
|
1456
|
+
printf ("%s list after ", append ? "Append" : "Prepend");
|
1457
|
+
FcValueListPrint (*head);
|
1458
|
+
printf ("\n");
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
return FcTrue;
|
1462
|
+
}
|
1463
|
+
|
1464
|
+
static void
|
1465
|
+
FcConfigDel (FcValueListPtr *head,
|
1466
|
+
FcValueList *position)
|
1467
|
+
{
|
1468
|
+
FcValueListPtr *prev;
|
1469
|
+
|
1470
|
+
for (prev = head; *prev != NULL; prev = &(*prev)->next)
|
1471
|
+
{
|
1472
|
+
if (*prev == position)
|
1473
|
+
{
|
1474
|
+
*prev = position->next;
|
1475
|
+
position->next = NULL;
|
1476
|
+
FcValueListDestroy (position);
|
1477
|
+
break;
|
1478
|
+
}
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
static void
|
1483
|
+
FcConfigPatternAdd (FcPattern *p,
|
1484
|
+
FcObject object,
|
1485
|
+
FcValueList *list,
|
1486
|
+
FcBool append)
|
1487
|
+
{
|
1488
|
+
if (list)
|
1489
|
+
{
|
1490
|
+
FcPatternElt *e = FcPatternObjectInsertElt (p, object);
|
1491
|
+
|
1492
|
+
if (!e)
|
1493
|
+
return;
|
1494
|
+
FcConfigAdd (&e->values, 0, append, list, object);
|
1495
|
+
}
|
1496
|
+
}
|
1497
|
+
|
1498
|
+
/*
|
1499
|
+
* Delete all values associated with a field
|
1500
|
+
*/
|
1501
|
+
static void
|
1502
|
+
FcConfigPatternDel (FcPattern *p,
|
1503
|
+
FcObject object)
|
1504
|
+
{
|
1505
|
+
FcPatternElt *e = FcPatternObjectFindElt (p, object);
|
1506
|
+
if (!e)
|
1507
|
+
return;
|
1508
|
+
while (e->values != NULL)
|
1509
|
+
FcConfigDel (&e->values, e->values);
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
static void
|
1513
|
+
FcConfigPatternCanon (FcPattern *p,
|
1514
|
+
FcObject object)
|
1515
|
+
{
|
1516
|
+
FcPatternElt *e = FcPatternObjectFindElt (p, object);
|
1517
|
+
if (!e)
|
1518
|
+
return;
|
1519
|
+
if (e->values == NULL)
|
1520
|
+
FcPatternObjectDel (p, object);
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
FcBool
|
1524
|
+
FcConfigSubstituteWithPat (FcConfig *config,
|
1525
|
+
FcPattern *p,
|
1526
|
+
FcPattern *p_pat,
|
1527
|
+
FcMatchKind kind)
|
1528
|
+
{
|
1529
|
+
FcValue v;
|
1530
|
+
FcPtrList *s;
|
1531
|
+
FcPtrListIter iter, iter2;
|
1532
|
+
FcRule *r;
|
1533
|
+
FcRuleSet *rs;
|
1534
|
+
FcValueList *l, **value = NULL, *vl;
|
1535
|
+
FcPattern *m;
|
1536
|
+
FcStrSet *strs;
|
1537
|
+
FcObject object = FC_INVALID_OBJECT;
|
1538
|
+
FcPatternElt **elt = NULL, *e;
|
1539
|
+
int i, nobjs;
|
1540
|
+
FcBool retval = FcTrue;
|
1541
|
+
FcTest **tst = NULL;
|
1542
|
+
|
1543
|
+
if (!config)
|
1544
|
+
{
|
1545
|
+
config = FcConfigGetCurrent ();
|
1546
|
+
if (!config)
|
1547
|
+
return FcFalse;
|
1548
|
+
}
|
1549
|
+
|
1550
|
+
if (kind < FcMatchKindBegin || kind >= FcMatchKindEnd)
|
1551
|
+
return FcFalse;
|
1552
|
+
s = config->subst[kind];
|
1553
|
+
if (kind == FcMatchPattern)
|
1554
|
+
{
|
1555
|
+
strs = FcGetDefaultLangs ();
|
1556
|
+
if (strs)
|
1557
|
+
{
|
1558
|
+
FcStrList *l = FcStrListCreate (strs);
|
1559
|
+
FcChar8 *lang;
|
1560
|
+
FcValue v;
|
1561
|
+
FcLangSet *lsund = FcLangSetCreate ();
|
1562
|
+
|
1563
|
+
FcLangSetAdd (lsund, (const FcChar8 *)"und");
|
1564
|
+
FcStrSetDestroy (strs);
|
1565
|
+
while (l && (lang = FcStrListNext (l)))
|
1566
|
+
{
|
1567
|
+
FcPatternElt *e = FcPatternObjectFindElt (p, FC_LANG_OBJECT);
|
1568
|
+
|
1569
|
+
if (e)
|
1570
|
+
{
|
1571
|
+
FcValueListPtr ll;
|
1572
|
+
|
1573
|
+
for (ll = FcPatternEltValues (e); ll; ll = FcValueListNext (ll))
|
1574
|
+
{
|
1575
|
+
FcValue vv = FcValueCanonicalize (&ll->value);
|
1576
|
+
|
1577
|
+
if (vv.type == FcTypeLangSet)
|
1578
|
+
{
|
1579
|
+
FcLangSet *ls = FcLangSetCreate ();
|
1580
|
+
FcBool b;
|
1581
|
+
|
1582
|
+
FcLangSetAdd (ls, lang);
|
1583
|
+
b = FcLangSetContains (vv.u.l, ls);
|
1584
|
+
FcLangSetDestroy (ls);
|
1585
|
+
if (b)
|
1586
|
+
goto bail_lang;
|
1587
|
+
if (FcLangSetContains (vv.u.l, lsund))
|
1588
|
+
goto bail_lang;
|
1589
|
+
}
|
1590
|
+
else
|
1591
|
+
{
|
1592
|
+
if (FcStrCmpIgnoreCase (vv.u.s, lang) == 0)
|
1593
|
+
goto bail_lang;
|
1594
|
+
if (FcStrCmpIgnoreCase (vv.u.s, (const FcChar8 *)"und") == 0)
|
1595
|
+
goto bail_lang;
|
1596
|
+
}
|
1597
|
+
}
|
1598
|
+
}
|
1599
|
+
v.type = FcTypeString;
|
1600
|
+
v.u.s = lang;
|
1601
|
+
|
1602
|
+
FcPatternObjectAddWithBinding (p, FC_LANG_OBJECT, v, FcValueBindingWeak, FcTrue);
|
1603
|
+
}
|
1604
|
+
bail_lang:
|
1605
|
+
FcStrListDone (l);
|
1606
|
+
FcLangSetDestroy (lsund);
|
1607
|
+
}
|
1608
|
+
if (FcPatternObjectGet (p, FC_PRGNAME_OBJECT, 0, &v) == FcResultNoMatch)
|
1609
|
+
{
|
1610
|
+
FcChar8 *prgname = FcGetPrgname ();
|
1611
|
+
if (prgname)
|
1612
|
+
FcPatternObjectAddString (p, FC_PRGNAME_OBJECT, prgname);
|
1613
|
+
}
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
nobjs = FC_MAX_BASE_OBJECT + config->maxObjects + 2;
|
1617
|
+
value = (FcValueList **) malloc (SIZEOF_VOID_P * nobjs);
|
1618
|
+
if (!value)
|
1619
|
+
{
|
1620
|
+
retval = FcFalse;
|
1621
|
+
goto bail1;
|
1622
|
+
}
|
1623
|
+
elt = (FcPatternElt **) malloc (SIZEOF_VOID_P * nobjs);
|
1624
|
+
if (!elt)
|
1625
|
+
{
|
1626
|
+
retval = FcFalse;
|
1627
|
+
goto bail1;
|
1628
|
+
}
|
1629
|
+
tst = (FcTest **) malloc (SIZEOF_VOID_P * nobjs);
|
1630
|
+
if (!tst)
|
1631
|
+
{
|
1632
|
+
retval = FcFalse;
|
1633
|
+
goto bail1;
|
1634
|
+
}
|
1635
|
+
|
1636
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1637
|
+
{
|
1638
|
+
printf ("FcConfigSubstitute ");
|
1639
|
+
FcPatternPrint (p);
|
1640
|
+
}
|
1641
|
+
FcPtrListIterInit (s, &iter);
|
1642
|
+
for (; FcPtrListIterIsValid (s, &iter); FcPtrListIterNext (s, &iter))
|
1643
|
+
{
|
1644
|
+
rs = (FcRuleSet *) FcPtrListIterGetValue (s, &iter);
|
1645
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1646
|
+
{
|
1647
|
+
printf ("\nRule Set: %s\n", rs->name);
|
1648
|
+
}
|
1649
|
+
FcPtrListIterInit (rs->subst[kind], &iter2);
|
1650
|
+
for (; FcPtrListIterIsValid (rs->subst[kind], &iter2); FcPtrListIterNext (rs->subst[kind], &iter2))
|
1651
|
+
{
|
1652
|
+
r = (FcRule *) FcPtrListIterGetValue (rs->subst[kind], &iter2);
|
1653
|
+
for (i = 0; i < nobjs; i++)
|
1654
|
+
{
|
1655
|
+
elt[i] = NULL;
|
1656
|
+
value[i] = NULL;
|
1657
|
+
tst[i] = NULL;
|
1658
|
+
}
|
1659
|
+
for (; r; r = r->next)
|
1660
|
+
{
|
1661
|
+
switch (r->type) {
|
1662
|
+
case FcRuleUnknown:
|
1663
|
+
/* shouldn't be reached */
|
1664
|
+
break;
|
1665
|
+
case FcRuleTest:
|
1666
|
+
object = FC_OBJ_ID (r->u.test->object);
|
1667
|
+
/*
|
1668
|
+
* Check the tests to see if
|
1669
|
+
* they all match the pattern
|
1670
|
+
*/
|
1671
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1672
|
+
{
|
1673
|
+
printf ("FcConfigSubstitute test ");
|
1674
|
+
FcTestPrint (r->u.test);
|
1675
|
+
}
|
1676
|
+
if (kind == FcMatchFont && r->u.test->kind == FcMatchPattern)
|
1677
|
+
m = p_pat;
|
1678
|
+
else
|
1679
|
+
m = p;
|
1680
|
+
if (m)
|
1681
|
+
e = FcPatternObjectFindElt (m, r->u.test->object);
|
1682
|
+
else
|
1683
|
+
e = NULL;
|
1684
|
+
/* different 'kind' won't be the target of edit */
|
1685
|
+
if (!elt[object] && kind == r->u.test->kind)
|
1686
|
+
{
|
1687
|
+
elt[object] = e;
|
1688
|
+
tst[object] = r->u.test;
|
1689
|
+
}
|
1690
|
+
/*
|
1691
|
+
* If there's no such field in the font,
|
1692
|
+
* then FcQualAll matches while FcQualAny does not
|
1693
|
+
*/
|
1694
|
+
if (!e)
|
1695
|
+
{
|
1696
|
+
if (r->u.test->qual == FcQualAll)
|
1697
|
+
{
|
1698
|
+
value[object] = NULL;
|
1699
|
+
continue;
|
1700
|
+
}
|
1701
|
+
else
|
1702
|
+
{
|
1703
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1704
|
+
printf ("No match\n");
|
1705
|
+
goto bail;
|
1706
|
+
}
|
1707
|
+
}
|
1708
|
+
/*
|
1709
|
+
* Check to see if there is a match, mark the location
|
1710
|
+
* to apply match-relative edits
|
1711
|
+
*/
|
1712
|
+
vl = FcConfigMatchValueList (m, p_pat, kind, r->u.test, e->values);
|
1713
|
+
/* different 'kind' won't be the target of edit */
|
1714
|
+
if (!value[object] && kind == r->u.test->kind)
|
1715
|
+
value[object] = vl;
|
1716
|
+
if (!vl ||
|
1717
|
+
(r->u.test->qual == FcQualFirst && vl != e->values) ||
|
1718
|
+
(r->u.test->qual == FcQualNotFirst && vl == e->values))
|
1719
|
+
{
|
1720
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1721
|
+
printf ("No match\n");
|
1722
|
+
goto bail;
|
1723
|
+
}
|
1724
|
+
break;
|
1725
|
+
case FcRuleEdit:
|
1726
|
+
object = FC_OBJ_ID (r->u.edit->object);
|
1727
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1728
|
+
{
|
1729
|
+
printf ("Substitute ");
|
1730
|
+
FcEditPrint (r->u.edit);
|
1731
|
+
printf ("\n\n");
|
1732
|
+
}
|
1733
|
+
/*
|
1734
|
+
* Evaluate the list of expressions
|
1735
|
+
*/
|
1736
|
+
l = FcConfigValues (p, p_pat,kind, r->u.edit->expr, r->u.edit->binding);
|
1737
|
+
if (tst[object] && (tst[object]->kind == FcMatchFont || kind == FcMatchPattern))
|
1738
|
+
elt[object] = FcPatternObjectFindElt (p, tst[object]->object);
|
1739
|
+
|
1740
|
+
switch (FC_OP_GET_OP (r->u.edit->op)) {
|
1741
|
+
case FcOpAssign:
|
1742
|
+
/*
|
1743
|
+
* If there was a test, then replace the matched
|
1744
|
+
* value with the new list of values
|
1745
|
+
*/
|
1746
|
+
if (value[object])
|
1747
|
+
{
|
1748
|
+
FcValueList *thisValue = value[object];
|
1749
|
+
FcValueList *nextValue = l;
|
1750
|
+
|
1751
|
+
/*
|
1752
|
+
* Append the new list of values after the current value
|
1753
|
+
*/
|
1754
|
+
FcConfigAdd (&elt[object]->values, thisValue, FcTrue, l, r->u.edit->object);
|
1755
|
+
/*
|
1756
|
+
* Delete the marked value
|
1757
|
+
*/
|
1758
|
+
if (thisValue)
|
1759
|
+
FcConfigDel (&elt[object]->values, thisValue);
|
1760
|
+
/*
|
1761
|
+
* Adjust a pointer into the value list to ensure
|
1762
|
+
* future edits occur at the same place
|
1763
|
+
*/
|
1764
|
+
value[object] = nextValue;
|
1765
|
+
break;
|
1766
|
+
}
|
1767
|
+
/* fall through ... */
|
1768
|
+
case FcOpAssignReplace:
|
1769
|
+
/*
|
1770
|
+
* Delete all of the values and insert
|
1771
|
+
* the new set
|
1772
|
+
*/
|
1773
|
+
FcConfigPatternDel (p, r->u.edit->object);
|
1774
|
+
FcConfigPatternAdd (p, r->u.edit->object, l, FcTrue);
|
1775
|
+
/*
|
1776
|
+
* Adjust a pointer into the value list as they no
|
1777
|
+
* longer point to anything valid
|
1778
|
+
*/
|
1779
|
+
value[object] = NULL;
|
1780
|
+
break;
|
1781
|
+
case FcOpPrepend:
|
1782
|
+
if (value[object])
|
1783
|
+
{
|
1784
|
+
FcConfigAdd (&elt[object]->values, value[object], FcFalse, l, r->u.edit->object);
|
1785
|
+
break;
|
1786
|
+
}
|
1787
|
+
/* fall through ... */
|
1788
|
+
case FcOpPrependFirst:
|
1789
|
+
FcConfigPatternAdd (p, r->u.edit->object, l, FcFalse);
|
1790
|
+
break;
|
1791
|
+
case FcOpAppend:
|
1792
|
+
if (value[object])
|
1793
|
+
{
|
1794
|
+
FcConfigAdd (&elt[object]->values, value[object], FcTrue, l, r->u.edit->object);
|
1795
|
+
break;
|
1796
|
+
}
|
1797
|
+
/* fall through ... */
|
1798
|
+
case FcOpAppendLast:
|
1799
|
+
FcConfigPatternAdd (p, r->u.edit->object, l, FcTrue);
|
1800
|
+
break;
|
1801
|
+
case FcOpDelete:
|
1802
|
+
if (value[object])
|
1803
|
+
{
|
1804
|
+
FcConfigDel (&elt[object]->values, value[object]);
|
1805
|
+
break;
|
1806
|
+
}
|
1807
|
+
/* fall through ... */
|
1808
|
+
case FcOpDeleteAll:
|
1809
|
+
FcConfigPatternDel (p, r->u.edit->object);
|
1810
|
+
break;
|
1811
|
+
default:
|
1812
|
+
FcValueListDestroy (l);
|
1813
|
+
break;
|
1814
|
+
}
|
1815
|
+
/*
|
1816
|
+
* Now go through the pattern and eliminate
|
1817
|
+
* any properties without data
|
1818
|
+
*/
|
1819
|
+
FcConfigPatternCanon (p, r->u.edit->object);
|
1820
|
+
|
1821
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1822
|
+
{
|
1823
|
+
printf ("FcConfigSubstitute edit");
|
1824
|
+
FcPatternPrint (p);
|
1825
|
+
}
|
1826
|
+
break;
|
1827
|
+
}
|
1828
|
+
}
|
1829
|
+
bail:;
|
1830
|
+
}
|
1831
|
+
}
|
1832
|
+
if (FcDebug () & FC_DBG_EDIT)
|
1833
|
+
{
|
1834
|
+
printf ("FcConfigSubstitute done");
|
1835
|
+
FcPatternPrint (p);
|
1836
|
+
}
|
1837
|
+
bail1:
|
1838
|
+
if (elt)
|
1839
|
+
free (elt);
|
1840
|
+
if (value)
|
1841
|
+
free (value);
|
1842
|
+
if (tst)
|
1843
|
+
free (tst);
|
1844
|
+
|
1845
|
+
return retval;
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
FcBool
|
1849
|
+
FcConfigSubstitute (FcConfig *config,
|
1850
|
+
FcPattern *p,
|
1851
|
+
FcMatchKind kind)
|
1852
|
+
{
|
1853
|
+
return FcConfigSubstituteWithPat (config, p, 0, kind);
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
#if defined (_WIN32)
|
1857
|
+
|
1858
|
+
static FcChar8 fontconfig_path[1000] = ""; /* MT-dontcare */
|
1859
|
+
FcChar8 fontconfig_instprefix[1000] = ""; /* MT-dontcare */
|
1860
|
+
|
1861
|
+
# if (defined (PIC) || defined (DLL_EXPORT))
|
1862
|
+
|
1863
|
+
BOOL WINAPI
|
1864
|
+
DllMain (HINSTANCE hinstDLL,
|
1865
|
+
DWORD fdwReason,
|
1866
|
+
LPVOID lpvReserved);
|
1867
|
+
|
1868
|
+
BOOL WINAPI
|
1869
|
+
DllMain (HINSTANCE hinstDLL,
|
1870
|
+
DWORD fdwReason,
|
1871
|
+
LPVOID lpvReserved)
|
1872
|
+
{
|
1873
|
+
FcChar8 *p;
|
1874
|
+
|
1875
|
+
switch (fdwReason) {
|
1876
|
+
case DLL_PROCESS_ATTACH:
|
1877
|
+
if (!GetModuleFileName ((HMODULE) hinstDLL, (LPCH) fontconfig_path,
|
1878
|
+
sizeof (fontconfig_path)))
|
1879
|
+
break;
|
1880
|
+
|
1881
|
+
/* If the fontconfig DLL is in a "bin" or "lib" subfolder,
|
1882
|
+
* assume it's a Unix-style installation tree, and use
|
1883
|
+
* "etc/fonts" in there as FONTCONFIG_PATH. Otherwise use the
|
1884
|
+
* folder where the DLL is as FONTCONFIG_PATH.
|
1885
|
+
*/
|
1886
|
+
p = (FcChar8 *) strrchr ((const char *) fontconfig_path, '\\');
|
1887
|
+
if (p)
|
1888
|
+
{
|
1889
|
+
*p = '\0';
|
1890
|
+
p = (FcChar8 *) strrchr ((const char *) fontconfig_path, '\\');
|
1891
|
+
if (p && (FcStrCmpIgnoreCase (p + 1, (const FcChar8 *) "bin") == 0 ||
|
1892
|
+
FcStrCmpIgnoreCase (p + 1, (const FcChar8 *) "lib") == 0))
|
1893
|
+
*p = '\0';
|
1894
|
+
strcat ((char *) fontconfig_instprefix, (char *) fontconfig_path);
|
1895
|
+
strcat ((char *) fontconfig_path, "\\etc\\fonts");
|
1896
|
+
}
|
1897
|
+
else
|
1898
|
+
fontconfig_path[0] = '\0';
|
1899
|
+
|
1900
|
+
break;
|
1901
|
+
}
|
1902
|
+
|
1903
|
+
return TRUE;
|
1904
|
+
}
|
1905
|
+
|
1906
|
+
# endif /* !PIC */
|
1907
|
+
|
1908
|
+
#undef FONTCONFIG_PATH
|
1909
|
+
#define FONTCONFIG_PATH fontconfig_path
|
1910
|
+
|
1911
|
+
#endif /* !_WIN32 */
|
1912
|
+
|
1913
|
+
#ifndef FONTCONFIG_FILE
|
1914
|
+
#define FONTCONFIG_FILE "fonts.conf"
|
1915
|
+
#endif
|
1916
|
+
|
1917
|
+
static FcChar8 *
|
1918
|
+
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
|
1919
|
+
{
|
1920
|
+
FcChar8 *path;
|
1921
|
+
int size, osize;
|
1922
|
+
|
1923
|
+
if (!dir)
|
1924
|
+
dir = (FcChar8 *) "";
|
1925
|
+
|
1926
|
+
osize = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1;
|
1927
|
+
/*
|
1928
|
+
* workaround valgrind warning because glibc takes advantage of how it knows memory is
|
1929
|
+
* allocated to implement strlen by reading in groups of 4
|
1930
|
+
*/
|
1931
|
+
size = (osize + 3) & ~3;
|
1932
|
+
|
1933
|
+
path = malloc (size);
|
1934
|
+
if (!path)
|
1935
|
+
return 0;
|
1936
|
+
|
1937
|
+
strcpy ((char *) path, (const char *) dir);
|
1938
|
+
/* make sure there's a single separator */
|
1939
|
+
#ifdef _WIN32
|
1940
|
+
if ((!path[0] || (path[strlen((char *) path)-1] != '/' &&
|
1941
|
+
path[strlen((char *) path)-1] != '\\')) &&
|
1942
|
+
!(file[0] == '/' ||
|
1943
|
+
file[0] == '\\' ||
|
1944
|
+
(isalpha (file[0]) && file[1] == ':' && (file[2] == '/' || file[2] == '\\'))))
|
1945
|
+
strcat ((char *) path, "\\");
|
1946
|
+
#else
|
1947
|
+
if ((!path[0] || path[strlen((char *) path)-1] != '/') && file[0] != '/')
|
1948
|
+
strcat ((char *) path, "/");
|
1949
|
+
else
|
1950
|
+
osize--;
|
1951
|
+
#endif
|
1952
|
+
strcat ((char *) path, (char *) file);
|
1953
|
+
|
1954
|
+
if (access ((char *) path, R_OK) == 0)
|
1955
|
+
return path;
|
1956
|
+
|
1957
|
+
FcStrFree (path);
|
1958
|
+
|
1959
|
+
return 0;
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
static FcChar8 **
|
1963
|
+
FcConfigGetPath (void)
|
1964
|
+
{
|
1965
|
+
FcChar8 **path;
|
1966
|
+
FcChar8 *env, *e, *colon;
|
1967
|
+
FcChar8 *dir;
|
1968
|
+
int npath;
|
1969
|
+
int i;
|
1970
|
+
|
1971
|
+
npath = 2; /* default dir + null */
|
1972
|
+
env = (FcChar8 *) getenv ("FONTCONFIG_PATH");
|
1973
|
+
if (env)
|
1974
|
+
{
|
1975
|
+
e = env;
|
1976
|
+
npath++;
|
1977
|
+
while (*e)
|
1978
|
+
if (*e++ == FC_SEARCH_PATH_SEPARATOR)
|
1979
|
+
npath++;
|
1980
|
+
}
|
1981
|
+
path = calloc (npath, sizeof (FcChar8 *));
|
1982
|
+
if (!path)
|
1983
|
+
goto bail0;
|
1984
|
+
i = 0;
|
1985
|
+
|
1986
|
+
if (env)
|
1987
|
+
{
|
1988
|
+
e = env;
|
1989
|
+
while (*e)
|
1990
|
+
{
|
1991
|
+
colon = (FcChar8 *) strchr ((char *) e, FC_SEARCH_PATH_SEPARATOR);
|
1992
|
+
if (!colon)
|
1993
|
+
colon = e + strlen ((char *) e);
|
1994
|
+
path[i] = malloc (colon - e + 1);
|
1995
|
+
if (!path[i])
|
1996
|
+
goto bail1;
|
1997
|
+
strncpy ((char *) path[i], (const char *) e, colon - e);
|
1998
|
+
path[i][colon - e] = '\0';
|
1999
|
+
if (*colon)
|
2000
|
+
e = colon + 1;
|
2001
|
+
else
|
2002
|
+
e = colon;
|
2003
|
+
i++;
|
2004
|
+
}
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
#ifdef _WIN32
|
2008
|
+
if (fontconfig_path[0] == '\0')
|
2009
|
+
{
|
2010
|
+
char *p;
|
2011
|
+
if(!GetModuleFileName(NULL, (LPCH) fontconfig_path, sizeof(fontconfig_path)))
|
2012
|
+
goto bail1;
|
2013
|
+
p = strrchr ((const char *) fontconfig_path, '\\');
|
2014
|
+
if (p) *p = '\0';
|
2015
|
+
strcat ((char *) fontconfig_path, "\\fonts");
|
2016
|
+
}
|
2017
|
+
#endif
|
2018
|
+
dir = (FcChar8 *) FONTCONFIG_PATH;
|
2019
|
+
path[i] = malloc (strlen ((char *) dir) + 1);
|
2020
|
+
if (!path[i])
|
2021
|
+
goto bail1;
|
2022
|
+
strcpy ((char *) path[i], (const char *) dir);
|
2023
|
+
return path;
|
2024
|
+
|
2025
|
+
bail1:
|
2026
|
+
for (i = 0; path[i]; i++)
|
2027
|
+
free (path[i]);
|
2028
|
+
free (path);
|
2029
|
+
bail0:
|
2030
|
+
return 0;
|
2031
|
+
}
|
2032
|
+
|
2033
|
+
static void
|
2034
|
+
FcConfigFreePath (FcChar8 **path)
|
2035
|
+
{
|
2036
|
+
FcChar8 **p;
|
2037
|
+
|
2038
|
+
for (p = path; *p; p++)
|
2039
|
+
free (*p);
|
2040
|
+
free (path);
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
static FcBool _FcConfigHomeEnabled = FcTrue; /* MT-goodenough */
|
2044
|
+
|
2045
|
+
FcChar8 *
|
2046
|
+
FcConfigHome (void)
|
2047
|
+
{
|
2048
|
+
if (_FcConfigHomeEnabled)
|
2049
|
+
{
|
2050
|
+
char *home = getenv ("HOME");
|
2051
|
+
|
2052
|
+
#ifdef _WIN32
|
2053
|
+
if (home == NULL)
|
2054
|
+
home = getenv ("USERPROFILE");
|
2055
|
+
#endif
|
2056
|
+
|
2057
|
+
return (FcChar8 *) home;
|
2058
|
+
}
|
2059
|
+
return 0;
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
FcChar8 *
|
2063
|
+
FcConfigXdgCacheHome (void)
|
2064
|
+
{
|
2065
|
+
const char *env = getenv ("XDG_CACHE_HOME");
|
2066
|
+
FcChar8 *ret = NULL;
|
2067
|
+
|
2068
|
+
if (!_FcConfigHomeEnabled)
|
2069
|
+
return NULL;
|
2070
|
+
if (env)
|
2071
|
+
ret = FcStrCopy ((const FcChar8 *)env);
|
2072
|
+
else
|
2073
|
+
{
|
2074
|
+
const FcChar8 *home = FcConfigHome ();
|
2075
|
+
size_t len = home ? strlen ((const char *)home) : 0;
|
2076
|
+
|
2077
|
+
ret = malloc (len + 7 + 1);
|
2078
|
+
if (ret)
|
2079
|
+
{
|
2080
|
+
memcpy (ret, home, len);
|
2081
|
+
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7);
|
2082
|
+
ret[len + 7] = 0;
|
2083
|
+
}
|
2084
|
+
}
|
2085
|
+
|
2086
|
+
return ret;
|
2087
|
+
}
|
2088
|
+
|
2089
|
+
FcChar8 *
|
2090
|
+
FcConfigXdgConfigHome (void)
|
2091
|
+
{
|
2092
|
+
const char *env = getenv ("XDG_CONFIG_HOME");
|
2093
|
+
FcChar8 *ret = NULL;
|
2094
|
+
|
2095
|
+
if (!_FcConfigHomeEnabled)
|
2096
|
+
return NULL;
|
2097
|
+
if (env)
|
2098
|
+
ret = FcStrCopy ((const FcChar8 *)env);
|
2099
|
+
else
|
2100
|
+
{
|
2101
|
+
const FcChar8 *home = FcConfigHome ();
|
2102
|
+
size_t len = home ? strlen ((const char *)home) : 0;
|
2103
|
+
|
2104
|
+
ret = malloc (len + 8 + 1);
|
2105
|
+
if (ret)
|
2106
|
+
{
|
2107
|
+
memcpy (ret, home, len);
|
2108
|
+
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8);
|
2109
|
+
ret[len + 8] = 0;
|
2110
|
+
}
|
2111
|
+
}
|
2112
|
+
|
2113
|
+
return ret;
|
2114
|
+
}
|
2115
|
+
|
2116
|
+
FcChar8 *
|
2117
|
+
FcConfigXdgDataHome (void)
|
2118
|
+
{
|
2119
|
+
const char *env = getenv ("XDG_DATA_HOME");
|
2120
|
+
FcChar8 *ret = NULL;
|
2121
|
+
|
2122
|
+
if (!_FcConfigHomeEnabled)
|
2123
|
+
return NULL;
|
2124
|
+
if (env)
|
2125
|
+
ret = FcStrCopy ((const FcChar8 *)env);
|
2126
|
+
else
|
2127
|
+
{
|
2128
|
+
const FcChar8 *home = FcConfigHome ();
|
2129
|
+
size_t len = home ? strlen ((const char *)home) : 0;
|
2130
|
+
|
2131
|
+
ret = malloc (len + 13 + 1);
|
2132
|
+
if (ret)
|
2133
|
+
{
|
2134
|
+
memcpy (ret, home, len);
|
2135
|
+
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13);
|
2136
|
+
ret[len + 13] = 0;
|
2137
|
+
}
|
2138
|
+
}
|
2139
|
+
|
2140
|
+
return ret;
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
FcBool
|
2144
|
+
FcConfigEnableHome (FcBool enable)
|
2145
|
+
{
|
2146
|
+
FcBool prev = _FcConfigHomeEnabled;
|
2147
|
+
_FcConfigHomeEnabled = enable;
|
2148
|
+
return prev;
|
2149
|
+
}
|
2150
|
+
|
2151
|
+
FcChar8 *
|
2152
|
+
FcConfigFilename (const FcChar8 *url)
|
2153
|
+
{
|
2154
|
+
FcChar8 *file, *dir, **path, **p;
|
2155
|
+
|
2156
|
+
if (!url || !*url)
|
2157
|
+
{
|
2158
|
+
url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
|
2159
|
+
if (!url)
|
2160
|
+
url = (FcChar8 *) FONTCONFIG_FILE;
|
2161
|
+
}
|
2162
|
+
file = 0;
|
2163
|
+
|
2164
|
+
#ifdef _WIN32
|
2165
|
+
if (isalpha (*url) &&
|
2166
|
+
url[1] == ':' &&
|
2167
|
+
(url[2] == '/' || url[2] == '\\'))
|
2168
|
+
goto absolute_path;
|
2169
|
+
#endif
|
2170
|
+
|
2171
|
+
switch (*url) {
|
2172
|
+
case '~':
|
2173
|
+
dir = FcConfigHome ();
|
2174
|
+
if (dir)
|
2175
|
+
file = FcConfigFileExists (dir, url + 1);
|
2176
|
+
else
|
2177
|
+
file = 0;
|
2178
|
+
break;
|
2179
|
+
#ifdef _WIN32
|
2180
|
+
case '\\':
|
2181
|
+
absolute_path:
|
2182
|
+
#endif
|
2183
|
+
case '/':
|
2184
|
+
file = FcConfigFileExists (0, url);
|
2185
|
+
break;
|
2186
|
+
default:
|
2187
|
+
path = FcConfigGetPath ();
|
2188
|
+
if (!path)
|
2189
|
+
return NULL;
|
2190
|
+
for (p = path; *p; p++)
|
2191
|
+
{
|
2192
|
+
file = FcConfigFileExists (*p, url);
|
2193
|
+
if (file)
|
2194
|
+
break;
|
2195
|
+
}
|
2196
|
+
FcConfigFreePath (path);
|
2197
|
+
break;
|
2198
|
+
}
|
2199
|
+
|
2200
|
+
return file;
|
2201
|
+
}
|
2202
|
+
|
2203
|
+
FcChar8 *
|
2204
|
+
FcConfigRealFilename (FcConfig *config,
|
2205
|
+
const FcChar8 *url)
|
2206
|
+
{
|
2207
|
+
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
2208
|
+
FcChar8 *n = FcConfigFilename (url);
|
2209
|
+
FcChar8 *nn = NULL;
|
2210
|
+
|
2211
|
+
if (n)
|
2212
|
+
{
|
2213
|
+
FcChar8 buf[PATH_MAX];
|
2214
|
+
ssize_t len;
|
2215
|
+
|
2216
|
+
if (sysroot)
|
2217
|
+
nn = FcStrBuildFilename (sysroot, n, NULL);
|
2218
|
+
else
|
2219
|
+
nn = FcStrdup (n);
|
2220
|
+
FcStrFree (n);
|
2221
|
+
|
2222
|
+
if ((len = FcReadLink (nn, buf, sizeof (buf) - 1)) != -1)
|
2223
|
+
{
|
2224
|
+
buf[len] = 0;
|
2225
|
+
FcStrFree (nn);
|
2226
|
+
nn = FcStrdup (buf);
|
2227
|
+
}
|
2228
|
+
}
|
2229
|
+
|
2230
|
+
return nn;
|
2231
|
+
}
|
2232
|
+
|
2233
|
+
/*
|
2234
|
+
* Manage the application-specific fonts
|
2235
|
+
*/
|
2236
|
+
|
2237
|
+
FcBool
|
2238
|
+
FcConfigAppFontAddFile (FcConfig *config,
|
2239
|
+
const FcChar8 *file)
|
2240
|
+
{
|
2241
|
+
FcFontSet *set;
|
2242
|
+
FcStrSet *subdirs;
|
2243
|
+
FcStrList *sublist;
|
2244
|
+
FcChar8 *subdir;
|
2245
|
+
|
2246
|
+
if (!config)
|
2247
|
+
{
|
2248
|
+
config = FcConfigGetCurrent ();
|
2249
|
+
if (!config)
|
2250
|
+
return FcFalse;
|
2251
|
+
}
|
2252
|
+
|
2253
|
+
subdirs = FcStrSetCreateEx (FCSS_GROW_BY_64);
|
2254
|
+
if (!subdirs)
|
2255
|
+
return FcFalse;
|
2256
|
+
|
2257
|
+
set = FcConfigGetFonts (config, FcSetApplication);
|
2258
|
+
if (!set)
|
2259
|
+
{
|
2260
|
+
set = FcFontSetCreate ();
|
2261
|
+
if (!set)
|
2262
|
+
{
|
2263
|
+
FcStrSetDestroy (subdirs);
|
2264
|
+
return FcFalse;
|
2265
|
+
}
|
2266
|
+
FcConfigSetFonts (config, set, FcSetApplication);
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
if (!FcFileScanConfig (set, subdirs, file, config))
|
2270
|
+
{
|
2271
|
+
FcStrSetDestroy (subdirs);
|
2272
|
+
return FcFalse;
|
2273
|
+
}
|
2274
|
+
if ((sublist = FcStrListCreate (subdirs)))
|
2275
|
+
{
|
2276
|
+
while ((subdir = FcStrListNext (sublist)))
|
2277
|
+
{
|
2278
|
+
FcConfigAppFontAddDir (config, subdir);
|
2279
|
+
}
|
2280
|
+
FcStrListDone (sublist);
|
2281
|
+
}
|
2282
|
+
FcStrSetDestroy (subdirs);
|
2283
|
+
return FcTrue;
|
2284
|
+
}
|
2285
|
+
|
2286
|
+
FcBool
|
2287
|
+
FcConfigAppFontAddDir (FcConfig *config,
|
2288
|
+
const FcChar8 *dir)
|
2289
|
+
{
|
2290
|
+
FcFontSet *set;
|
2291
|
+
FcStrSet *dirs;
|
2292
|
+
|
2293
|
+
if (!config)
|
2294
|
+
{
|
2295
|
+
config = FcConfigGetCurrent ();
|
2296
|
+
if (!config)
|
2297
|
+
return FcFalse;
|
2298
|
+
}
|
2299
|
+
|
2300
|
+
dirs = FcStrSetCreateEx (FCSS_GROW_BY_64);
|
2301
|
+
if (!dirs)
|
2302
|
+
return FcFalse;
|
2303
|
+
|
2304
|
+
set = FcConfigGetFonts (config, FcSetApplication);
|
2305
|
+
if (!set)
|
2306
|
+
{
|
2307
|
+
set = FcFontSetCreate ();
|
2308
|
+
if (!set)
|
2309
|
+
{
|
2310
|
+
FcStrSetDestroy (dirs);
|
2311
|
+
return FcFalse;
|
2312
|
+
}
|
2313
|
+
FcConfigSetFonts (config, set, FcSetApplication);
|
2314
|
+
}
|
2315
|
+
|
2316
|
+
FcStrSetAddFilename (dirs, dir);
|
2317
|
+
|
2318
|
+
if (!FcConfigAddDirList (config, FcSetApplication, dirs))
|
2319
|
+
{
|
2320
|
+
FcStrSetDestroy (dirs);
|
2321
|
+
return FcFalse;
|
2322
|
+
}
|
2323
|
+
FcStrSetDestroy (dirs);
|
2324
|
+
return FcTrue;
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
void
|
2328
|
+
FcConfigAppFontClear (FcConfig *config)
|
2329
|
+
{
|
2330
|
+
if (!config)
|
2331
|
+
{
|
2332
|
+
config = FcConfigGetCurrent ();
|
2333
|
+
if (!config)
|
2334
|
+
return;
|
2335
|
+
}
|
2336
|
+
|
2337
|
+
FcConfigSetFonts (config, 0, FcSetApplication);
|
2338
|
+
}
|
2339
|
+
|
2340
|
+
/*
|
2341
|
+
* Manage filename-based font source selectors
|
2342
|
+
*/
|
2343
|
+
|
2344
|
+
FcBool
|
2345
|
+
FcConfigGlobAdd (FcConfig *config,
|
2346
|
+
const FcChar8 *glob,
|
2347
|
+
FcBool accept)
|
2348
|
+
{
|
2349
|
+
FcStrSet *set = accept ? config->acceptGlobs : config->rejectGlobs;
|
2350
|
+
|
2351
|
+
return FcStrSetAdd (set, glob);
|
2352
|
+
}
|
2353
|
+
|
2354
|
+
static FcBool
|
2355
|
+
FcConfigGlobsMatch (const FcStrSet *globs,
|
2356
|
+
const FcChar8 *string)
|
2357
|
+
{
|
2358
|
+
int i;
|
2359
|
+
|
2360
|
+
for (i = 0; i < globs->num; i++)
|
2361
|
+
if (FcStrGlobMatch (globs->strs[i], string))
|
2362
|
+
return FcTrue;
|
2363
|
+
return FcFalse;
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
FcBool
|
2367
|
+
FcConfigAcceptFilename (FcConfig *config,
|
2368
|
+
const FcChar8 *filename)
|
2369
|
+
{
|
2370
|
+
if (FcConfigGlobsMatch (config->acceptGlobs, filename))
|
2371
|
+
return FcTrue;
|
2372
|
+
if (FcConfigGlobsMatch (config->rejectGlobs, filename))
|
2373
|
+
return FcFalse;
|
2374
|
+
return FcTrue;
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
/*
|
2378
|
+
* Manage font-pattern based font source selectors
|
2379
|
+
*/
|
2380
|
+
|
2381
|
+
FcBool
|
2382
|
+
FcConfigPatternsAdd (FcConfig *config,
|
2383
|
+
FcPattern *pattern,
|
2384
|
+
FcBool accept)
|
2385
|
+
{
|
2386
|
+
FcFontSet *set = accept ? config->acceptPatterns : config->rejectPatterns;
|
2387
|
+
|
2388
|
+
return FcFontSetAdd (set, pattern);
|
2389
|
+
}
|
2390
|
+
|
2391
|
+
static FcBool
|
2392
|
+
FcConfigPatternsMatch (const FcFontSet *patterns,
|
2393
|
+
const FcPattern *font)
|
2394
|
+
{
|
2395
|
+
int i;
|
2396
|
+
|
2397
|
+
for (i = 0; i < patterns->nfont; i++)
|
2398
|
+
if (FcListPatternMatchAny (patterns->fonts[i], font))
|
2399
|
+
return FcTrue;
|
2400
|
+
return FcFalse;
|
2401
|
+
}
|
2402
|
+
|
2403
|
+
FcBool
|
2404
|
+
FcConfigAcceptFont (FcConfig *config,
|
2405
|
+
const FcPattern *font)
|
2406
|
+
{
|
2407
|
+
if (FcConfigPatternsMatch (config->acceptPatterns, font))
|
2408
|
+
return FcTrue;
|
2409
|
+
if (FcConfigPatternsMatch (config->rejectPatterns, font))
|
2410
|
+
return FcFalse;
|
2411
|
+
return FcTrue;
|
2412
|
+
}
|
2413
|
+
|
2414
|
+
const FcChar8 *
|
2415
|
+
FcConfigGetSysRoot (const FcConfig *config)
|
2416
|
+
{
|
2417
|
+
if (!config)
|
2418
|
+
{
|
2419
|
+
config = FcConfigGetCurrent ();
|
2420
|
+
if (!config)
|
2421
|
+
return NULL;
|
2422
|
+
}
|
2423
|
+
|
2424
|
+
return config->sysRoot;
|
2425
|
+
}
|
2426
|
+
|
2427
|
+
void
|
2428
|
+
FcConfigSetSysRoot (FcConfig *config,
|
2429
|
+
const FcChar8 *sysroot)
|
2430
|
+
{
|
2431
|
+
FcChar8 *s = NULL;
|
2432
|
+
FcBool init = FcFalse;
|
2433
|
+
|
2434
|
+
if (!config)
|
2435
|
+
{
|
2436
|
+
/* We can't use FcConfigGetCurrent() here to ensure
|
2437
|
+
* the sysroot is set prior to initialize FcConfig,
|
2438
|
+
* to avoid loading caches from non-sysroot dirs.
|
2439
|
+
* So postpone the initialization later.
|
2440
|
+
*/
|
2441
|
+
config = fc_atomic_ptr_get (&_fcConfig);
|
2442
|
+
if (!config)
|
2443
|
+
{
|
2444
|
+
config = FcConfigCreate ();
|
2445
|
+
if (!config)
|
2446
|
+
return;
|
2447
|
+
init = FcTrue;
|
2448
|
+
}
|
2449
|
+
}
|
2450
|
+
|
2451
|
+
if (sysroot)
|
2452
|
+
{
|
2453
|
+
s = FcStrCopyFilename (sysroot);
|
2454
|
+
if (!s)
|
2455
|
+
return;
|
2456
|
+
}
|
2457
|
+
|
2458
|
+
if (config->sysRoot)
|
2459
|
+
FcStrFree (config->sysRoot);
|
2460
|
+
|
2461
|
+
config->sysRoot = s;
|
2462
|
+
if (init)
|
2463
|
+
{
|
2464
|
+
config = FcInitLoadOwnConfigAndFonts (config);
|
2465
|
+
FcConfigSetCurrent (config);
|
2466
|
+
/* FcConfigSetCurrent() increases the refcount.
|
2467
|
+
* decrease it here to avoid the memory leak.
|
2468
|
+
*/
|
2469
|
+
FcConfigDestroy (config);
|
2470
|
+
}
|
2471
|
+
}
|
2472
|
+
|
2473
|
+
FcRuleSet *
|
2474
|
+
FcRuleSetCreate (const FcChar8 *name)
|
2475
|
+
{
|
2476
|
+
FcRuleSet *ret = (FcRuleSet *) malloc (sizeof (FcRuleSet));
|
2477
|
+
FcMatchKind k;
|
2478
|
+
const FcChar8 *p;
|
2479
|
+
|
2480
|
+
if (!name)
|
2481
|
+
p = (const FcChar8 *)"";
|
2482
|
+
else
|
2483
|
+
p = name;
|
2484
|
+
|
2485
|
+
if (ret)
|
2486
|
+
{
|
2487
|
+
ret->name = FcStrdup (p);
|
2488
|
+
ret->description = NULL;
|
2489
|
+
ret->domain = NULL;
|
2490
|
+
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
|
2491
|
+
ret->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleDestroy);
|
2492
|
+
FcRefInit (&ret->ref, 1);
|
2493
|
+
}
|
2494
|
+
|
2495
|
+
return ret;
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
void
|
2499
|
+
FcRuleSetDestroy (FcRuleSet *rs)
|
2500
|
+
{
|
2501
|
+
FcMatchKind k;
|
2502
|
+
|
2503
|
+
if (!rs)
|
2504
|
+
return;
|
2505
|
+
if (FcRefDec (&rs->ref) != 1)
|
2506
|
+
return;
|
2507
|
+
|
2508
|
+
if (rs->name)
|
2509
|
+
FcStrFree (rs->name);
|
2510
|
+
if (rs->description)
|
2511
|
+
FcStrFree (rs->description);
|
2512
|
+
if (rs->domain)
|
2513
|
+
FcStrFree (rs->domain);
|
2514
|
+
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
|
2515
|
+
FcPtrListDestroy (rs->subst[k]);
|
2516
|
+
|
2517
|
+
free (rs);
|
2518
|
+
}
|
2519
|
+
|
2520
|
+
void
|
2521
|
+
FcRuleSetReference (FcRuleSet *rs)
|
2522
|
+
{
|
2523
|
+
if (!FcRefIsConst (&rs->ref))
|
2524
|
+
FcRefInc (&rs->ref);
|
2525
|
+
}
|
2526
|
+
|
2527
|
+
void
|
2528
|
+
FcRuleSetEnable (FcRuleSet *rs,
|
2529
|
+
FcBool flag)
|
2530
|
+
{
|
2531
|
+
if (rs)
|
2532
|
+
{
|
2533
|
+
rs->enabled = flag;
|
2534
|
+
/* XXX: we may want to provide a feature
|
2535
|
+
* to enable/disable rulesets through API
|
2536
|
+
* in the future?
|
2537
|
+
*/
|
2538
|
+
}
|
2539
|
+
}
|
2540
|
+
|
2541
|
+
void
|
2542
|
+
FcRuleSetAddDescription (FcRuleSet *rs,
|
2543
|
+
const FcChar8 *domain,
|
2544
|
+
const FcChar8 *description)
|
2545
|
+
{
|
2546
|
+
if (rs->domain)
|
2547
|
+
FcStrFree (rs->domain);
|
2548
|
+
if (rs->description)
|
2549
|
+
FcStrFree (rs->description);
|
2550
|
+
|
2551
|
+
rs->domain = domain ? FcStrdup (domain) : NULL;
|
2552
|
+
rs->description = description ? FcStrdup (description) : NULL;
|
2553
|
+
}
|
2554
|
+
|
2555
|
+
int
|
2556
|
+
FcRuleSetAdd (FcRuleSet *rs,
|
2557
|
+
FcRule *rule,
|
2558
|
+
FcMatchKind kind)
|
2559
|
+
{
|
2560
|
+
FcPtrListIter iter;
|
2561
|
+
FcRule *r;
|
2562
|
+
int n = 0, ret;
|
2563
|
+
|
2564
|
+
if (!rs ||
|
2565
|
+
kind < FcMatchKindBegin || kind >= FcMatchKindEnd)
|
2566
|
+
return -1;
|
2567
|
+
FcPtrListIterInitAtLast (rs->subst[kind], &iter);
|
2568
|
+
if (!FcPtrListIterAdd (rs->subst[kind], &iter, rule))
|
2569
|
+
return -1;
|
2570
|
+
|
2571
|
+
for (r = rule; r; r = r->next)
|
2572
|
+
{
|
2573
|
+
switch (r->type)
|
2574
|
+
{
|
2575
|
+
case FcRuleTest:
|
2576
|
+
if (r->u.test &&
|
2577
|
+
r->u.test->kind == FcMatchDefault)
|
2578
|
+
r->u.test->kind = kind;
|
2579
|
+
|
2580
|
+
if (n < r->u.test->object)
|
2581
|
+
n = r->u.test->object;
|
2582
|
+
break;
|
2583
|
+
case FcRuleEdit:
|
2584
|
+
if (n < r->u.edit->object)
|
2585
|
+
n = r->u.edit->object;
|
2586
|
+
break;
|
2587
|
+
default:
|
2588
|
+
break;
|
2589
|
+
}
|
2590
|
+
}
|
2591
|
+
if (FcDebug () & FC_DBG_EDIT)
|
2592
|
+
{
|
2593
|
+
printf ("Add Rule(kind:%d, name: %s) ", kind, rs->name);
|
2594
|
+
FcRulePrint (rule);
|
2595
|
+
}
|
2596
|
+
ret = FC_OBJ_ID (n) - FC_MAX_BASE_OBJECT;
|
2597
|
+
|
2598
|
+
return ret < 0 ? 0 : ret;
|
2599
|
+
}
|
2600
|
+
|
2601
|
+
void
|
2602
|
+
FcConfigFileInfoIterInit (FcConfig *config,
|
2603
|
+
FcConfigFileInfoIter *iter)
|
2604
|
+
{
|
2605
|
+
FcConfig *c;
|
2606
|
+
FcPtrListIter *i = (FcPtrListIter *)iter;
|
2607
|
+
|
2608
|
+
if (!config)
|
2609
|
+
c = FcConfigGetCurrent ();
|
2610
|
+
else
|
2611
|
+
c = config;
|
2612
|
+
FcPtrListIterInit (c->rulesetList, i);
|
2613
|
+
}
|
2614
|
+
|
2615
|
+
FcBool
|
2616
|
+
FcConfigFileInfoIterNext (FcConfig *config,
|
2617
|
+
FcConfigFileInfoIter *iter)
|
2618
|
+
{
|
2619
|
+
FcConfig *c;
|
2620
|
+
FcPtrListIter *i = (FcPtrListIter *)iter;
|
2621
|
+
|
2622
|
+
if (!config)
|
2623
|
+
c = FcConfigGetCurrent ();
|
2624
|
+
else
|
2625
|
+
c = config;
|
2626
|
+
if (FcPtrListIterIsValid (c->rulesetList, i))
|
2627
|
+
{
|
2628
|
+
FcPtrListIterNext (c->rulesetList, i);
|
2629
|
+
}
|
2630
|
+
else
|
2631
|
+
return FcFalse;
|
2632
|
+
|
2633
|
+
return FcTrue;
|
2634
|
+
}
|
2635
|
+
|
2636
|
+
FcBool
|
2637
|
+
FcConfigFileInfoIterGet (FcConfig *config,
|
2638
|
+
FcConfigFileInfoIter *iter,
|
2639
|
+
FcChar8 **name,
|
2640
|
+
FcChar8 **description,
|
2641
|
+
FcBool *enabled)
|
2642
|
+
{
|
2643
|
+
FcConfig *c;
|
2644
|
+
FcRuleSet *r;
|
2645
|
+
FcPtrListIter *i = (FcPtrListIter *)iter;
|
2646
|
+
|
2647
|
+
if (!config)
|
2648
|
+
c = FcConfigGetCurrent ();
|
2649
|
+
else
|
2650
|
+
c = config;
|
2651
|
+
if (!FcPtrListIterIsValid (c->rulesetList, i))
|
2652
|
+
return FcFalse;
|
2653
|
+
r = FcPtrListIterGetValue (c->rulesetList, i);
|
2654
|
+
if (name)
|
2655
|
+
*name = FcStrdup (r->name && r->name[0] ? r->name : (const FcChar8 *) "fonts.conf");
|
2656
|
+
if (description)
|
2657
|
+
*description = FcStrdup (!r->description ? _("No description") :
|
2658
|
+
dgettext (r->domain ? (const char *) r->domain : GETTEXT_PACKAGE "-conf",
|
2659
|
+
(const char *) r->description));
|
2660
|
+
if (enabled)
|
2661
|
+
*enabled = r->enabled;
|
2662
|
+
|
2663
|
+
return FcTrue;
|
2664
|
+
}
|
2665
|
+
|
2666
|
+
#define __fccfg__
|
2667
|
+
#include "fcaliastail.h"
|
2668
|
+
#undef __fccfg__
|