From: Keith Packard Date: Sun, 3 Sep 2006 23:07:11 +0000 (-0700) Subject: Merge branch 'fc-2_4_branch' to master X-Git-Tag: 2.3.97~14 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=822ec78c54a24a0f1589154ac2d4906b02b111ef;hp=e79c648c7a27a1afdde813105d0727e3ee6bc9fd;p=fontconfig.git Merge branch 'fc-2_4_branch' to master Moving development back to master. --- diff --git a/.cvsignore b/.cvsignore index 3eb8520..cef4538 100644 --- a/.cvsignore +++ b/.cvsignore @@ -9,6 +9,7 @@ config.log config.status config.sub configure +debian depcomp fontconfig.pc fontconfig.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..255a1f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,76 @@ +tags +*.tar.gz +.libs +.deps +*.o +*.lo +*.la +ChangeLog +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +depcomp +fontconfig-zip +fontconfig.pc +fontconfig.spec +fonts.conf +install-sh +libtool +ltmain.sh +missing +stamp-h1 +doc/*.3 +doc/confdir.sgml +doc/edit-sgml +doc/fcatomic.sgml +doc/fcblanks.sgml +doc/fccharset.sgml +doc/fcconfig.sgml +doc/fcconstant.sgml +doc/fcfile.sgml +doc/fcfontset.sgml +doc/fcfreetype.sgml +doc/fcinit.sgml +doc/fcmatrix.sgml +doc/fcobjectset.sgml +doc/fcobjecttype.sgml +doc/fcpattern.sgml +doc/fcstring.sgml +doc/fcstrset.sgml +doc/fcvalue.sgml +doc/fontconfig-devel.pdf +doc/fontconfig-devel.txt +doc/fontconfig-devel +doc/fontconfig-user.html +doc/fontconfig-user.pdf +doc/fontconfig-user.txt +doc/fonts-conf.5 +doc/func.refs +doc/local-fontconfig-devel.sgml +doc/local-fontconfig-user.sgml +doc/version.sgml +fc-arch/fc-arch +fc-arch/fcarch.h +fc-cache/fc-cache +fc-cache/fc-cache.1 +fc-case/fc-case +fc-case/fccase.h +fc-cat/fc-cat +fc-cat/fc-cat.1 +fc-glyphname/fc-glyphname +fc-glyphname/fcglyphname.h +fc-lang/fc-lang +fc-lang/fclang.h +fc-list/fc-list +fc-list/fc-list.1 +fc-match/fc-match +fc-match/fc-match.1 +src/fontconfig.def diff --git a/AUTHORS b/AUTHORS index 9cee037..5ef8885 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,3 @@ Keith Packard +Patrick Lam + diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 1e86386..0000000 --- a/ChangeLog +++ /dev/null @@ -1,1613 +0,0 @@ -2006-03-22 Patrick Lam - * src/fcatomic.c: - - On Windows, unlink before rename. Reported by Tim Evans. - -2006-03-08 Egmont Koblinger - reviewed by: plam - - * src/fcdir.c (FcDirScanConfig): - - Sort directory entries while scanning them from disk; - prevents Heisenbugs due to file ordering in a directory. - -2005-12-13 Carl Worth - reviewed by: keithp - - * conf.d/Makefile.am: - * conf.d/10LohitGujarati.conf: Add a configuration file that - disables hinting for the Lohit Gujarati font (since the hinting - distort some glyphs quite badly). - -2005-11-23 Frederic Crozat : - reviewed by: plam - - * fc-match/fc-match.c (main): - - Make getopt_long accept -s parameter to fc-match as well. - -2005-10-05 Christian Biesinger - reviewed by: plam & keithp - - * src/Makefile.am: - - Use libtool -no-undefined flag on all platforms. - -2005-10-05 Simos Xenitellis - reviewed by: plam & keithp - - * fonts.conf.in: - - Modify config file to use Greek fonts before Asian fonts with - Greek glyphs. - -2005-07-25 Keith Packard - - * doc/fontconfig-user.sgml: - * fc-glyphname/fc-glyphname.c: (scan), (main): - * fc-lang/fc-lang.c: (FcConfigHome): - * fc-match/fc-match.c: (main): - * src/fccfg.c: (FcConfigHome): - * src/fcfreetype.c: (FcSfntNameTranscode), (FcSfntNameLanguage), - (FcVendorMatch), (FcFreeTypeQuery), (FcFreeTypeCharSetAndSpacing), - (addtag), (FcFontCapabilities): - * src/fcpat.c: (FcValueListEntCreate): - * src/fcstr.c: (FcStrCaseWalkerInit): - * src/fcxml.c: (FcParsePatelt), (FcConfigParseAndLoadDir): - - Various GCC 4 cleanups for signed vs unsigned char - - Match only [0-9]*.conf files in {directory} - elements to avoid loading *.rpmsave or .dpkg-old files. (otaylor) - -2005-07-15 Carl Worth - - * src/fcint.h: - * src/fcinit.c: (FcFini): - * src/fcpat.c: (FcPatternFini): Rename FcPatternThawAll to - FcPatternFini. - - * src/fcpat.c: (FcObjectStaticName), (FcObjectStaticNameFini): - Pull the FcObjectStateName hash table out to file scope, and add - FcObjectStaticNameFini so that FcFini will cleanup this hash table - as well. - - * src/fcxml.c: (FcConfigParseAndLoad): Clear FILE* to NULL after - fclose. - -2005-06-16 Patrick Lam - - reviewed by: keithp - - * src/fccfg.c: (FcConfigCompareValue): - Make FcOpNotContains use FcStrStr for strings so that - it matches semantics for !FcOpContains. - -2005-05-20 Keith Packard - - * debian/changelog: - * debian/control: - Move fontconfig source package to libs as per override - -2005-05-20 Aiet Kolkhi - - reviewed by: Mike Fabian - - * fc-lang/ka.orth: - The ka.orth file requires several characters which are not - used anymore in modern Georgian and which are missing in the free - Georgian TrueType fonts downloadable at: - - http://aiet.qartuli.net/docs/georgian_on_linux_en.php - -2005-04-27 Keith Packard - - * README: - * debian/changelog: - Update date to real 2.3.2 release date. - Fix change attributions - -2005-04-27 Keith Packard - - * configure.in: - Bump so revision for 2.3.2 - * fc-cache/fc-cache.c: (scanDirs): - Fix a few minor leaks in error cases. - -2005-04-23 Keith Packard - - * README: - * configure.in: - * debian/changelog: - * fontconfig/fontconfig.h: - Update for version 2.3.2 - -2005-04-21 Keith Packard - - * debian/fontconfig.postinst: - Don't force bitmap font enable in default - configuration; allows users to override this in - ~/.fonts.conf - * debian/po/cs.po: - * debian/po/da.po: - * debian/po/de.po: - * debian/po/es.po: - * debian/po/fr.po: - * debian/po/ja.po: - * debian/po/nl.po: - * debian/po/pt.po: - * debian/po/pt_BR.po: - * debian/po/templates.pot: - * debian/po/tr.po: - * debian/po/zh_CN.po: - Updated translations - - * fc-cache/fc-cache.c: (main): - Destroy font configuration on exit to help valgrind - - * fonts.conf.in: - * src/fcfreetype.c: (FcSfntNameTranscode), (FcFreeTypeCharIndex), - (FcFreeTypeCheckGlyph): - Use own transcoding routines in preference to iconv - which appears to have leaks in some translators. - Call iconv_close after using iconv (oops). - - Prefer unicode encoding of Euro char as some - fonts mis-encode Euro in other ones. - - Must fetch bitmap glyphs to get width values - to check for monospace/dual-width fonts. - -2005-04-13 Ross Burton - - * src/fcpat.c: - Check that a pattern isn't already frozen in FcPatternFreeze. - -2005-03-31 Ross Burton - - * src/fclist.c: - * src/fcmatch.c: - * src/fcpat.c: - Run all FcPattern objects through FcObjectStaticName, so that - compares can be done on pointers instead of strings (#2659) - -2005-03-17 Tor Lillqvist - - * src/fontconfig.def.in: Add the .dll to the dll name. - -2005-03-10 Keith Packard - - * debian/README.Debian: - Update to reflect configuration changes - * debian/changelog: - * debian/fontconfig.postinst: - Fix Autohint vs Autohinter mistake - * debian/fontconfig.templates: - Adopt changes from Josselin Mouette for configuration descriptions - Update debian to version 2.3.1-2 - -2005-03-08 Keith Packard - - * debian/changelog: - * debian/rules: - Update debian for 2.3.1 - -2005-03-09 Tor Lillqvist - - * fontconfig-zip.in: Get the DLL from "bin" where modern libtools - put it, not "lib". - - * src/fccfg.c (FcConfigFileExists): Check also drive letter - prefix on Win32. - -2005-03-08 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update for 2.3.1 - -2005-03-05 Keith Packard - - * src/fcfreetype.c: (addtag), (FcFontCapabilities): - Include space and remove numbers from valid script tags. - This ensures that tags like 'lao ' work while rejecting - those which have any digits. - Eliminate a spurious debugging variable (len) - -2005-03-05 Keith Packard - - * src/fcfreetype.c: (addtag), (GetScriptTags), - (FcFontCapabilities): - Rework GSUB/GPOS script parsing to survive broken fonts. - Thanks for the broken font go to Manish Singh - -2005-03-05 Keith Packard - - Josselin Mouette: - * debian/changelog: - * debian/control: - * debian/fontconfig.config: - * debian/fontconfig.templates: - * debian/rules: - Include 2.3 release information in changelog - Add Josselin Mouette as an Uploader - Set hinting_type to low priority configuration option - - Manish Singh: - * debian/fontconfig.postinst: - yes_bitmaps.conf -> yes-bitmaps.conf - - Funda Wang: - * src/fcfreetype.c: - Johap -> Johab - -2005-03-02 Keith Packard - - * Makefile.am: - * conf.d/Makefile.am: - * conf.d/autohint.conf: - * conf.d/no-sub-pixel.conf: - * conf.d/sub-pixel.conf: - * conf.d/unhinted.conf: - * debian/autohint.conf: - * debian/fontconfig.install: - * debian/fontconfig.postinst: - * debian/fontconfig.templates: - * debian/no-sub-pixel.conf: - * debian/unhinted.conf: - Move debian-specific conf file examples upstream. - - Sub-pixel configuration examples must smash subpixel value - as Xft always sets it from X. - - Change sub-pixel rendering debconf descriptions from - Enable/Disable to Always/Never. - -2005-03-02 Keith Packard - - * .cvsignore: - * conf.d/.cvsignore: - * doc/.cvsignore: - Ignore more build detritus - - * Makefile.am: - Add debian package construction stuff. - - * config/config.guess: - * config/config.sub: - Update to newer versions of these tools - - * doc/Makefile.am: - Get library manuals to build again (we love automake). - - * debian/README.Debian: - * debian/autohint.conf: - * debian/changelog: - * debian/compat: - * debian/control: - * debian/copyright: - * debian/fontconfig-udeb.install: - * debian/fontconfig.config: - * debian/fontconfig.defoma: - * debian/fontconfig.dirs: - * debian/fontconfig.install: - * debian/fontconfig.postinst: - * debian/fontconfig.postrm: - * debian/fontconfig.templates: - * debian/libfontconfig1-dev.install: - * debian/libfontconfig1.install: - * debian/local.conf.md5sum: - * debian/no-sub-pixel.conf: - * debian/po/POTFILES.in: - * debian/po/cs.po: - * debian/po/da.po: - * debian/po/de.po: - * debian/po/es.po: - * debian/po/fr.po: - * debian/po/ja.po: - * debian/po/nl.po: - * debian/po/pt.po: - * debian/po/pt_BR.po: - * debian/po/templates.pot: - * debian/po/tr.po: - * debian/po/zh_CN.po: - * debian/rules: - * debian/unhinted.conf: - Update debian build system to switch maintainers and - deal with 2.3 functionality - -2005-03-01 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update for 2.3.0 - -2005-03-01 Keith Packard - - * doc/Makefile.am: - Generate and install PDF versions of the manuals - - * doc/fcpattern.fncs: - Fix formatting - - * doc/fcstring.fncs: - Add missing exported functions, fix data types - - * doc/fontconfig-devel.sgml: - Add missing pattern elements. - - * doc/fontconfig-user.sgml: - Add missing pattern elements. Document conf.d usage, - clarify available orthography list. Fix some config file - attributes. Complete list of constants. - - * fontconfig/fontconfig.h: - Mark FC_SOURCE deprecated. - - * src/fcfreetype.c: (FcFreeTypeQuery): - Don't set FC_SOURCE any longer. - -2005-02-28 Keith Packard - - * Makefile.am: - * conf.d/Makefile.am: - * conf.d/README: - * conf.d/no-bitmaps.conf: - * conf.d/sub-pixel.conf: - * conf.d/yes-bitmaps.conf: - * configure.in: - Create prototype /etc/fonts/conf.d directory with a few - sample configuration files. - Deprecate use of local.conf for local customizations in favor of - this directory based scheme which is more easily integrated into - installation systems. - - * src/fcname.c: - Tag FC_EMBOLDEN as a boolean variable - -2005-02-10 Keith Packard - - reviewed by: pborelli@katamail.com - - * src/fcdir.c: (FcFileScanConfig): - Free patterns from fonts which are rejected by configuration - (bug #2518) - -2005-01-28 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update for version 2.2.99 - -2005-01-28 Keith Packard - - * README: - Add a few pointers (#2284, #2285) - -2005-01-28 Keith Packard - - * src/fcint.h: - * src/fcname.c: (FcNameBool): - * src/fcxml.c: (FcTypeName), (FcTypecheckValue), (FcTypecheckExpr), - (FcTestCreate), (FcEditCreate), (FcConfigLexBool), (FcParseBool), - (FcParseAlias), (FcParseInclude), (FcParseTest), (FcParseEdit): - Polite typechecking for test and edit expressions. Helps - catch errors in the font configuration. (bug 229) - -2005-01-15 Alan Coopersmith - - reviewed by: Keith Packard - - * configure.in: - Have --with-expat set EXPAT_CFLAGS (bug 2278) - -2005-01-13 Keith Packard - - * doc/fontconfig-user.sgml: - Add SEE ALSO section (bug 2085) - -2005-01-13 J. Ali Harlow - - reviewed by: Keith Packard - - * Makefile.am: - * configure.in: - * doc/Makefile.am: - * fc-case/Makefile.am: - * fc-glyphname/Makefile.am: - * fc-lang/Makefile.am: - * src/fontconfig.def.in: - Cross compiling fixes (bug 280) - -2005-01-13 Keith Packard - - * fonts.conf.in: - Update blanks list (Closes bug 86) - -2005-01-04 Keith Packard - - * src/fccache.c: (FcCacheFontSetAdd): - Verify that every font pattern loaded from cache has - both FC_FILE and FC_FAMILY entries. - Attempt to fix bug #2219. - -2004-12-29 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update for version 2.2.98 - -2004-12-29 Keith Packard - - * fontconfig/fontconfig.h: - Document ASCII limitations of Fc character conversion macros - * src/fcstr.c: (FcStrCaseWalkerLong), (FcStrDowncase): - Fix off-by-one error in utf-8 case walking code. - Add FcStrDowncase (useful for testing case conversion functions) - -2004-12-29 Keith Packard - - * .cvsignore: - * fc-case/.cvsignore: - clean up CVS ignore lists - * fc-lang/iso-3166.txt: - Add territory database - -2004-12-29 Tor Andersson - - Reviewed by: Keith Packard - - * fc-lang/ko.orth: - Remove Han characters from Korean orthography - -2004-12-29 Keith Packard - - * Makefile.am: - Reorder utility programs to make sure fc-case is run before fc-lang - as fc-lang uses fcstr.c which uses fccase.h - * fonts.conf.in: - Fix broken XML - -2004-12-29 Keith Packard - - * fonts.conf.in: - Adopt some RedHat suggestions for standard font configuration. - - * Makefile.am: - * configure.in: - * fc-case/CaseFolding.txt: - * fc-case/Makefile.am: - * fc-case/fc-case.c: (panic), (addFold), (ucs4_to_utf8), - (utf8_size), (addChar), (foldExtends), (case_fold_method_name), - (dump), (parseRaw), (caseFoldReadRaw), (main): - * fc-case/fccase.tmpl.h: - Add new helper program 'fc-case' to construct case folding - tables from standard Unicode CaseFolding.txt file - - * src/fcint.h: - * src/fclist.c: (FcListValueHash): - * src/fcstr.c: (FcStrCaseWalkerInit), (FcStrCaseWalkerLong), - (FcStrCaseWalkerNext), (FcStrCaseWalkerNextIgnoreBlanks), - (FcStrCmpIgnoreCase), (FcStrCmpIgnoreBlanksAndCase), - (FcStrHashIgnoreCase), (FcStrIsAtIgnoreBlanksAndCase), - (FcStrIsAtIgnoreCase), (FcStrStrIgnoreCase): - Re-implement case insensitive functions with Unicode - aware versions (including full case folding mappings) - -2004-12-13 Keith Packard - - reviewed by: Owen Taylor - - * src/fcmatch.c: (FcFontSetSort): - I changed FcFontSetSort to respect the generic aliases better - in the face of language matching. - - What I did was to ammend the strict sort order used by FcFontSort so - that it 'satisfies' the language specified in the pattern by locating - the best matching font supporting each pattern language and then - ignores language in the remaining fonts for purposes of matching. - - So, when asking for 'sans:lang=en', you'll get an English font first, - and then the remaining fonts sorted with respect to the 'sans' alias - alone -- pushing Kochi fonts ahead of other English-supporting Han fonts. - -2004-12-10 Jakub Pavelek - - reviewed by: Keith Packard - - * fontconfig/fontconfig.h: - * fonts.conf.in: - - Configuration changes to request synthetic emboldening of - fonts. The actual emboldening code will live in Xft. - -2004-12-09 John Thacker - - reviewed by: Keith Packard - - * fc-lang/ru.orth: - - Currently Russian (ru) requires 0406 and 0456 (І and і), but these - were eliminated in Russian in 1918 in favor of 0418 and 0438 (И and - и), and don't even appear in KOI8-R. (The hypothesis that they - don't appear in KOI8-R due to their similarity with Latin I and i is - eliminated by their presence in KOI8-U.) I have a couple of fonts - with Russian support that don't have the letter. - - Therefore, 0406 and 0456 should be removed from or commented out of - ru.orth - -2004-12-06 michael meeks - - Reviewed by: Keith Packard - - * src/fcinit.c: (FcMemReport): - * src/fcint.h: - * src/fclist.c: (FcObjectSetAdd): - * src/fcpat.c: (FcValueListEntCreate), (FcPatternBaseFreeze), - (FcPatternInsertElt), (FcPatternEqual), (FcObjectStaticName): - * src/fcxml.c: (FcParsePatelt): - memoize strings and share a single copy for all uses. Note that - this could be improved further by using statically allocated blocks - and gluing multiple strings together, but I'm basically lazy. - In my environment with 800 font files, I get a savings of about 90KB. - -2004-12-06 Keith Packard - - * COPYING: - * Makefile.am: - * config/Makedefs.in: - * configure.in: - * doc/edit-sgml.c: - * doc/fcatomic.fncs: - * doc/fcblanks.fncs: - * doc/fccharset.fncs: - * doc/fcconfig.fncs: - * doc/fcconstant.fncs: - * doc/fcfile.fncs: - * doc/fcfontset.fncs: - * doc/fcfreetype.fncs: - * doc/fcinit.fncs: - * doc/fcmatrix.fncs: - * doc/fcobjectset.fncs: - * doc/fcobjecttype.fncs: - * doc/fcpattern.fncs: - * doc/fcstring.fncs: - * doc/fcstrset.fncs: - * doc/fcvalue.fncs: - * doc/fontconfig-devel.sgml: - * doc/fontconfig-user.sgml: - * doc/func.sgml: - * doc/version.sgml.in: - * fc-cache/Makefile.am: - * fc-cache/fc-cache.c: - * fc-glyphname/Makefile.am: - * fc-glyphname/fc-glyphname.c: - * fc-glyphname/fcglyphname.tmpl.h: - * fc-lang/Makefile.am: - * fc-lang/aa.orth: - * fc-lang/ab.orth: - * fc-lang/af.orth: - * fc-lang/am.orth: - * fc-lang/ar.orth: - * fc-lang/ast.orth: - * fc-lang/ava.orth: - * fc-lang/ay.orth: - * fc-lang/az.orth: - * fc-lang/az_ir.orth: - * fc-lang/ba.orth: - * fc-lang/bam.orth: - * fc-lang/be.orth: - * fc-lang/bg.orth: - * fc-lang/bh.orth: - * fc-lang/bho.orth: - * fc-lang/bi.orth: - * fc-lang/bin.orth: - * fc-lang/bn.orth: - * fc-lang/bo.orth: - * fc-lang/br.orth: - * fc-lang/bs.orth: - * fc-lang/bua.orth: - * fc-lang/ca.orth: - * fc-lang/ce.orth: - * fc-lang/ch.orth: - * fc-lang/chm.orth: - * fc-lang/chr.orth: - * fc-lang/co.orth: - * fc-lang/cs.orth: - * fc-lang/cu.orth: - * fc-lang/cv.orth: - * fc-lang/cy.orth: - * fc-lang/da.orth: - * fc-lang/de.orth: - * fc-lang/dz.orth: - * fc-lang/el.orth: - * fc-lang/en.orth: - * fc-lang/eo.orth: - * fc-lang/es.orth: - * fc-lang/et.orth: - * fc-lang/eu.orth: - * fc-lang/fa.orth: - * fc-lang/fc-lang.c: - * fc-lang/fc-lang.man: - * fc-lang/fclang.tmpl.h: - * fc-lang/fi.orth: - * fc-lang/fj.orth: - * fc-lang/fo.orth: - * fc-lang/fr.orth: - * fc-lang/ful.orth: - * fc-lang/fur.orth: - * fc-lang/fy.orth: - * fc-lang/ga.orth: - * fc-lang/gd.orth: - * fc-lang/gez.orth: - * fc-lang/gl.orth: - * fc-lang/gn.orth: - * fc-lang/gu.orth: - * fc-lang/gv.orth: - * fc-lang/ha.orth: - * fc-lang/haw.orth: - * fc-lang/he.orth: - * fc-lang/hi.orth: - * fc-lang/ho.orth: - * fc-lang/hr.orth: - * fc-lang/hu.orth: - * fc-lang/hy.orth: - * fc-lang/ia.orth: - * fc-lang/ibo.orth: - * fc-lang/id.orth: - * fc-lang/ie.orth: - * fc-lang/ik.orth: - * fc-lang/io.orth: - * fc-lang/is.orth: - * fc-lang/iso639-2: - * fc-lang/it.orth: - * fc-lang/iu.orth: - * fc-lang/ja.orth: - * fc-lang/ka.orth: - * fc-lang/kaa.orth: - * fc-lang/ki.orth: - * fc-lang/kk.orth: - * fc-lang/kl.orth: - * fc-lang/km.orth: - * fc-lang/kn.orth: - * fc-lang/ko.orth: - * fc-lang/kok.orth: - * fc-lang/ks.orth: - * fc-lang/ku.orth: - * fc-lang/ku_ir.orth: - * fc-lang/kum.orth: - * fc-lang/kv.orth: - * fc-lang/kw.orth: - * fc-lang/ky.orth: - * fc-lang/la.orth: - * fc-lang/lb.orth: - * fc-lang/lez.orth: - * fc-lang/lo.orth: - * fc-lang/lt.orth: - * fc-lang/lv.orth: - * fc-lang/mg.orth: - * fc-lang/mh.orth: - * fc-lang/mi.orth: - * fc-lang/mk.orth: - * fc-lang/ml.orth: - * fc-lang/mn.orth: - * fc-lang/mo.orth: - * fc-lang/mr.orth: - * fc-lang/mt.orth: - * fc-lang/my.orth: - * fc-lang/nb.orth: - * fc-lang/nds.orth: - * fc-lang/ne.orth: - * fc-lang/nl.orth: - * fc-lang/nn.orth: - * fc-lang/no.orth: - * fc-lang/ny.orth: - * fc-lang/oc.orth: - * fc-lang/om.orth: - * fc-lang/or.orth: - * fc-lang/os.orth: - * fc-lang/pl.orth: - * fc-lang/ps_af.orth: - * fc-lang/ps_pk.orth: - * fc-lang/pt.orth: - * fc-lang/rm.orth: - * fc-lang/ro.orth: - * fc-lang/ru.orth: - * fc-lang/sa.orth: - * fc-lang/sah.orth: - * fc-lang/sco.orth: - * fc-lang/se.orth: - * fc-lang/sel.orth: - * fc-lang/sh.orth: - * fc-lang/si.orth: - * fc-lang/sk.orth: - * fc-lang/sl.orth: - * fc-lang/sm.orth: - * fc-lang/sma.orth: - * fc-lang/smj.orth: - * fc-lang/smn.orth: - * fc-lang/sms.orth: - * fc-lang/so.orth: - * fc-lang/sq.orth: - * fc-lang/sr.orth: - * fc-lang/sv.orth: - * fc-lang/sw.orth: - * fc-lang/syr.orth: - * fc-lang/ta.orth: - * fc-lang/te.orth: - * fc-lang/tg.orth: - * fc-lang/th.orth: - * fc-lang/ti_er.orth: - * fc-lang/ti_et.orth: - * fc-lang/tig.orth: - * fc-lang/tk.orth: - * fc-lang/tl.orth: - * fc-lang/tn.orth: - * fc-lang/to.orth: - * fc-lang/tr.orth: - * fc-lang/ts.orth: - * fc-lang/tt.orth: - * fc-lang/tw.orth: - * fc-lang/tyv.orth: - * fc-lang/ug.orth: - * fc-lang/uk.orth: - * fc-lang/ur.orth: - * fc-lang/uz.orth: - * fc-lang/ven.orth: - * fc-lang/vi.orth: - * fc-lang/vo.orth: - * fc-lang/vot.orth: - * fc-lang/wa.orth: - * fc-lang/wen.orth: - * fc-lang/wo.orth: - * fc-lang/xh.orth: - * fc-lang/yap.orth: - * fc-lang/yi.orth: - * fc-lang/yo.orth: - * fc-lang/zh_cn.orth: - * fc-lang/zh_hk.orth: - * fc-lang/zh_mo.orth: - * fc-lang/zh_sg.orth: - * fc-lang/zh_tw.orth: - * fc-lang/zu.orth: - * fc-list/Makefile.am: - * fc-list/fc-list.c: - * fc-match/Makefile.am: - * fc-match/fc-match.1: - * fc-match/fc-match.c: - * fontconfig/fcfreetype.h: - * fontconfig/fcprivate.h: - * fontconfig/fontconfig.h: - * src/fcatomic.c: - * src/fcblanks.c: - * src/fccache.c: - * src/fccfg.c: - * src/fccharset.c: - * src/fcdbg.c: - * src/fcdefault.c: - * src/fcdir.c: - * src/fcfreetype.c: - * src/fcfs.c: - * src/fcinit.c: - * src/fcint.h: - * src/fclang.c: - * src/fclist.c: - * src/fcmatch.c: - * src/fcmatrix.c: - * src/fcname.c: - * src/fcpat.c: - * src/fcstr.c: - * src/fcxml.c: - Change files from ISO-Latin-1 to UTF-8 - -2004-12-04 Keith Packard - - * INSTALL: - Update links to new freedesktop.org locations - * Makefile.am: - Add uninstall-local to get rid of fonts.conf and local.conf if they - match the distributed versions. Fixes 'make distcheck' - -2004-12-04 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Updates for version 2.2.97 - -2004-12-04 Owen Taylor - - reviewed by: Keith Packard - - * fc-cache/fc-cache.c: (main): - Sleep for two seconds before exiting to make sure timestamps - for future changes have distinct mod times in the file system. - Bug #1982. - * fc-lang/pa.orth: - Add Punjabi orthography. Bug #1671. - -2004-12-04 Keith Packard - - * fonts.conf.in: - Just remove the FC_FONTDATE -- it has locale issues and - annoys redhat multi-arch installs. Now that all X fonts are - included without prejudice, the chances of the date being at - all interesting are rather limited. Bug #505. - * src/Makefile.am: - Add copyright and license - -2004-12-04 Keith Packard - - * configure.in: - Change default set of fonts to include all of - /usr/X11R6/lib/X11/fonts (or wherever the X fonts are located). - * doc/fontconfig-user.sgml: - Document new directory-name semantics - * fonts.conf.in: - add conf.d - * local.conf: - Add selectfont to ignore bitmap fonts, add comment for - selectfont which accepts bitmap fonts. - * src/fcdir.c: - * src/fcint.h: - * src/fcxml.c: (FcConfigParseAndLoadDir), (FcConfigParseAndLoad): - Allow configuration elements to reference directories. - Parse and load all files of the form [0-9]* in sorted order. - -2004-12-04 Keith Packard - - * autogen.sh: - Report command line for $srcdir/configure accurately. - Bug #212. - -2004-12-04 Keith Packard - - * src/fcfreetype.c: (FcFreeTypeQuery): - Check for non-empty face->family_name and face->style_name - before using those for the font. Empty names match everything. - Bug #210. - -2004-12-04 Keith Packard - - * configure.in: - * fontconfig/fontconfig.h: - * src/fcfreetype.c: (FcFreeTypeQuery): - * src/fcname.c: - Create FC_FONTFORMAT from FT_Get_X11_Font_Format function where - available. This provides font file format information (BDF, Type 1, - PCF, TrueType) for each font. Closes #109. - -2004-12-04 Daniel Glassey - - reviewed by: Keith Packard - - * doc/fontconfig-user.sgml: - Fix typo. - - * fontconfig/fontconfig.h: - * src/fcfreetype.c: (FcFreeTypeQuery), (addtag), (compareulong), - (GetScriptTags), (FcFontCapabilities): - * src/fcname.c: - Add detection for font capabilities (bug #105) - -2004-12-04 Keith Packard - - * Makefile.am: - Move existing fonts.conf to fonts.conf.bak - - * configure.in: - Add detection of iconv - - * doc/fcpattern.fncs: - * doc/fontconfig-devel.sgml: - * doc/fontconfig-user.sgml: - * fonts.dtd: - Document new selectfont elements - - * fc-lang/nb.orth: - Switch to UTF-8 in comment - - * fontconfig/fontconfig.h: - * src/fcname.c: - Add fullname, and family/style/fullname language entries - - * src/fccache.c: (FcCacheFontSetAdd): - * src/fcdir.c: (FcFileScanConfig): - Respect selectfont/*/glob - - * src/fcint.h: - * src/fccfg.c: (FcConfigCreate), (FcConfigDestroy), - (FcConfigCompareValue), (FcConfigPatternsAdd), - (FcConfigPatternsMatch), (FcConfigAcceptFont): - * src/fcxml.c: (FcElementMap), (FcVStackDestroy), - (FcVStackPushPattern), (FcPopExpr), (FcParseAcceptRejectFont), - (FcPopValue), (FcParsePatelt), (FcParsePattern), (FcEndElement): - Add support for selectfont - - * src/fcfreetype.c: (FcSfntNameTranscode), (FcSfntNameLanguage), - (FcStringInPatternElement), (FcFreeTypeQuery): - Add multi-lingual family/style/fullname support - - * src/fclist.c: (FcListPatternMatchAny): - Expose FcListPatternMatchAny (which selectfont/*/pattern uses) - - * src/fcpat.c: (FcPatternRemove), (FcPatternAppend), - (FcObjectStaticName): - Add new FcPatternRemove/FcPatternAppend. - FcObjectStaticName stores computed pattern element names which - are required to be static. - -2004-09-09 "NAKAMURA Ken'ichi" - - reviewed by: keithp - - * Makefile.am: - Remove spurious / after $(DESTDIR) - -2004-06-30 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update for 2.2.96 - -2004-06-30 Keith Packard - - Provided by: Lubos Lunak - - * src/fccfg.c: (FcConfigUptoDate): - However FcConfigUptoDate() doesn't seem to work. See the attached - patch. First there's an obvious misplaced parenthesis making it - return always false, and second, even this call fails to detect font - changes (e.g. adding a new font to - /usr/X11R6/lib/X11/fonts/truetype). The patch should fix that as - well. The problem seems to be triggered by my fonts.conf specifying - only /usr/X11R6/lib/X11/fonts , and therefore config->configDirs - doesn't include subdirs, unlike config->fontDirs. - -2004-06-03 Keith Packard - - * fontconfig/fontconfig.h: - Remove comma at end of FcResult enum definition. - -2004-05-29 Keith Packard - - * INSTALL: - Add steps to md5sum release - -2004-05-29 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update for 2.2.95 - -2004-05-29 Keith Packard - - * fontconfig/fontconfig.h: - * src/fcmatch.c: (FcFontSetMatch): - Add FcResultOutOfMemory to provide an accurate error when - FcFontSetMatch fails in this way - - * src/fcfreetype.c: - Make #warning about lacking various FreeType features indicate - which version those features appeared so users know how to - fix the problem (Thanks to Anton Tropashko) - -2004-05-05 Keith Packard - - * src/fcfreetype.c: (FcFreeTypeCharSetAndSpacing): - Replace MIN/MAX/ABS macros which happen to have come - from FreeType with fontconfig-specific ones (FC_*) - -2004-04-23 Keith Packard - - * INSTALL: - Extend release preparation instructions to include - notification and distribution steps - -2004-04-23 Keith Packard - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update to 2.2.94 (2.2.93 shipped with broken libtool bits) - -2004-04-23 Keith Packard - - * .cvsignore: - Ignore a few more autotool files - -2004-04-14 Keith Packard - - * INSTALL: - Add instructions for doing a release - - * fontconfig.spec.in: - clean up .spec file; perhaps this will be useful to somebody... - - * README: - * configure.in: - * fontconfig/fontconfig.h: - Update to 2.2.93 - - * fc-lang/fc-lang.c: - Make 'scanopen' static so GCC doesn't whine about lacking prototype - - * fc-glyphname/Makefile.am: - * fc-lang/Makefile.am: - * fc-list/Makefile.am: - * fc-match/Makefile.am: - * src/Makefile.am: - Add WARN_CFLAGS to pass -W flags for GCC systems - - * src/fcfreetype.c: (FcNoticeFoundry), (FcVendorMatch), - (FcVendorFoundry), (FcGetPixelSize), (FcFreeTypeQuery): - Change various char types around to match across - function calls. - Fixed bug in using available_sizes[i].height which - is in pixels, not 64ths of a pixel. - -2004-03-06 Keith Packard - - * src/fcfreetype.c: (FcFreeTypeQuery): - Force FC_FOUNDRY and FC_WIDTH to always be set so that - matches looking for explicit values prefer exact matches - -2004-03-02 Keith Packard - - Supplied by: mfabian@suse.de (Mike FABIAN) - - * src/fcfreetype.c: (FcFreeTypeQuery): - Bug #260 fc-cache generates wrong spacing values for bitmap fonts - Was using (strcmp (a,b)) instead of (!strcmp(a,b)). - -2004-02-21 Manish Singh - - * fc-glyphname/fc-glyphname.c: (main): - Cast strlen to int for printf, so we're 64-bit clean. - -2004-02-11 Keith Packard - - * configure.in: - * src/fcfreetype.c: (FcGetPixelSize): - Ok, so I messed up the test for y_ppem. Let's see if I - got it right this time. - -2004-02-10 Keith Packard - - * configure.in: - * src/fcfreetype.c: (FcGetPixelSize): - Pre-2.1.5 versions of FreeType didn't include y_ppem in the - FT_Bitmap_Size record. Add a configure.in test for this - and change the code accordingly (using height instead). - -2004-02-06 Keith Packard - - * fc-lang/nds.orth: - Add Low Saxon orthography - (Kenneth Rohde Christiansen ) - - * src/fccfg.c: (FcConfigNewestFile): - Oops. Left 'newest.set' unset, which would miscompute - the newest file - - * src/fcfreetype.c: (FcGetPixelSize), (FcFreeTypeQuery), - (FcFreeTypeCheckGlyph): - Add FcGetPixelSize to extract correct pixel size from bdf/pcf - font properties (which report the wrong value in current FreeType) - - Don't attempt to check for empty glyphs in non-scalable fonts; they - have no outlines... - -2004-02-01 Tor Lillqvist - - * src/fccfg.c (FcConfigCreate): fontconfig, at least as used by - GIMP and/or PangoFT2 on Windows, crashes when trying to save the - cache if config->cache is NULL, which happens if FcConfigHome() is - NULL. Guard against that by using the temp folder in that case. - -2004-01-03 Roozbeh Pournader - - * fc-lang/az_ir.orth: - * fc-lang/ku_ir.orth: - * fc-lang/ps_af.orth: - * fc-lang/ps_pk.orth: - Added orthographies for Iranian Azerbaijani and Kurdish, and Pashto - (Afghan and Pakistani). - * fc-lang/ur.orth: - Updated Urdu orthography with real data. - -2003-12-11 Carl Worth - - * fc-list/Makefile.am (man_MANS): Move man_MANS into the 'if - USEDOCBOOK' block. - - * fc-cache/Makefile.am (man_MANS): Move man_MANS into the 'if - USEDOCBOOK' block. - (all-local): Remove excessive whitespace. - - * autogen.sh: Add 'set -e' to abort when any program fails, - (avoids printing of 'now type make' after configure aborts). - -2003-11-17 Eric Christopherson - - reviewed by: Keith Packard - - * doc/Makefile.am: - * fontconfig/fcfreetype.h: - * src/fcfreetype.c: - Switch to FreeType 2.1.7 style includes. Bug #150. - -2003-11-16 Noah Levitt - - * fc-list/fc-list.sgml: Add some example usages. - -2003-11-10 Roozbeh Pournader - - * src/fcxml.c: - Fixed a bug "FcStrtod" in handling some cases with two-byte decimal - separators. - -2003-10-27 Keith Packard - - * configure.in: - * fontconfig/fontconfig.h: - Update to version 2.2.92 - -2003-10-27 Keith Packard - - * Makefile.am: - * configure.in: - * doc/Makefile.am: - * fc-cache/Makefile.am: - * fc-glyphname/Makefile.am: - * fc-lang/Makefile.am: - * fc-list/Makefile.am: - * fc-match/Makefile.am: - * test/Makefile.am: - * test/run-test.sh: - Yet more cleanups to finish getting 'make distcheck' working - This has been tested to ensure that it even works from a _build - directory. - -2003-10-26 Keith Packard - - * configure.in: - * doc/Makefile.am: - * fc-cache/Makefile.am: - * fc-glyphname/Makefile.am: - * fc-lang/Makefile.am: - * fc-lang/fc-lang.c: (scanopen), (scan), (main): - * fc-list/Makefile.am: - * fc-match/Makefile.am: - Attempts to fix 'make distcheck' work. Things are - progressing pretty well, but there are still failures - long into the process dealing with docs (as always). - - The big changes here are mostly to make $(srcdir) != "." - work correctly, fixing the docbook related sections and - fc-lang were particularily tricky. Docbook refuses to load - system entities from anywhere other than where the original .sgml - file was located, so no luck looking in "." for the - configure-generated version.sgml and confdir.sgml files. - - fc-lang needed help finding .orth files; added a -d option - to set the directory as the least evil of many options. - - Now to go use a faster machine and try and wring out the last - issues. - -2003-10-26 Keith Packard - - Tag version 2.2.91 - -2003-10-26 Keith Packard - - * doc/Makefile.am: - Include confdir.sgml.in in EXTRA_DIST - -2003-10-09 Josselin Mouette - - * fc-cache/fc-cache.sgml fc-cache/Makefile.am: - * fc-list/fc-list.sgml fc-list/Makefile.am: - Replace fc-cache and fc-list manpages with more detailed, SGML - versions. - -2003-09-23 Owen Taylor - - * fontconfig/fontconfig.h src/fcdefault.c (FcDefaultSubstitute) - src/fcname.c: Add a FC_HINT_STYLE key for patterns, with - possible values HINT_NONE/HINT_SLIGHT/HINT_MEDIUM/HINT_FULL. - (Bug #117) - -2003-09-23 Owen Taylor - - * fc-lang/ka.orth: Remove Georgian capitals, they - aren't used for normal writing. (Bug #116) - -2003-09-06 Noah Levitt - - * doc/fontconfig-devel.sgml: - * doc/fontconfig-user.sgml: - * fontconfig/fontconfig.h: - * src/fcname.c: - * src/fcfreetype.c (FcFreeTypeCharSetAndSpacing): Add new spacing - value FC_DUAL (dual-width, as some CJK fonts). (bug #111) - - * src/fcfreetype.c (FcFreeTypeCharSetAndSpacing): When checking for - monospace and dual-width fonts, allow roughly a 3% variance in the - advances. - -2003-08-31 Manish Singh - - * src/fccfg.c (FcConfigAppFontClear): Support passing NULL to - use default config. - -2003-08-15 Carl Worth - - * src/fcxml.c (FcEditDestroy): Fix leak of FcEdit. - (FcPopExpr): Add comment about unhandled FcVStackGlob case. - - * src/fcpat.c (FcValueListEntDestroy): New function to support - FcFini memory cleanup. Some statistics are not kept in - synch. here. - (FcValueListFreeze): Move hashTable outside this function so it - can be accessed by FcValueListThawAll. - (FcValueListThawAll): New function complements FcValueListFreeze. - (FcPatternBaseFreeze): Move hashTable outside this function so it - can be accessed by FcPatternBaseThawAll. - (FcPatternBaseThawAll): New function complements - FcPatternBaseFreeze. - (FcPatternThawAll): New function complements FcPatternFreeze. - - * src/fcinit.c (FcFini): Add new FcFini to cleanup everything. - - * src/fccharset.c (FcCharLeafEntCreate): Save pointers to all - allocated FcCharLeafEnt "blocks" so they can be freed later. - (FcCharSetFreezeLeaf): Move hashTable outside this function so it - can be accessed by FcCharSetThawAllLeaf. - (FcCharSetThawAllLeaf): New function complements FcCharSetFreezeLeaf. - (FcCharSetFreezeBase): Move hashTable outside this function so it - can be accessed by FcCharSetThawAll. - (FcCharSetThawAll): New function complements FcCharSetFreeze. - - * src/fccfg.c (FcSubstDestroy): Fix leak of outer FcSubst. - (FcConfigDestroy): Fic leak of FcBlanks. - - * fc-list/fc-list.c (main): Fix leak of FcObjectSet. - (main): Add call to FcFini when finished. - - * fc-glyphname/fc-glyphname.c: Mark several local functions as - static. Add prototypes. - - * doc/fcinit.fncs: Add documentation for FcFini function. - - * doc/edit-sgml.c: Mark several local functions as static. Add - prototypes. - - * doc/Makefile.am (DOC_MODULE): Fix "suspicious" lines. - -2003-06-15 Tor Lillqvist - - * test/run-test.sh (FONTCONFIG_FILE): Remove CRs from the out file - before comparing (needed on Windows). - - * src/Makefile.am (install-libtool-import-lib): Fix cut&paste error. - -2003-06-13 Tor Lillqvist - - * fontconfig-zip.in (DEVZIP): Add share/doc directory. Add Fc*.3 - man pages. - - * configure.in: Set FC_DEFAULT_FONTS on Win32 to the - WINDOWSFONTDIR token. - - * src/fontconfig.def.in: Move the LIBRARY and VERSION lines to the - end, not to confuse libtool, which expects the EXPORTS line to be - the first. Add FcConfigEnableHome. - - * src/fccfg.c: Check also for DLL_EXPORT as indication of being - built as a DLL on Win32. - -2003-06-09 Keith Packard - - * Tag version 2.2.90 - -2003-06-09 Keith Packard - - * Optimization in FcLangSetIndex was broken, occasionally - returning a pointer to the wrong location on miss - - * Add fc-match to test font matching from the command line. - -2003-05-31 Keith Packard - - * (Bug 85) add support for culmus fonts - * (Bug 87) Automake 1.4 doesn't do man_MAN1 correctly - * (Bug 88) Fix usage info on non-long option systems (Tim Mooney) - -2003-05-28 James Su - - * Fix "contains" op for strings and langsets. - -2003-05-17 Keith Packard - - * Fix build error with BDF prop local. Free langset after query - -2003-05-14 Keith Packard - - * Extract spacing from XLFD atom - -2003-05-12 Juliusz Chroboczek - - * Reinstate SETWIDTH_NAME parsing for legacy fonts, - disappeared in 1.30. - - * Generate FC_SIZE and FC_DPI for legacy bitmap fonts - -2003-05-12 Keith Packard - - * Use FcIsWidth to share code - - * Set FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH when scanning fonts to avoid - misclassifying some Han fonts as monospaced. - -2003-05-07 Keith Packard - - * Add filename-based accept/reject to ammend available fonts. - - * Change FT_ENCODING_ADOBE_CUSTOM to ft_encoding_adobe_custom for - older FreeType releases. - -2003-05-06 Keith Packard - - * Remove 0b82 and Tamil numbers from tamil - orthography (Jungshik Shin ) - -2003-05-04 Keith Packard - - + Map glyph names in fonts with adobe custom encoding to unicode - -2003-05-02 Keith Packard - - * Add FC_WEIGHT_BOOK as weight 75 - -2003-04-30 Keith Packard - - * Typo in bitstream foundry name - -2003-04-24 Keith Packard - - * Eliminate italic_angle check for PS fonts - -2003-04-23 Noah Levitt - - * Getting closer to fixing /etc/fonts hard-coding. - -2003-04-22 Keith Packard - - * Update autogen.sh to work with newer automake versions - * Handle pattern elements moving during multiple edits - -2003-04-23 James Henstridge - - * doc/fontconfig-devel.sgml: close the element. - - * doc/fcpattern.fncs: close the element. - - * doc/func.sgml: close the element. - -2003-04-22 Keith Packard - - + Remove some unused variables, and initialize some other ones so - gcc doesn't warn us. - -2003-04-16 Keith Packard - - + tag version 2.1.94 - -2003-04-16 Keith Packard - - + add BDF property fetching support for foundry - (from Juliusz Chroboczek) - + add BDF property fetching support for width - -2003-04-11 Juliusz Chroboczek - - + Implemented foundry generation for Type 1 and TrueType - -2003-04-11 Gerard Escalante - - + Retrieve information from Type1 FontInfo dictionaries - -2003-04-07 Colin Walters - - + src/Makefile.am: Fix dummy makefile target names when - MS_LIB_AVAILABLE isn't set. - -2003-03-22 Tor Lillqvist - - Changes for Windows: - - + On Windows with gcc (a.k.a. mingw) build as a DLL. - - + We don't want to hardcode the fonts.conf file location in the - DLL, so we look up the DLL location at run-time in a DllMain() - function. The fonts.conf location is deduced from that. - - + The colon can't be used as path separator on Windows, - semicolon is used instead. File path components can be separated - with either slash or backslash. Absolute paths can also begin - with a drive letter. - - + Add internal function FcStrLastSlash that strrchr's the last - slash, or backslash on Windows. - - + There is no link() on Windows. For atomicity checks, mkdir a - lock directory instead. - - + In addition to HOME, also look for USERPROFILE. - - + Recognize the special font directory token WINDOWSFONTDIR, to - use the system's font directory. - - + Remove the fontconfig-def.cpp that was obsolete. Add - fontconfig.def(.in), without internal functions. - - + Add a fontconfig-zip(.in) script, used to build a binary - distribution. - -Fri Mar 7 07:55:00 EST 2003 Mike A. Harris - + RPM specfile cleanups for 2.1.92: Removed man1/* and added man5/* - to main package and man3/* to devel package - - + Added missing defattr(-, root, root) to main RPM package - - + Added HTML and text development documentation to -devel subpackage - -Wed Mar 5 05:08:00 EST 2003 Mike A. Harris - + Added back the configure macro options --disable-docs, otherwise - fontconfig installs docs into /usr/share/doc/fontconfig (with no - version number) unconditionally, causing RPM to fail the build due - to _unpackaged_files_terminate_build. We pick up the pregenerated - docs with %doc already. - -Wed Mar 5 04:26:20 EST 2003 Mike A. Harris - + Removed commented out rpm macro define at top of spec file, - replacing it with a simple explanation, since rpm macros are - expanded by rpm even in comments. - - + Changed /usr/bin to _bindir in BuildRequires lines - - + Cleaned up rpm postinstall script, and made fc-cache use _bindir - - + Reorganized file manifest lists - -Sun Mar 2 14:16:17 EST 2003 Owen Taylor - - + fontconfig.spec.in: Improvements from Red Hat spec file. - - + {fc-lang,fc-cache,fc-list}/Makefile.am: Add man pages. - - + docs/*.sgml: SGML fixes. - -Sat Mar 1 17:28:53 PST 2003 keithp - + Ok, so the ChangeLog is a bit out of date - - + Lots of bugs fixed; most are in bugzilla, the - biggest problems were in cache management where - Owen discovered the library would lose badly when - combining fonts-cache and ~/.fonts-cache data - - + Converted from autoconf to automake. This after - getting patches accepted into libtool to allow - the '-version-number' argument which lets - packages set version numbers explicitly rather - than the roundabout libtool way - - + Converted documentation to SGML using the docbook - DTD. Now .txt and .html documents are installed - in /usr/share/doc/fontconfig and there's no - man page. Perhaps a man version can be written - at some point. - -Sat Aug 31 15:21:22 PDT 2002 keithp - + Xrender and Xft had several bugs related to - rendering manually placed or poly-face text - - + Added more complete memory tracing in fontconfig - Checked with (patched) mozilla and found no leaks - - + Updated Latin orthographies by comparing those from - evertype.com with those from eki.ee. Tried to make - sensible choices, including chars that occured in both - and leaving some optional chars out that occured only - in one. - -Mon Aug 26 16:33:04 PDT 2002 keithp - + Owen discovered that FcLangSetHasLang wasn't actually - checking the language set. - -Mon Aug 26 13:37:23 PDT 2002 keithp - + Append a version number to cache filenames - -Thu Aug 22 11:36:18 PDT 2002 keithp - - + Add "contains" and "not_contains" operators and elements to - font configuration - - + Changed semantics of eq operator for LangSets to check for - FcLangEqual so that any match will do - - + FcFontList was using FcConfigCompareValue (...FcOpEqual) instead - of FcValueEqual to check for identical values when inserting into - the results. This broke when the above semantic change was made, - now it uses FcValueEqual which is "more correct" in any case. - -Thu Aug 22 00:32:29 PDT 2002 keithp - - + Reimplement FC_LANG as new datatype. Lists of strings - was consuming over a megabyte of memory for 401 fonts. - - + Freeze patterns loaded from cache files. This shares - common value lists and common patterns which saves - considerable memory. - - + Change the denotation of 'constant' charsets to use special - ref value instead of separate boolean. - - + Clean up leak tracing stuff, found several unannoted alloc/free - calls - -Tue Aug 20 16:17:37 PDT 2002 keithp - - + Fix memory leak when parsing matrices from XML - -Mon Aug 19 11:57:27 PDT 2002 keithp - - + Fix autoconf files to pass FONTCONFIG_PATH on - compile line so that ${prefix} gets substituted - correctly. - - + Use getc_unlocked/putc_unlocked on systems that - provide them to avoid damage done to stdio by posix - - + Eliminate FC_PATTERN and FcTypePattern in favor of - an extended api for FcConfigSubstitute which takes - both the font and the pattern. - - + Add 'sans serif' alias for 'sans-serif' as some apps - can't handle hyphens in family names - - + Eliminate pretense of support for libxml2 - - + Comment origins of Han orthographies - -Tue Jul 30 18:37:09 PDT 2002 keithp - - + Add binding property to edit element so that strong - binding values may be inserted by the config file. - The default remains weak. - -Sun 28 Jul 04:16:55 PDT 2002 keithp - - + Tagged release candidate 1 in the CVS tree and - placed fcpackage.rc1.tar.gz for distribution - -Thu Aug 1 08:55:08 PDT 2002 keithp - - + Fixed autoconf builds to always specify install - target files (for BSD). Also fixed to - define FONTCONFIG_PATH in config.h so that - nonstandard installs will actually work. diff --git a/INSTALL b/INSTALL index ff067cf..ddd94f8 100644 --- a/INSTALL +++ b/INSTALL @@ -13,22 +13,33 @@ important steps: 1. Update the version numbers configure.in fontconfig/fontconfig.h + 2. Fix the README Change version number Set the date + 3. Commit those changes + 4. rebuild the configuration files with autogen.sh - sh autogen.sh --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man - 5. make distcheck + sh autogen.sh --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man --localstatedir=/var + + 5. make distcheck (NB: won't work without docbook-utils -PL) + 6. tag the tree - cvs tag fc-2_2_xx - 7. Split out the ChangeLog into ChangeLog-2.2.xx with - the changes since the previous release - 8. Copy ChangeLog-2.2.xx and fontconfig-2.2.xx.tar.gz to + git-tag -u 096c4dd3 -m'Version 2.3.xx' 2.3.xx + + 7. make Changelog-2.3.xx + git-log 2.3.(xx-1).. > ChangeLog-2.3.xx + + 8. Copy ChangeLog-2.3.xx and fontconfig-2.3.xx.tar.gz to + freedesktop.org:/srv/fontconfig.freedesktop.org/www/release + 9. Update the Fontconfig Devel wiki page http://fontconfig.org/wiki/Devel + 10. Compute md5sums for release files: - md5sum fontconfig-2.2.xx.tar.gz ChangeLog-2.2.xx + md5sum fontconfig-2.3.xx.tar.gz ChangeLog-2.3.xx + 11. Post a note to fontconfig@fontconfig.org. Include the md5sums. gpg sign the message. diff --git a/Makefile.am b/Makefile.am index ed624c6..1b28303 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,40 +22,8 @@ # PERFORMANCE OF THIS SOFTWARE. DOCSRC=@DOCSRC@ -SUBDIRS=fontconfig fc-case fc-lang fc-glyphname src \ - fc-cache fc-list fc-match conf.d $(DOCSRC) test - -DEBIAN = \ - debian/changelog \ - debian/compat \ - debian/control \ - debian/copyright \ - debian/fontconfig.config \ - debian/fontconfig.defoma \ - debian/fontconfig.dirs \ - debian/fontconfig.install \ - debian/fontconfig.postinst \ - debian/fontconfig.postrm \ - debian/fontconfig.templates \ - debian/fontconfig-udeb.install \ - debian/libfontconfig1-dev.install \ - debian/libfontconfig1.install \ - debian/local.conf.md5sum \ - debian/README.Debian \ - debian/rules \ - debian/po/POTFILES.in \ - debian/po/templates.pot \ - debian/po/cs.po \ - debian/po/da.po \ - debian/po/de.po \ - debian/po/es.po \ - debian/po/fr.po \ - debian/po/ja.po \ - debian/po/nl.po \ - debian/po/pt_BR.po \ - debian/po/pt.po \ - debian/po/tr.po \ - debian/po/zh_CN.po +SUBDIRS=fontconfig fc-case fc-lang fc-glyphname fc-arch src \ + fc-cache fc-cat fc-list fc-match conf.d $(DOCSRC) test EXTRA_DIST = \ fontconfig.pc.in \ @@ -63,8 +31,22 @@ EXTRA_DIST = \ fonts.dtd \ fontconfig.spec.in \ fontconfig.spec \ - fontconfig-zip.in \ - $(DEBIAN) + fontconfig-zip.in +DISTCLEANFILES = config.cache +MAINTAINERCLEANFILES = \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/compile \ + $(srcdir)/config.guess \ + $(srcdir)/config.h.in \ + $(srcdir)/config.sub \ + $(srcdir)/configure.scan \ + $(srcdir)/depcomp \ + $(srcdir)/install-sh \ + $(srcdir)/ltmain.sh \ + $(srcdir)/missing \ + $(srcdir)/mkinstalldirs \ + `find "$(srcdir)" -type f -name Makefile.in -print` pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA = fontconfig.pc @@ -78,6 +60,30 @@ else RUN_FC_CACHE_TEST=test -z "$(DESTDIR)" endif +# Creating ChangeLog from git log: + +MAINTAINERCLEANFILES += ChangeLog + +EXTRA_DIST += ChangeLog + +ChangeLog: $(srcdir)/ChangeLog + +$(srcdir)/ChangeLog: + @if test -d "$(srcdir)/.git"; then \ + (cd "$(srcdir)" && \ + ./missing --run git-log --stat) | fmt --split-only > $@.tmp \ + && mv -f $@.tmp $@ \ + || ($(RM) $@.tmp; \ + echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ + (test -f $@ || echo git-log is required to generate this file >> $@)); \ + else \ + test -f $@ || \ + (echo A git checkout and git-log is required to generate ChangeLog >&2 && \ + echo A git checkout and git-log is required to generate this file >> $@); \ + fi + +.PHONY: ChangeLog $(srcdir)/ChangeLog + install-data-local: $(mkinstalldirs) $(DESTDIR)$(configdir) if [ -f $(DESTDIR)$(configdir)/fonts.conf ]; then \ @@ -91,16 +97,16 @@ install-data-local: echo " $(INSTALL_DATA) fonts.conf $(DESTDIR)$(configdir)/fonts.conf"; \ $(INSTALL_DATA) fonts.conf $(DESTDIR)$(configdir)/fonts.conf; \ fi; fi - if $(RUN_FC_CACHE_TEST); then \ - echo " fc-cache/fc-cache -f -v"; \ - fc-cache/fc-cache -f -v; \ + @(if $(RUN_FC_CACHE_TEST); then \ + echo " fc-cache/fc-cache -s -f -v"; \ + fc-cache/fc-cache -s -f -v; \ else \ echo "***"; \ echo "*** Warning: fonts.cache not built"; \ echo "***"; \ echo "*** Generate this file manually on host system using fc-cache"; \ echo "***"; \ - fi + fi) uninstall-local: if [ -f $(srcdir)/fonts.conf ]; then \ diff --git a/README b/README index 26fe4b9..9cae1ab 100644 --- a/README +++ b/README @@ -1,11 +1,194 @@ Fontconfig Font configuration and customization library - Version 2.3.2 - 2005-4-27 + Version 2.3.96 + 2006-09-03 + Check INSTALL for compilation and installation instructions. Report bugs to https://bugs.freedesktop.org in the fontconfig module. +2.3.96 + +Keith Packard: + Make path names in cache files absolute (NB, cache format change) Stop + Eliminate pattern freezing + Add .gitignore + Construct short architecture name from architecture signature. + Write caches to first directory with permission. Valid cache in FcDirCacheOpen. + Eliminate NormalizeDir. Eliminate gratuitous stat/access calls per dir. + Add architecture to cache filename. + Eliminate global cache. Eliminate multi-arch cache code. + Fix up fc-cache and fc-cat for no global cache changes. + Eliminate ./ and ../ elements from font directory names when scanning. + Regenerate x86 line in fcarch.tmpl.h to match change in cache data. + Add x86-64 architecture and signature. + During test run, remove cache directory to avoid stale cache usage. + Add ppc architecture + Revert to original FcFontSetMatch algorithm to avoid losing fonts. + Rework cache files to use offsets for all data structures. + Fix build problems caused by cache rework. + FcCharSetSerialize was using wrong offset for leaves. Make fc-cat work. + Rework Object name database to unify typechecking and object lookup. + Skip broken caches. Cache files are auto-written, don't rewrite in fc-cache. + Fix fc-cat again. Sigh. + Use intptr_t instead of off_t inside FcCache structure. + Serialized value lists were only including one value. + Automatically remove invalid cache files. + With no args, fc-cat now dumps all directories. + Revert ABI changes from version 2.3 + Change $(pkgcachedir) to $(fc_cachedir) in fc-cat and fc-cache Makefile.am + Allow FcTypeLangSet to match either FcTypeLangSet or FcTypeString. + Remove stale architecture signatures. + Pass directory information around in FcCache structure. Freeze charsets. + Fix fc-lang to use new charset freezer API. + Fontset pattern references are relative to fontset, not array. + Add some ignores + Only rebuild caches for system fonts at make install time. + Fix memory leaks in fc-cache directory cleaning code. + Add @EXPAT_LIBS@ to Libs.private in fontconfig.pc (bug 7683) + Avoid #warning directives on non-GCC compilers. (bug 7683) + Chinese/Macau needs the Hong Kong orthography instead of Taiwan (bug 7884) + Add Assamese orthography (as.orth). Bug #8050 + Really only rebuild caches for system fonts at make install time. + Fonts matching lang not territory should satisfy sort pattern lang. + Prefer Bitstream Vera to DejaVu families. + Guess that mac roman names with lots of high bits are actually SJIS. + Document FC_DEBUG values (bug 6393). Document name \ escape syntax. + Move Free family names to bottom of respective aliases. (bug 7429) + Unify directory canonicalization into FcStrAddFilename. + Allow font caches to contain newer version numbers + Add FcMatchScan to resolve Delicious font matching issues (bug #6769) + Fix missing initialization/destruction of new 'scan' target subst list. + Don't segfault when string values can't be parsed as charsets or langsets. + Using uninitialized (and wrong) variable in FcStrCopyFilename. + Oops; missed the 60-delicious.conf file. + +Patrick Lam: + Keith Packard + 2006-04-27 Paolo Borelli (pborelli@katamail.com) reviewed by: plam + 2006-05-31 Yong Li (rigel863@gmail.com) reviewed by: plam, Bedhad Esfahbod + 2006-07-19 Jon Burgess (jburgess@uklinux.net) reviewed by: plam + 2006-08-04 Keith Packard (keithp@keithp.com) reviewed by: plam + +2.3.95 + +Match 'Standard Symbols L' for 'Symbol'. Add URW fonts as aliases for +all of the PostScript fonts. (reported by Miguel Rodriguez). Fix a +number of Coverity defects (Frederic Crozat). Speed up FcFontSort +(fix suggested by Kenichi Handa). Fix error with charsets. Survive +missing docbook2pdf. Compile on HP-UX, AIX, SGI and Windows (Cygwin, +MinGW). Fix intel compiler warnings. Fix multiarch support (don't +destroy multiarch files!) Require pkg-config. (Thanks Behdad; better +solution wanted for libxml2 detection!) Fix typos in orth files and +add orth for Lingala (reported by Denis Jacquerye). Remove debian/ +directory. Add a configuration file that disables hinting for the +Lohit Gujarati font (since the hinting distorts some glyphs quite +badly). Sort directory entries while scanning them from disk; +prevents Heisenbugs due to file ordering in a directory (due to Egmont +Koblinger). Fix Wine's problem with finding fonts. (Reported by +Bernhard Rosenkraenzer.) Fix the issues with GNU libiconv vs. libc +iconv (which especially appear on Solarii); patch by Behdad Esfahbod, +approach suggested by Tim Mooney. + +2.3.94 + +fc-cat can take directories as input and creates old-style fonts.cache +listings. +fc-cache takes -r --really-force which blows away all old caches and +regenerates. +Robustness fixes, integer overflow fixes (notably to cache handling +code), toast broken global cache files. +Change binary format to make it compatible with static langset +information (thanks to Takashi Iwai). +Open hashed caches before fonts.cache-2 (Takashi Iwai). +Fix FcFontSetMatch's algorithm, which used to unjustly kill fonts for +not declaring certain elements (Takashi Iwai). +Fix matching bug when multiple elements match; don't use +the sum of all scores, but the best score (James Su). +Make fc-lang more friendly to Windows systems. +Remove archaic chars from Georgian charset; add Euro character to +charsets for European languages. +Fix treatment of broken PCF fonts that don't declare family names. +Pass O_BINARY to open if appropriate (reported by Doodle). +Normalize font directories to the form in which they appear in +config files. +Add a record of the cached directory to the cache file. +Perf optimizations (Dirk Mueller; some reported by Michael Meeks.) +Don't loop infinitely on recursive symlinks. +Make 'make distcheck' work with automake 1.6.3. +Replace 'stamp' target with mkinstalldirs. +Don't stop scanning if a directory in fonts.conf doesn't exist, +because subsequent directories might exist. +Put directory names into global cache (reported by Ronny V. Vindenes). +Treat zh-hk fonts differently from zh-tw fonts. This patch may cause +fontconfig to treat A-X fonts differently from A-Y fonts; please mail +the fontconfig list if this causes any problems. +Fix for unaligned memory accesses (Andreas Schwab). +Fix treatment of cache directory as read from cache file; don't use +string equality to determine if we have the right file, use inode +equality. +Properly skip past dir caches that contain zero fonts, as occurs +in global caches (reported by Mike Fabian). +Print out full pathname in fc-match -v (reported by Frederic Crozat). +Fix bug where fc-match crashes when given __DUMMY__ property to +match on. + +2.3.93 + +Create cache files in /var/cache/fontconfig with hashed filenames, if +possible, for added FHS compliance. +Make fc-cat read both per-directory and global cache files. +Add config file for Persian fonts from Sharif FarsiWeb, Inc. +Major performance improvements by Dirk Mueller, Stephen Kulow, and Michael Matz at SuSE: in particular, speed up FcFontSetMatch, and inline many functions. +Fix treatment of globs in config files, broken since 2.3.2 and discovered by Mathias Clasen. +Don't use freetype internal headers (patch by Matthias Clasen). +Further space improvements: create langsets statically, so that they can live in .rodata. +Properly align mmapped data structures to make e.g. ia64 happy. +Bug fixes. + +2.3.92 + +Fix corrupted caches bugs from 2.3.91 (reported by Mike Fabian). +Store only basename in the cache, reconstitute on demand +(reported by James Cloos). +Change the rule for artificial emboldening in fonts.conf.in. This +enables the support for artificial emboldening included in cairo +(patch by Zhe Su). +Add FC_EMBEDDED_BITMAP object type to tell Xft/Cairo whether +to load embedded bitmaps or not (patch by Jinghua Luo). +Fix GCC4 warnings (some by Behdad Esfahbod). +Support localized font family and style names; this has been reported +to break old apps like xfd, but modern (gtk+/qt/mozilla) apps work +fine (patch by Zhe Su). +Prevent fc-list from escaping strings when printing them (reported by +Matthias Clasen). +Add valist sentinel markup for FcObjectSetBuild and +FcPatternBuild (patch by Marcus Meissner). +Add consts to variables so as to move arrays into .rodata (patch by +Ross Burton). +Modify config file to use Greek fonts before Asian fonts with +Greek glyphs. (patch by Simos Xenitellis). +Use libtool -no-undefined flag on all platforms (patch by Christian +Biesinger). + +2.3.91 + +Use libxml2 if requested or if expat not available. (Mathias Hasselmann) +Fix multi-arch cache files: compute the position for the +block to be added using info from OrigFile, not NewFile. (plam) +Cast results of sizeof() to unsigned int to get rid of +warnings on x86_64 (reported by Matthias Clasen). +Use FcAtomic to rewrite cache files; don't unlink the fonts.cache-2 +file even if there's no data to write; just write an empty cache file. +(Reported by Lubos Lunak) +Allocate room for the subdirectory names in each directory cache. +(Reported by James Cloos) + +2.3.90 + +Development release of mmap patch: load pattern information +directly from cache files. (Patrick Lam) + 2.3.2 Patch memory leaks in using iconv. (Reported by Chris Capoccia) diff --git a/conf.d/10-fonts-persian.conf b/conf.d/10-fonts-persian.conf new file mode 100644 index 0000000..e30c4d9 --- /dev/null +++ b/conf.d/10-fonts-persian.conf @@ -0,0 +1,539 @@ + + + + + + + + + + + + + + + + Nesf + + + Nesf2 + + + + + Nesf2 + + + Persian_sansserif_default + + + + + + + + + + + + Nazanin + + + Nazli + + + + + Lotus + + + Lotoos + + + + + + + Yaqut + + + Yaghoot + + + + + Yagut + + + Yaghoot + + + + + Yaghut + + + Yaghoot + + + + + Traffic + + + Terafik + + + + + Ferdowsi + + + Ferdosi + + + + + Fantezy + + + Fantezi + + + + + + + + + + Jadid + + + Persian_title + + + + + Titr + + + Persian_title + + + + + + + Kamran + + + Homa + + + Persian_fantasy + + + + + Homa + + + Kamran + + + Persian_fantasy + + + + + Fantezi + + + Persian_fantasy + + + + + Tabassom + + + Persian_fantasy + + + + + + + Arshia + + + Persian_square + + + + + Nasim + + + Persian_square + + + + + Elham + + + Farnaz + + + Persian_square + + + + + Farnaz + + + Elham + + + Persian_square + + + + + Sina + + + Persian_square + + + + + + + + + Persian_title + + + Persian_serif + + + Jadid + + + Titr + + + + + + + Persian_fantasy + + + Persian_square + + + Tabassom + + + Fantezi + + + Kamran + + + Homa + + + + + + + Persian_square + + + Persian_serif + + + Sina + + + Nasim + + + Farnaz + + + Elham + + + Arshia + + + + + + + + Elham + + + farsiweb + + + + + + Homa + + + farsiweb + + + + + + Koodak + + + farsiweb + + + + + + Nazli + + + farsiweb + + + + + + Roya + + + farsiweb + + + + + + Terafik + + + farsiweb + + + + + + Titr + + + farsiweb + + + + + + + + + + TURNED-OFF + + + farsiweb + + + + roman + + + + roman + + + + + matrix + 1-0.2 + 01 + + + + + + oblique + + + + + + + + + farsiweb + + + false + + + false + + + false + + + + + + + + + serif + + Nazli + Lotoos + Mitra + Ferdosi + Badr + Zar + + + + + + sans-serif + + Roya + Koodak + Terafik + + + + + + monospace + + + Terafik + + + + + + + + + + serif + + + 200 + + + 24 + + + Titr + + + + + + + sans-serif + + + 200 + + + 24 + + + Titr + + + + + + + Persian_sansserif_default + + + 200 + + + 24 + + + Titr + + + + + + + + + Persian_sansserif_default + + + Roya + + + + diff --git a/conf.d/60-delicious.conf b/conf.d/60-delicious.conf new file mode 100644 index 0000000..701429b --- /dev/null +++ b/conf.d/60-delicious.conf @@ -0,0 +1,20 @@ + + + + + + + + + + Delicious + + + Heavy + + + heavy + + + + diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am index 6fa4ee5..98e8dbd 100644 --- a/conf.d/Makefile.am +++ b/conf.d/Makefile.am @@ -23,6 +23,8 @@ CONF_FILES = \ 10LohitGujarati.conf \ + 10-fonts-persian.conf \ + 60-delicious.conf \ autohint.conf \ no-bitmaps.conf \ no-sub-pixel.conf \ diff --git a/config/config.guess b/config/config.guess index 8229471..c38553d 100644 --- a/config/config.guess +++ b/config/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-11-12' +timestamp='2006-02-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ timestamp='2004-11-12' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +55,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -104,7 +106,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -196,55 +198,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amd64:OpenBSD:*:*) - echo x86_64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - cats:OpenBSD:*:*) - echo arm-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - luna88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit 0 ;; + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -297,40 +267,43 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe - exit 0 ;; + exit ;; *:OS400:*:*) echo powerpc-ibm-os400 - exit 0 ;; + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -338,32 +311,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; + exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -372,10 +345,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -387,10 +360,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -401,40 +374,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -458,32 +431,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -499,29 +473,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -529,7 +503,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -544,14 +518,18 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -565,28 +543,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -648,9 +626,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -658,11 +646,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -690,158 +678,177 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:MSYS_NT-*:*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; + x86:Interix*:[345]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[345]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu - exit 0 ;; + exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu - exit 0 ;; + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -858,8 +865,12 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -877,15 +888,22 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -899,7 +917,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -907,25 +925,28 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -943,15 +964,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -968,7 +989,7 @@ EOF LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) LIBC=gnu #else LIBC=gnuaout @@ -978,16 +999,23 @@ EOF LIBC=dietlibc #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -995,27 +1023,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) + exit ;; + i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -1023,15 +1051,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; + exit ;; M68*:*:R3V[5678]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1123,69 +1152,72 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in - *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1193,22 +1225,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1219,41 +1254,47 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms && exit 0 ;; - I*) echo ia64-dec-vms && exit 0 ;; - V*) echo vax-dec-vms && exit 0 ;; + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix - exit 0 ;; + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1285,7 +1326,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1374,11 +1415,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1387,22 +1429,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1413,7 +1455,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/config/config.sub b/config/config.sub index 0f84ac2..ad9f395 100644 --- a/config/config.sub +++ b/config/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-11-30' +timestamp='2006-02-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +21,15 @@ timestamp='2004-11-30' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +71,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +84,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +100,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,8 +119,9 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -170,6 +172,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -186,6 +192,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -231,13 +241,14 @@ case $basic_machine in | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -246,6 +257,7 @@ case $basic_machine in | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ @@ -254,15 +266,18 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ @@ -271,6 +286,9 @@ case $basic_machine in | z8k) basic_machine=$basic_machine-unknown ;; + m32c) + basic_machine=$basic_machine-unknown + ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -278,6 +296,9 @@ case $basic_machine in ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -298,7 +319,7 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ - | bs2000-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ @@ -310,7 +331,7 @@ case $basic_machine in | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -319,6 +340,7 @@ case $basic_machine in | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ @@ -327,16 +349,19 @@ case $basic_machine in | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ + | mt-* \ | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ @@ -348,6 +373,8 @@ case $basic_machine in | ymp-* \ | z8k-*) ;; + m32c-*) + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -683,6 +710,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -758,9 +788,8 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff ;; os400) basic_machine=powerpc-ibm @@ -791,6 +820,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -847,6 +882,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -1086,12 +1125,9 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; @@ -1165,20 +1201,23 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1196,7 +1235,7 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) @@ -1385,6 +1424,9 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; @@ -1556,7 +1598,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/configure.in b/configure.in index f737353..e8e1062 100644 --- a/configure.in +++ b/configure.in @@ -33,7 +33,7 @@ dnl This is the package version number, not the shared library dnl version. This same version number must appear in fontconfig/fontconfig.h dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's dnl not possible to extract the version number here from fontconfig.h -AM_INIT_AUTOMAKE(fontconfig, 2.3.2) +AM_INIT_AUTOMAKE(fontconfig, 2.3.96) AM_MAINTAINER_MODE dnl libtool versioning @@ -78,14 +78,16 @@ fi AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes) WARN_CFLAGS="" - if test "x$GCC" = "xyes"; then WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ -Wnested-externs -fno-strict-aliasing" + AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1, + [Can use #warning in C files]) fi AC_SUBST(WARN_CFLAGS) + dnl ========================================================================== AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes) @@ -132,18 +134,69 @@ AC_SUBST(EXEEXT_FOR_BUILD) dnl ========================================================================== +AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto) + +if test $cross_compiling = yes; then + case "$arch" in + auto) + AC_MSG_ERROR([Cannot autodetect architecture in cross compile environment] + [Use --with-arch=ARCH to specify architecture]) + ;; + esac +fi + +ARCHITECTURE=$arch +AC_SUBST(ARCHITECTURE) + +dnl ========================================================================== + # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h iconv.h]) +AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST +AC_C_INLINE AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF -AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long iconv]) +AC_FUNC_MMAP +AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand_r]) + +# +# Checks for iconv +# +AC_MSG_CHECKING([for a usable iconv]) +ICONV_LIBS="" +AC_TRY_LINK([#include ], + [iconv_open ("from", "to");], + [use_iconv=1], + [use_iconv=0]) +if test x$use_iconv = x1; then + AC_MSG_RESULT([libc]) +else + # try using libiconv + fontconfig_save_libs="$LIBS" + LIBS="$LIBS -liconv" + + AC_TRY_LINK([#include ], + [iconv_open ("from", "to");], + [use_iconv=true], + [use_iconv=false]) + + if test x$use_iconv = x1; then + ICONV_LIBS="-liconv" + AC_MSG_RESULT([libiconv]) + else + AC_MSG_RESULT([no]) + fi + + LIBS="$fontconfig_save_libs" +fi +AC_SUBST(ICONV_LIBS) +AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.]) # # Checks for FreeType @@ -197,102 +250,124 @@ AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes) AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes) -case "$expat" in -no) +if test "$enable_libxml2" != "yes"; then + case "$expat" in + no) ;; -*) - case "$expat_includes" in - yes) - case "$expat" in + *) + case "$expat_includes" in yes) + case "$expat" in + yes) + ;; + *) + EXPAT_CFLAGS="-I$expat/include" + ;; + esac + ;; + no) + EXPAT_CFLAGS="" ;; *) - EXPAT_CFLAGS="-I$expat/include" + EXPAT_CFLAGS="-I$expat_includes" ;; esac - ;; - no) - EXPAT_CFLAGS="" - ;; - *) - EXPAT_CFLAGS="-I$expat_includes" - ;; - esac - case "$expat_lib" in - yes) - case "$expat" in + case "$expat_lib" in yes) - EXPAT_LIBS="-lexpat" + case "$expat" in + yes) + EXPAT_LIBS="-lexpat" + ;; + *) + EXPAT_LIBS="-L$expat/lib -lexpat" + ;; + esac + ;; + no) ;; *) - EXPAT_LIBS="-L$expat/lib -lexpat" + EXPAT_LIBS="-L$expat_lib -lexpat" ;; esac - ;; - no) - ;; - *) - EXPAT_LIBS="-L$expat_lib -lexpat" - ;; - esac - expatsaved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" - expatsaved_LIBS="$LIBS" - LIBS="$LIBS $EXPAT_LIBS" + expatsaved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" + expatsaved_LIBS="$LIBS" + LIBS="$LIBS $EXPAT_LIBS" - AC_CHECK_HEADER(expat.h) - case "$ac_cv_header_expat_h" in - no) - AC_CHECK_HEADER(xmlparse.h) - case "$ac_cv_header_xmlparse_h" in + AC_CHECK_HEADER(expat.h) + case "$ac_cv_header_expat_h" in no) - have_expat_header=no; + AC_CHECK_HEADER(xmlparse.h) + case "$ac_cv_header_xmlparse_h" in + no) + have_expat_header=no; + ;; + yes) + HAVE_XMLPARSE_H=1 + AC_SUBST(HAVE_XMLPARSE_H) + AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H, + [Use xmlparse.h instead of expat.h]) + have_expat_header=yes + ;; + esac ;; yes) - HAVE_XMLPARSE_H=1 - AC_SUBST(HAVE_XMLPARSE_H) - AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H, - [Use xmlparse.h instead of expat.h]) have_expat_header=yes ;; esac - ;; - yes) - have_expat_header=yes - ;; - esac - case "$have_expat_header" in - no) - expat=no - ;; - yes) - AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler) - case "$ac_cv_func_XML_SetDoctypeDeclHandler" in - yes) - HAVE_EXPAT=1 - AC_SUBST(HAVE_EXPAT) - AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT, - [Found a useable expat library]) - ;; - *) + case "$have_expat_header" in + no) expat=no ;; + yes) + AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler) + case "$ac_cv_func_XML_SetDoctypeDeclHandler" in + yes) + HAVE_EXPAT=1 + AC_SUBST(HAVE_EXPAT) + AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT, + [Found a useable expat library]) + ;; + *) + expat=no + ;; + esac + ;; esac + CPPFLAGS="$expatsaved_CPPFLAGS" + LIBS="$expatsaved_LIBS" ;; esac - CPPFLAGS="$expatsaved_CPPFLAGS" - LIBS="$expatsaved_LIBS" - ;; -esac -AC_SUBST(EXPAT_LIBS) -AC_SUBST(EXPAT_CFLAGS) -case "$expat" in -no) - AC_MSG_ERROR([Cannot find usable expat library. This could mean that your version is too old.]) - ;; -esac + AC_SUBST(EXPAT_CFLAGS) + AC_SUBST(EXPAT_LIBS) + + case "$expat" in + no) + EXPAT_CFLAGS="" + EXPAT_LIBS="" + + AC_MSG_WARN([Cannot find usable expat library. Trying to use libxml2 as fallback.]) + ;; + esac +fi + +# +# Check libxml2 configuration +# + +AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat]) + +PKG_PROG_PKG_CONFIG + +if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then + PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6]) + AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat]) + + AC_SUBST(LIBXML2_CFLAGS) + AC_SUBST(LIBXML2_LIBS) +fi # # Set default font directory @@ -374,6 +449,22 @@ esac AC_SUBST(FC_FONTPATH) +# +# Set default cache directory path +# +AC_ARG_WITH(cache-dir, [ --with-cache-dir=DIR Use DIR to store cache files (default /var/cache/fontconfig)], fc_cachedir="$withval", fc_cachedir=yes) + +case $fc_cachedir in +no|yes) + fc_cachedir=`eval echo "${localstatedir}/cache/"${PACKAGE}` + ;; +*) + ;; +esac +AC_SUBST(fc_cachedir) +FC_CACHEDIR=${fc_cachedir} +AC_SUBST(FC_CACHEDIR) + FC_FONTDATE=`LC_ALL=C date` AC_SUBST(FC_FONTDATE) @@ -459,16 +550,19 @@ fi AC_SUBST(DOCDIR) + AC_OUTPUT([ Makefile fontconfig/Makefile fc-lang/Makefile fc-glyphname/Makefile fc-case/Makefile +fc-arch/Makefile src/Makefile src/fontconfig.def conf.d/Makefile fc-cache/Makefile +fc-cat/Makefile fc-list/Makefile fc-match/Makefile doc/Makefile diff --git a/debian/README.Debian b/debian/README.Debian deleted file mode 100644 index 3aa1cfd..0000000 --- a/debian/README.Debian +++ /dev/null @@ -1,45 +0,0 @@ -*** IMPORTANT *** - -Recently, fontconfig changed to not include bitmapped fonts in the -default font set. There is now a Debconf question about this. - -If you wish to enable bitmapped fonts manually, either reconfigure this -package (with dpkg-reconfigure fontconfig), or remove the -symbolic link /etc/fonts/conf.d/30-debconf-no-bitmaps.conf - -***************** - - -How fonts are handled in Debian: --------------------------------- - -Fontconfig is a library which handles font configuration and access at -the system level. It is the foundation for a new font handling in X -applications (but can also be useful without X). - -Applications not using fontconfig are accessing their fonts through -the X server. Font packages for these applications are named xfonts-*. -You can also use TrueType fonts with these applications if you install -the x-ttcidfont-conf package, which connects the X server to defoma: -fonts included in ttf-* packages or added manually using dfontmgr can -then be used in these programs. -A few of these applications, using Xft1, can benefit of antialiasing -with vector fonts, but it is deprecated. - -The new font renderer in XFree86 is called freetype2, and applications -using it access fonts on the client side. Most of them (including all -GTK2/GNOME2 and KDE3 applications) do it using fontconfig, which -provides listing and matching facilities for all fonts installed on the -system. Any font installed in /usr/share/fonts or ~/.fonts will be -accessible to these applications. This is now also true for fonts added -using defoma. -These programs can all benefit from antialiasing, autohinting and -sub-pixel rendering. You can configure it through fontconfig, using -debconf (dpkg-reconfigure fontconfig), or by changing -links in /etc/fonts/conf.d by hand. - -Original text by: - -- Josselin Mouette Wed, 8 Oct 2003 21:51:35 +0200 - -Changes for fontconfig 2.3 packages by: - -- Keith Packard Thu, 10 Mar 2005 13:29:11 -0800 diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index db95abd..0000000 --- a/debian/changelog +++ /dev/null @@ -1,700 +0,0 @@ - * Change section of fontconfig source package to libs (closes: #309864) - -fontconfig (2.3.2-1) unstable; urgency=low - * Patch memory leaks (thanks to Chris Capoccia) (closes: #305680) - * Share strings to save memory (Ross Burton) - * Reduce priority of URW fonts - - -- Keith Packard Sat, 23 Apr 2005 14:30:18 +1000 - -fontconfig (2.3.1-2) unstable; urgency=low - - * Change priority of fontconfig-udeb package to extra - * Fixed incorrect hinting_type case in postinst script (closes: #298817) - * Replaced Descriptions in fontconfig.templates with shorter - versions (Thanks to Josselin Mouette) - * Change README.Debian to match new configuration mechanism. - - -- Keith Packard Thu, 10 Mar 2005 13:29:11 -0800 - -fontconfig (2.3.1-1) unstable; urgency=low - - * Move from experimental to unstable - * Fix a few minor bugs in handling broken GSUB/GPOS tables - * Adopt suggestions by former maintainer (Josselin Mouette) - reguarding debian packaging. - * Get library man pages to install in -dev package - * Translations of the configuration questions remain incomplete - - -- Keith Packard Tue, 8 Mar 2005 20:47:35 -0800 - -fontconfig (2.3.0-1) experimental; urgency=low - - * Change of maintainer - * New upstream release - * Support for current Freetype versions - * Multi-lingual family/style/fullname values with parallel language - tags to enable locale-sensitive presentation of these names. - * Font black- and white-listing in the configuration file - enables users to select their desired font attributes without - having to carefully construct the font directory list. - * Support for local configuration directory provides a place for system - distributors and administrators to make local changes to the font - configuration without having to edit any configuration files. - - -- Keith Packard Wed, 2 Mar 2005 00:03:56 -0800 - -fontconfig (2.2.3-4) unstable; urgency=low - - * New translations of debconf templates: - + Brazilian - + Simplified Chinese (closes: #279326) - + Dutch (closes: #280657) - + German (closes: #281077) - + Danish (closes: #282094) - * fontconfig.defoma: patch from SU Yong for missing - tags (closes: #280560). - - -- Josselin Mouette Sat, 20 Nov 2004 15:38:00 +0100 - -fontconfig (2.2.3-3) unstable; urgency=low - - * fontconfig.templates: merge the autohinter and subpixel rendering - questions in a single "select" template. - * fontconfig.config, fontconfig.postinst: update accordingly. - * debian/po/*.po: updated translations (closes: #277927). - * fontconfig.postinst: default to use the bytecode interpreter when the - subpixel rendering is activated (closes: #277874, #277883, #278211). - * fontconfig.config: try to get the answer to deXconf's LCD question to set - the default. - - -- Josselin Mouette Thu, 28 Oct 2004 20:27:49 +0200 - -fontconfig (2.2.3-2) unstable; urgency=low - - * debian/po/pt_BR.po: updated translation from Gustavo Franco - (closes: #276693). - * debian/po/fr.po: correct subpixel rendering question. - * fontconfig.config: change question ordering. - * fontconfig.templates: default the autohinter to "true", but keep the - subpixel rendering to "false". This is because the bytecode interpreter - (previous default) renders very badly on TFT screens, and the subpixel - rendering looks bad on non-RGBA screens (closes: #268321). - * fontconfig.postinst: always enable the autohinter if the subpixel - rendering is activated (otherwise it doesn't work). - - -- Josselin Mouette Thu, 21 Oct 2004 22:59:51 +0200 - -fontconfig (2.2.3-1) unstable; urgency=low - - * New upstream release. - * 00maintainer_mode.patch, autoreconf.patch: removed, obsoleted upstream. - * German translation of debconf templates (closes: #252723). - * Turkish translation of debconf templates (closes: #246080). - * objcopy now works correctly on alpha: - - libfontconfig1-dbg.install.alpha: removed. - - rules: use --dbg-package on all arches. - * shlibs.local: removed. - - -- Josselin Mouette Tue, 13 Jul 2004 11:32:02 +0200 - -fontconfig (2.2.2-2) unstable; urgency=low - - * added debian/patches/00maintainer_mode.patch: introduce - AM_MAINTAINER_MODE to avoid brain damage. - * added debian/patches/autoreconf.patch: this is the result of - libtoolize --force --copy; aclocal; autoheader; automake -acf; - autoconf with libtool 1.5.4 (closes: #218441). - * debian/po/nl.po: added Dutch debconf translation (closes: #237813). - * debian/po/da.po: updated Danish translation (closes: #241123). - - -- Josselin Mouette Wed, 7 Apr 2004 14:28:05 +0200 - -fontconfig (2.2.2-1) unstable; urgency=low - - * New upstream release. - * debian/rules: - + only require libfontconfig1 2.2.1 for dh_makeshlibs. - * debian/control: - + build-depend on binutils 2.12.90.0.9 for dh_strip (closes: #237417). - + build-depend on freetype 2.1.7, ditto for -dev depends. - + fontconfig now conflicts with libfontconfig1-dev << 2.2.2. - * Added debian/po/cs.po (closes: #236275). - * Added debian/po/pt_BR.po (closes: #235465). - * Removed freetype-build.patch. - * fontconfig.install: install fonts-conf.5. - * libfontconfig1-dev.install: only install manpages in section 3. - - -- Josselin Mouette Thu, 11 Mar 2004 14:17:58 +0100 - -fontconfig (2.2.1-16) unstable; urgency=low - - * Use the new debconf interface for ucf: - + fontconfig.postinst: use --debconf-ok option for ucf. - + fontconfig.postinst: remove the hack to get back stdio from debconf. - + control: depend on ucf 0.29. - * Work around objcopy breakage on alpha: - + libfontconfig1-dbg.install.alpha: copy the library to the debug - directory. - + rules: don't use --dbg-package on alpha. - - -- Josselin Mouette Sun, 22 Feb 2004 17:02:47 +0100 - -fontconfig (2.2.1-15) unstable; urgency=low - - * Make the dependencies back to ${misc:Depends} now debhelper was updated. - * Spanish debconf templates (closes: #232211). - * Danish debconf templates (closes: #233071). - - -- Josselin Mouette Fri, 20 Feb 2004 16:27:21 +0100 - -fontconfig (2.2.1-14) unstable; urgency=low - - * Rebuild with up to date cdbs (closes: #230357). - * Build-depend on docbook-utils 0.6.13. - * Make a libfontconfig1-dbg package, requiring debhelper 4.1.76. - * Remove po/ru.po (closes: #223349). - * Depend on debconf | debconf-2.0 (closes: #230520). - - -- Josselin Mouette Tue, 3 Feb 2004 13:16:29 +0100 - -fontconfig (2.2.1-13) unstable; urgency=low - - * patches/freetype-build.patch: include correctly freetype header - files (closes: #222680). - - -- Josselin Mouette Sat, 6 Dec 2003 15:32:30 +0100 - -fontconfig (2.2.1-12) unstable; urgency=low - - * fontconfig.postrm: support the case where /usr/local/share/fonts - doesn't exist (closes: #219992). - - -- Josselin Mouette Tue, 11 Nov 2003 10:42:24 +0100 - -fontconfig (2.2.1-11) unstable; urgency=low - - * fontconfig.postinst: support the case where /usr/local is mounted - read-only (closes: #219684). - - -- Josselin Mouette Sat, 8 Nov 2003 09:44:56 +0100 - -fontconfig (2.2.1-10) unstable; urgency=low - - * shlibs.local: require libfreetype6 2.1.5-3 to avoid the - gsfonts-other bug (closes: #218662). - * fontconfig.{config,postinst}: remove bashism. - * fontconfig.post{inst,rm}: really create /usr/local/share/fonts, - and remove it if non-empty on purge. - * po/ru.po: updated translation (closes: #219265). - * culmus-support.patch: removed, see below. - * fonts-conf-aliases.patch: patch from CVS, still add Culmus support, - now also support ttf-freefont (closes: #218924). - - -- Josselin Mouette Fri, 7 Nov 2003 17:02:37 +0100 - -fontconfig (2.2.1-9) unstable; urgency=low - - * rules: add /usr/local/share/fonts to the list of directories to - search for fonts. - * po/fr.po: update (closes: #218301). - * po/ja.po: update (closes: #217420). - * README.Debian: correct typo. - * patches/culmus-support.patch: support Culmus fonts for Hebrew - systems (closes: #198374). - - -- Josselin Mouette Sun, 2 Nov 2003 18:32:11 +0100 - -fontconfig (2.2.1-8) unstable; urgency=low - - * fontconfig.postinst: revert changes from 2.2.1-7 and just get back - stdin back from debconf before running ucf. Thanks a lot to Samuel - Hocevar for finding out this trick. - - -- Josselin Mouette Mon, 20 Oct 2003 15:36:03 +0200 - -fontconfig (2.2.1-7) unstable; urgency=low - - * fontconfig.postinst: when ucf fails (most likely due to being on - an autobuilder with no /dev/tty), just create local.conf if it is - not here, otherwise do nothing. - - -- Josselin Mouette Mon, 20 Oct 2003 13:45:20 +0200 - -fontconfig (2.2.1-6) unstable; urgency=low - - * Use ucf for local.conf handling (closes: #186730): - + fontconfig.{config,postinst}: remove debconf handling of - local.conf overwriting. - + fontconfig.postrm: new file. - + templates: remove overwrite_existing_local_conf. - + control: fontconfig depends on ucf 0.25. - + local.conf.md5sum: new file, containing all possible md5sums - for local.conf generated with debconf in the previous versions. - * Apply defoma patch from Angus Lees (closes: #206532, #204771): - + fontconfig.defoma: new file. - + control: build-depend and depend on defoma. - + rules: - - Run dh_installdefoma. - - Remove x-ttcidfont-conf stuff. - + README.Debian: document that fontconfig can now use defoma fonts. - + fontconfig.postinst: - - Remove old cache files in /var/lib/defoma/x-ttcidfont-conf.d - subdirectories. - - Include the defoma-generated file in local.conf. - + fontconfig.postrm: remove /var/lib/defoma/fontconfig.d. - * fonts-conf-ordering.patch: patches fonts.conf to include local.conf - before ~/.fonts.conf (closes: #215356). - * control: - + Remove po-debconf dependency, all autobuilders have a working - version now and it never made it to testing. - + Make libfontconfig1-dev depend on libfontconfig1 instead of - fontconfig. - + libfontconfig1-dev depends on libexpat1-dev. - + Make fontconfig require one of the 4 most widely used font - packages, as anyway all packages using fontconfig should - (closes: #189883). Also remove Suggests and Recommends. - * fontconfig.postrm: remove old fonts.cache-1 files in /usr/share/fonts - and /usr/X11R6/lib/X11/fonts on purge. - * No more scripts in fontconfig-udeb (closes: #216132): - + fontconfig-udeb.postinst: removed. - + rules: make dh_makeshlibs not run on fontconfig-udeb. - - -- Josselin Mouette Sun, 19 Oct 2003 11:04:35 +0200 - -fontconfig (2.2.1-5) unstable; urgency=low - - * debian/control: - + Build-depend on po-debconf 0.8.1 (closes: #214973). - + Remove trailing lines, by request of Ralf Nolden. - - -- Josselin Mouette Wed, 15 Oct 2003 21:05:45 +0200 - -fontconfig (2.2.1-4) unstable; urgency=low - - * Russian debconf templates (closes: #214337). - * French debconf templates (closes: #213141). - * Update manpages. - * Patch fc-cache to handle correctly -s (closes: #214091). - * Remove defoma comment in README.Debian. - * Ask whether to enable the autohinter (closes: #188829). - * Add a general documentation about font handling in README.Debian - (closes: #186944). - - -- Josselin Mouette Wed, 8 Oct 2003 22:23:41 +0200 - -fontconfig (2.2.1-3) unstable; urgency=low - - * New maintainer. - * fontconfig.postinst: nitpick output improvement. - * Standards-version is 3.6.1. - * Switch to po-debconf. - * Include japanese debconf templates (closes: #210733). - * Move libfontconfig1-dev to libdevel. - * Provide manpages for fc-list and fc-cache (closes: #191467). - - -- Josselin Mouette Tue, 16 Sep 2003 18:31:18 +0200 - -fontconfig (2.2.1-2) unstable; urgency=low - - * debian/control: - - Build-Depend on the latest cdbs to fix a udeb build error - (Closes: #205062) - - -- Colin Walters Tue, 26 Aug 2003 22:54:24 -0400 - -fontconfig (2.2.1-1) unstable; urgency=low - - * New upstream release. - - Eliminates italic_angle check for PS fonts - (Closes: #196739, #194832). - * debian/rules: - - Work around dh_installman bug and put fonts-conf.5 in section 5 - (Closes: #191026). - - -- Colin Walters Mon, 9 Jun 2003 20:40:57 -0400 - -fontconfig (2.2.0-5) unstable; urgency=low - - * debian/rules: - - Tighten up shlibs versioning again (Closes: #195118). - - -- Colin Walters Wed, 28 May 2003 18:53:21 -0400 - -fontconfig (2.2.0-4) unstable; urgency=low - - * debian/rules: - - Ensure fontconfig is built after libfontconfig1 (Closes: #194960). - - -- Colin Walters Tue, 27 May 2003 18:39:23 -0400 - -fontconfig (2.2.0-3) unstable; urgency=low - - * debian/control: - - Bump Standards-Version: 3.5.10, no changes required. - - Build-Depend on cdbs. - * debian/rules: - - Convert to cdbs. - * debian/rocks: - - Removed. - - -- Colin Walters Sun, 25 May 2003 04:42:10 -0400 - -fontconfig (2.2.0-2) unstable; urgency=low - - * The "Society For Creative Anachronism Seizes Control Of Russia" - release. - * debian/control: - - Recommend ttf-bitstream-vera, since it is the default fallback font - now. Plus it does look pretty nice. (Closes: #190675). - - Suggest: ttf-freefont, my favorite font. - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Tue, 6 May 2003 02:55:40 -0400 - -fontconfig (2.2.0-1) unstable; urgency=low - - * The "Harsh Light Of Morning Falls On One Night Stand's DVD Collection" - release. - * New upstream release. - - -- Colin Walters Wed, 23 Apr 2003 20:39:54 -0400 - -fontconfig (2.1.94-1) unstable; urgency=low - - * The "I speak better English than this villian Bush" release. - (Courtesy of Mohammed Saeed al-Sahaf). - * New upstream (pre)release. - * README.Debian: - - Remove experimental notice. - * debian/patches/fonts-conf-cleanup.patch: - - Update. - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Thu, 17 Apr 2003 00:13:37 -0400 - -fontconfig (2.1.93-1) unstable; urgency=low - - * The "Saddam Speech Suspiciously Mentions Nelly Song From Last Summer" - release. - * New upstream (pre)release. - - Actually puts some bytes in fontconfig-user.html (Closes: #185065) - - Handles "same" font binding (Closes: #184353) - - Handles aliases better (Closes: #179416) - - Will handle xfonts-terminus, although it's kinda ugly - (Closes: #176690) - * debian/control: - - Bump Standards-Version to 3.5.9, no changes required. - - Minor description fixes. - * debian/rocks: - - Add --enable-docs to DEB_CONFIGURE_EXTRA_FLAGS. - * debian/patches/fontconfig_pc_in-fix-version-var.patch: - - Deleted; fix was incorporated upstream. - * debian/patches/mono-font-enable.patch: - - Deleted; a better fix was incorporated upstream. - - -- Colin Walters Mon, 7 Apr 2003 22:16:52 -0400 - -fontconfig (2.1.92-5) unstable; urgency=low - - * The "Wingslinger's is definitely a mafia front" release. - * debian/control: - - Add back Depends line for fontconfig-udeb, and put libexpat1-udeb, - libfreetype6-udeb, zlib1g-udeb there. - - -- Colin Walters Sun, 6 Apr 2003 14:07:58 -0400 - -fontconfig (2.1.92-4) unstable; urgency=low - - * debian/control: - - Remove Depends for fontconfig-udeb (Closes: #187833). - * debian/fontconfig-udeb.postinst: - - New file, hacked up from fontconfig.postinst. - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Sun, 6 Apr 2003 13:18:06 -0400 - -fontconfig (2.1.92-3) unstable; urgency=low - - * debian/control: - - Merge libfontconfig1 and fontconfig packages (Closes: #185466). - - Turn libfontconfig1 and libfontconfig1-dev into dummy packages. - - Generate new fontconfig-udeb package (Closes: #183822). - * debian/patches/mono-font-enable.patch: - - New patch; enables marking fonts as monospaced again (Closes: #185239). - * debian/rocks: - - Remove old cruft like deb-common-build target. - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Fri, 28 Mar 2003 16:16:38 -0500 - -fontconfig (2.1.92-2) unstable; urgency=low - - * The "I should take up Tae Kwon Do again as a stress reliever" release. - * debian/README.Debian: - - Update with warning about bitmapped fonts. - * debian/fontconfig.templates: - - New question about overwriting existing local.conf. - * debian/fontconfig.config: - - Place into the public domain. - - Support new question about overwriting existing local.conf. - * debian/fontconfig.postinst: - - Place into the public domain. - - Support new question about overwriting existing local.conf. - - Rewrite so that we always write out the bits for bitmapped fonts and - subpixel rendering, but if they're disabled, then comment them out. - This will allow people to easily see the code so they can enable it by - hand. - - Add -v to fc-cache invocation so /var/log/fontconfig.log is a bit - more useful. - - -- Colin Walters Sun, 9 Mar 2003 14:40:43 -0500 - -fontconfig (2.1.92-1) unstable; urgency=low - - * The "I wish upstream actually used ChangeLog" release. - * New upstream (pre)release. - * debian/libfontconfig1-dev.install: - - Install upstream development HTML and text documentation. - - Install upstream development manpages. - * debian/fontconfig.install: - - Install upstream user HTML and text documentation. - - Don't include local.conf in package. D'oh! - * debian/control: - - Minor description improvements. - * debian/fontconfig.config,debian/fontconfig.postinst, - debian/fontconfig.templates: - - New debconf question about enabling bitmapped fonts. - - -- Colin Walters Fri, 7 Mar 2003 17:23:42 -0500 - -fontconfig (2.1.91-2) unstable; urgency=low - - * debian/control: - - Bump Build-Depends (and Depends for libfontconfig1-dev) on - libfreetype6-dev to the latest. This, in combination with this - version of fontconfig, will hopefully fix a lot of outstanding bugs. - - Drop Build-Depends on xlibs-dev and ed. - * debian/rocks: - - Hardcode font path here, and include - /var/lib/defoma/x-ttcidfont-conf.d/dirs in default font path - (Closes: #183342, #176020). - - -- Colin Walters Thu, 6 Mar 2003 22:00:13 -0500 - -fontconfig (2.1.91-1) unstable; urgency=low - - * New upstream (pre)release. - * debian/patches/fontconfig_pc_in-fix-version-var.patch: - - New patch (Closes: #183418). - - -- Colin Walters Wed, 5 Mar 2003 01:02:17 -0500 - -fontconfig (2.1.90-1) unstable; urgency=low - - * New upstream (pre)release. - * debian/patches/CVS-HEAD-subpixel-rendering-fix.patch, - debian/patches/fail-on-submake-failure.patch, - debian/patches/owen-fc-cache-fix.patch: - - Included upstream now; deleted. - * debian/patches/fonts-conf-cleanup.patch: - - New patch. Removes the date from fonts.conf, and helps move - subpixel rendering bits into local.conf. - * debian/control: - - [libfontconfig1-dev] Add Depends on pkg-config. - - Add Build-Depends on docbook-utils. - * debian/rocks: - - Remove manpage stuff. - * debian/fontconfig.templates, debian/fontconfig.config, - debian/fontconfig.postinst: - - Debconfiscation. Now prompts for subpixel rendering bits - (Closes: #182748). - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Sun, 2 Mar 2003 13:29:35 -0500 - -fontconfig (2.1-15) unstable; urgency=low - - * debian/control: - - Build-Depend on xlibs-dev (>= 4.2.0). - * debian/patches/owen-fc-cache-fix.patch: - - New patch, pulled from the GARNOME CVS; edited slightly. - This should fix those crashes in FcConfigAdd (Closes: #178780). - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Fri, 17 Jan 2003 13:20:09 -0500 - -fontconfig (2.1-14) unstable; urgency=low - - * debian/patches/CVS-HEAD-subpixel-rendering-fix.patch: - - New patch, should fix crashes when subpixel rendering is - turned on (Closes: #175903). Big thanks to - Michael Guntsche for extracting the relevant fix - from CVS! - - -- Colin Walters Fri, 10 Jan 2003 13:30:28 -0500 - -fontconfig (2.1-13) unstable; urgency=low - - * debian/rocks: - - Tighten up shlibs for libfontconfig1. - - -- Colin Walters Wed, 8 Jan 2003 22:34:53 -0500 - -fontconfig (2.1-12) unstable; urgency=low - - * debian/fontconfig.postinst: - - Redirect fc-cache error messages to /var/log/fontconfig.log, and - refer the user to this upon failure (Closes: #174507). - - -- Colin Walters Fri, 3 Jan 2003 15:04:05 -0500 - -fontconfig (2.1-11) unstable; urgency=low - - * debian/control: - - Remove Build-Depends on zlib1g; instead Build-Depend on the very - latest libfreetype6-dev which does this for us. - * debian/fontconfig.postinst: - - Display a little message about regenerating the fonts cache. - - -- Colin Walters Wed, 25 Dec 2002 01:08:05 -0500 - -fontconfig (2.1-10) unstable; urgency=low - - * debian/patches/fail-on-submake-failure.patch: - - New patch. This way at least the package won't build in the future - if there is a failure. - * debian/control: - - Build-Depend on zlib1g-dev directly until freetype is fixed. - - Change fontconfig section to utils. - - -- Colin Walters Sun, 22 Dec 2002 21:37:25 -0500 - -fontconfig (2.1-9) unstable; urgency=low - - * The " "*PANT* *PANT* YEAH BABY!!!! - FRESH COMMITS TO (freetype) CVS!!!!" *PANT* *PANT*" release. - * debian/control: - - Build-Depend on the very latest freetype, the previous version of - which was a CVS snapshot that broke the fontconfig build, and in fact - the build of almost any package dependent on freetype; see #173834. - Closes: #173900. - - Build-Depend on debhelper (>= 4.1.1) since we use some features from - it with CBS in this package (Closes: #173941). - * debian/fontconfig.postinst: - - New file, with the important contents stolen from Red Hat 8's - postinst. Thanks Anthony Fok . (Closes: #173949). - - -- Colin Walters Sun, 22 Dec 2002 03:36:21 -0500 - -fontconfig (2.1-8) unstable; urgency=low - - * debian/control: - - Build-Depend on xlibs-dev. This should fix the issue with - /usr/X11R6/lib/fonts or whatever being missing from fonts.conf. - - Mention more prominently that fontconfig doesn't depend on X. - * debian/rocks: - - Install fc-cache, fc-list, and fontconfig manpages - (Closes: #173748). - - -- Colin Walters Sat, 21 Dec 2002 02:54:36 -0500 - -fontconfig (2.1-7) unstable; urgency=low - - * debian/control: - - [libfontconfig1-dev] Add a Conflicts: fontconfig (<< 2.1-5) so that - we ensure upgrading happens in the correct order (due to - fontconfig-config switching packages). - - -- Colin Walters Wed, 11 Dec 2002 00:48:31 -0500 - -fontconfig (2.1-6) unstable; urgency=low - - * debian/patches/no-date-in-fonts-conf.patch: - - New patch; this will prevent the fonts.conf conffile from changing - on every package upload. - * debian/README.Debian: - - Update. - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Tue, 10 Dec 2002 14:48:24 -0500 - -fontconfig (2.1-5) unstable; urgency=low - - * debian/libfontconfig1-dev.install: - - Install fontconfig-config. - * debian/fontconfig.install - - Don't install fontconfig-config. - * debian/control: - - [libfontconfig1-dev] Add Depends: on libfreetype6-dev - (Closes: #172488) - * debian/rules: - - Update to the latest version of Colin's Build System. - * debian/rocks: - - Add debian/tmp/usr/lib/ to DEB_SHLIBDEPS_INCLUDE - (Closes: #172432). - - Ensure libfontconfig1 is built before fontconfig. - - -- Colin Walters Mon, 9 Dec 2002 23:54:06 -0500 - -fontconfig (2.1-4) unstable; urgency=low - - * debian/control: - - Really Build-Depend on ed (Closes: #172245). Now how did I add it - to the changelog, but not control? Don't ask me...) - * debian/rules: - - Update to the latest version of Colin's Build System. - - -- Colin Walters Mon, 9 Dec 2002 12:59:07 -0500 - -fontconfig (2.1-3) unstable; urgency=low - - * debian/control: - - Build-Depend on ed. - * debian/rules: - - Update to the latest version of Colin's Build System. - * debian/rocks: - - Remove extra cruft in deb-extra-clean rule. - - -- Colin Walters Sun, 8 Dec 2002 20:58:26 -0500 - -fontconfig (2.1-2) unstable; urgency=low - - * First upload to unstable; Closes: #170559. - * debian/rules: - - Update to latest version of Colin's Build System. - - -- Colin Walters Fri, 6 Dec 2002 01:37:16 -0500 - -fontconfig (2.1-1) unstable; urgency=low - - * New upstream version. - * debian/rules: - - Use Colin's Build System. - * debian/control: - - Bump Standards-Version to 3.5.8. - * debian/copyright: - - Fix Upstream Authors. - - -- Colin Walters Tue, 3 Dec 2002 22:38:28 -0500 - -fontconfig (2.0-2) unstable; urgency=low - - * debian/control: - - [fontconfig] New package; install configuration files and binaries in it. - - [libfontconfig1-dev] Fix up description. - - -- Colin Walters Mon, 14 Oct 2002 23:06:59 -0400 - -fontconfig (2.0-1) unstable; urgency=low - - * Initial version. - - -- Colin Walters Sun, 13 Oct 2002 14:43:56 -0400 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index b8626c4..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/debian/control b/debian/control deleted file mode 100644 index 4fc04fa..0000000 --- a/debian/control +++ /dev/null @@ -1,79 +0,0 @@ -Source: fontconfig -Section: libs -Priority: optional -Maintainer: Keith Packard -Uploaders: Keith Packard , Josselin Mouette -Build-Depends: cdbs (>= 0.4.5.4), debhelper (>= 4.1.76), libfreetype6-dev (>= 2.1.7), libexpat1-dev, docbook-utils (>= 0.6.13), docbook-to-man, defoma (>= 0.7.0), binutils (>= 2.12.90.0.9) -Standards-Version: 3.6.1 - -Package: fontconfig -Section: utils -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, defoma (>= 0.7.0), ucf (>= 0.29), ttf-bitstream-vera | ttf-freefont | gsfonts-x11 | msttcorefonts -Conflicts: libfontconfig1-dev (<< 2.2.2-1) -Description: generic font configuration library - Fontconfig is a font configuration and customization library, which - does not depend on the X Window System. It is designed to locate - fonts within the system and select them according to requirements - specified by applications. - . - Fontconfig is not a rasterization library, nor does it impose a - particular rasterization library on the application. The X-specific - library 'Xft' uses fontconfig along with freetype to specify and - rasterize fonts. - . - This package contains a program to maintain the fontconfig cache - (fc-cache), and a sample program to list installed fonts (fc-list). - -Package: fontconfig-udeb -Section: debian-installer -Architecture: any -Depends: libexpat1-udeb, libfreetype6-udeb, zlib1g-udeb -Description: generic font configuration library (shared library) - Fontconfig is a font configuration and customization library, which - does not depend on the X Window System. It is designed to locate - fonts within the system and select them according to requirements - specified by applications. - . - See the "fontconfig" package description for more information. - -Package: libfontconfig1-dev -Section: libdevel -Architecture: any -Depends: libfontconfig1 (= ${Source-Version}), libexpat1-dev, libfreetype6-dev (>= 2.1.7), pkg-config -Provides: libfontconfig-dev -Conflicts: libfontconfig-dev, fontconfig (<< 2.1-5) -Description: generic font configuration library (development headers) - Fontconfig is a font configuration and customization library, which - does not depend on the X Window System. It is designed to locate - fonts within the system and select them according to requirements - specified by applications. - . - See the "fontconfig" package description for more information. - -Package: libfontconfig1 -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, fontconfig -Description: generic font configuration library (shared library) - Fontconfig is a font configuration and customization library, which - does not depend on the X Window System. It is designed to locate - fonts within the system and select them according to requirements - specified by applications. - . - See the "fontconfig" package description for more information. - -Package: libfontconfig1-dbg -Section: libdevel -Priority: extra -Architecture: any -Depends: libfontconfig1 (= ${Source-Version}) -Description: generic font configuration library (debugging symbols) - Fontconfig is a font configuration and customization library, which - does not depend on the X Window System. It is designed to locate - fonts within the system and select them according to requirements - specified by applications. - . - This package contains the debugging symbols associated with - libfontconfig1. They will automatically be used by gdb for debugging - fontconfig-related issues. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 8a399ec..0000000 --- a/debian/copyright +++ /dev/null @@ -1,29 +0,0 @@ -This package was debianized by Colin Walters on -Sun, 13 Oct 2002 15:01:50 -0400 - -It was downloaded from http://www.fontconfig.org/ - -Upstream Author: Keith Packard - -Copyright: - -Copyright © 2001,2003 Keith Packard - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the name of Keith Packard not be used in -advertising or publicity pertaining to distribution of the software without -specific, written prior permission. Keith Packard makes no -representations about the suitability of this software for any purpose. It -is provided "as is" without express or implied warranty. - -KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - diff --git a/debian/fontconfig-udeb.install b/debian/fontconfig-udeb.install deleted file mode 100644 index 3b34148..0000000 --- a/debian/fontconfig-udeb.install +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/lib/libfontconfig*.so.* -debian/tmp/etc/* -debian/tmp/usr/bin/* diff --git a/debian/fontconfig.config b/debian/fontconfig.config deleted file mode 100755 index 6e364ab..0000000 --- a/debian/fontconfig.config +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e - -. /usr/share/debconf/confmodule - -db_input low fontconfig/hinting_type || true -db_input low fontconfig/subpixel_rendering || true -db_input low fontconfig/enable_bitmaps || true -db_go diff --git a/debian/fontconfig.defoma b/debian/fontconfig.defoma deleted file mode 100644 index 7558667..0000000 --- a/debian/fontconfig.defoma +++ /dev/null @@ -1,162 +0,0 @@ -# -*- perl -*- -# Defoma configuration script for fontconfig -# Copyright © 2003 Angus Lees -# This file is hereby placed into the public domain. - -@ACCEPT_CATEGORIES = qw(type1 truetype cid); -# .. and any other categories supported by freetype - -package fontconfig; - -use Debian::Defoma::Common; -use Debian::Defoma::Id; -use Debian::Defoma::Subst; - -use strict; -use warnings; - -my $PkgDir = "$ROOTDIR/fontconfig.d"; -my ($Id, $Sb); - -sub init { - $Id ||= defoma_id_open_cache() or return 1; - $Sb ||= defoma_subst_open(rulename => 'fontconfig', - threshold => 70, - idobject => $Id) or return 1; - - return 0; -} - -sub register { - my $font = shift; - my $hints = parse_hints_start(@_); - - return 1 unless $hints->{FontName}; - - my $priority = $hints->{Priority} || 20; - my ($fontname) = split / +/, $hints->{FontName}; - my @alias = split / +/, $hints->{Alias} if $hints->{Alias}; - - defoma_id_register($Id, type => 'real', font => $font, - id => $fontname, priority => $priority, - hints => join(' ', @_)); - - foreach my $alias (@alias) { - defoma_id_register($Id, type => 'alias', font => $font, - id => $alias, priority => $priority, - origin => $fontname); - } - - defoma_subst_register($Sb, $font, $fontname); - - return 0; -} - -sub unregister { - my $font = shift; - defoma_subst_unregister($Sb, $font); - defoma_id_unregister($Id, type => 'alias', font => $font); - defoma_id_unregister($Id, type => 'real', font => $font); - return 0; -} - -sub do_install_real { - my $font = shift; - my $id = shift; - - my $dir = $PkgDir . '/' . substr($id, 0, 1); - my $ext = $font =~ m|\.([^/.]+)$| ? ".$1" : ''; - my $file = $id . $ext; - - mkdir $dir; - symlink $font, "$dir/$file" or return 1; - - return 0; -} - -sub do_remove_real { - my $font = shift; - my $id = shift; - - my $dir = $PkgDir . '/' . substr($id, 0, 1); - my $ext = $font =~ m|\.([^/.]+)$| ? ".$1" : ''; - my $file = $id . $ext; - - unlink "$dir/$file" or return 1; - rmdir $dir; # ignore failure - - return 0; -} - -sub term { - return unless $Id; - - open my $fh, '>', "$PkgDir/fonts.conf" or return 1; - - print $fh < - - - - $PkgDir -EOF - - # aliases - foreach (defoma_id_get_font($Id, installed => type => 'SaI')) { - print $fh < - $Id->{e_id}->[$_] - $Id->{e_depid}->[$_] - -EOF - } - - # substituded fonts - foreach (defoma_id_get_font($Id, installed => type => 'SSI')) { - print $fh < - $Id->{e_id}->[$_] - $Id->{e_depid}->[$_] - -EOF - } - - print $fh "\n"; - - close $fh; - - defoma_subst_close($Sb); - defoma_id_close_cache($Id); - - system('fc-cache', $PkgDir); - - return 0; -} - -sub main { - my $cmd = shift; - - if ($cmd eq 'init') { - init(); - } elsif ($cmd eq 'register') { - return register(@_); - } elsif ($cmd eq 'unregister') { - return unregister(@_); - } elsif ($cmd eq 'do-install-real') { - return do_install_real(@_); - } elsif ($cmd eq 'do-remove-real') { - return do_remove_real(@_); - } elsif ($cmd eq 'term') { - return term(@_); - } - - 0; -} - -no warnings; - -*truetype = \&main; -*type1 = \&main; -*cid = \&main; - -1; diff --git a/debian/fontconfig.dirs b/debian/fontconfig.dirs deleted file mode 100644 index 336da93..0000000 --- a/debian/fontconfig.dirs +++ /dev/null @@ -1 +0,0 @@ -/var/lib/fontconfig diff --git a/debian/fontconfig.install b/debian/fontconfig.install deleted file mode 100644 index def0010..0000000 --- a/debian/fontconfig.install +++ /dev/null @@ -1,7 +0,0 @@ -debian/tmp/usr/bin/fc-* -debian/tmp/etc/fonts/fonts.* -debian/tmp/etc/fonts/conf.d/* -debian/tmp/usr/share/doc/fontconfig/fontconfig-user.* -debian/tmp/usr/share/man/man5 -debian/tmp/usr/share/man/man1 -debian/local.conf.md5sum /usr/share/fontconfig diff --git a/debian/fontconfig.postinst b/debian/fontconfig.postinst deleted file mode 100755 index 7030cdb..0000000 --- a/debian/fontconfig.postinst +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh - -set -e - -. /usr/share/debconf/confmodule - -LOCALCONF=/var/lib/fontconfig/local.conf -rm -f $LOCALCONF - -CONFDIR=/etc/fonts/conf.d - -db_get fontconfig/hinting_type -hinting_type="$RET" - -hint_prio="10-debconf-" -unhinted="unhinted.conf" -autohint="autohint.conf" - -if [ -h $CONFDIR/$hint_prio$unhinted ]; then - rm $CONFDIR/$hint_prio$unhinted -fi -if [ -h $CONFDIR/$hint_prio$autohint ]; then - rm $CONFDIR/$hint_prio$autohint -fi - -case "$hinting_type" in -"Native") - ;; -"Autohinter") - ln -s $CONFDIR/$autohint $CONFDIR/$hint_prio$autohint - ;; -"None") - ln -s $CONFDIR/$unhinted $CONFDIR/$hint_prio$unhinted - ;; -esac - -db_get fontconfig/subpixel_rendering -subpixel_rendering="$RET" - -subpixel_prio="20-debconf-" -subpixel="sub-pixel.conf" -no_subpixel="no-sub-pixel.conf" - -if [ -h $CONFDIR/$subpixel_prio$subpixel ]; then - rm $CONFDIR/$subpixel_prio$subpixel -fi - -if [ -h $CONFDIR/$subpixel_prio$no_subpixel ]; then - rm $CONFDIR/$subpixel_prio$no_subpixel -fi - -case "$subpixel_rendering" in -"Automatic") - ;; -"Always") - ln -s $CONFDIR/$subpixel $CONFDIR/$subpixel_prio$subpixel - ;; -"Never") - ln -s $CONFDIR/$no_subpixel $CONFDIR/$subpixel_prio$no_subpixel - ;; -esac - -db_get fontconfig/enable_bitmaps -enable_bitmaps="$RET" - -bitmaps_prio="30-debconf-" -yes_bitmaps="yes-bitmaps.conf" -no_bitmaps="no-bitmaps.conf" - -if [ -h $CONFDIR/$bitmaps_prio$yes_bitmaps ]; then - rm $CONFDIR/$bitmaps_prio$yes_bitmaps -fi - -if [ -h $CONFDIR/$bitmaps_prio$no_bitmaps ]; then - rm $CONFDIR/$bitmaps_prio$no_bitmaps -fi - -case "$enable_bitmaps" in -"true") -# -# Bitmap fonts will be enabled by default, so there's no need -# to use this configuration file. However, the file remains useful if -# you want to force bitmaps to be considered even when some application -# disables them. -# -# ln -s $CONFDIR/$yes_bitmaps $CONFDIR/$bitmaps_prio$yes_bitmaps - ;; -*) - ln -s $CONFDIR/$no_bitmaps $CONFDIR/$bitmaps_prio$no_bitmaps - ;; -esac - -cp /dev/null $LOCALCONF -rm -f $LOCALCONF.md5sum -ln -sf /usr/share/fontconfig/local.conf.md5sum $LOCALCONF.md5sum -ucf --debconf-ok $LOCALCONF /etc/fonts/local.conf -rm -f $LOCALCONF.md5sum - -# if the local.conf file is now empty, remove it - -if [ -s /etc/fonts/local.conf ]; then - : -else - if [ -f /etc/fonts/local.conf ]; then - rm /etc/fonts/local.conf - fi -fi - -# Create /usr/local/share/fonts -LOCALDIR=/usr/local/share/fonts -if [ ! -d $LOCALDIR ]; then - if mkdir $LOCALDIR 2>/dev/null ; then - chmod 2775 $LOCALDIR - chown root:staff $LOCALDIR - fi -fi - -if [ "$1" = configure ]; then - # Ensure Defoma subst file exists, with some default substitutions - if ! defoma-subst check-rule fontconfig; then - defoma-subst new-rule fontconfig \ - 'serif --GeneralFamily,* Roman --Shape Serif Upright --Weight Medium' \ - 'sans-serif --GeneralFamily,* SansSerif --Shape NoSerif Upright --Weight Medium' \ - 'monospace --Width,* Fixed --GeneralFamily,2 Typewriter --Shape Upright --Weight Medium' - fi -fi - -if [ -d /var/lib/defoma/x-ttcidfont-conf.d ]; then - # Remove old fonts.cache-1 files - find /var/lib/defoma/x-ttcidfont-conf.d -name fonts.cache-1 | xargs rm -f -fi - -#DEBHELPER# - -if [ "$1" = configure ]; then - # (Hacked up from Red Hat 8 fontconfig RPM) - # Force regeneration of all fontconfig cache files. - # The redirect is because fc-cache is giving warnings about ~/fc.cache - # the HOME setting is to avoid problems if HOME hasn't been reset - printf "Regenerating fonts cache... " - HOME=/root fc-cache -f -v 1>/var/log/fontconfig.log 2>&1 || (printf "failed.\nSee /var/log/fontconfig.log for more information.\n"; exit 1) - printf "done.\n" -fi - -exit 0 diff --git a/debian/fontconfig.postrm b/debian/fontconfig.postrm deleted file mode 100644 index 88598c3..0000000 --- a/debian/fontconfig.postrm +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh -# postrm script for fontconfig - -set -e - -CONF=/etc/fonts/local.conf - -case "$1" in - purge) - if [ -x /usr/bin/ucf ]; then - ucf --purge $CONF - fi - rm -f $CONF - rm -rf /var/lib/fontconfig /var/lib/defoma/fontconfig.d - for dir in /usr/share/fonts /usr/X11R6/lib/X11/fonts /usr/local/share/fonts ; do - if [ -d $dir ]; then - find $dir -name fonts.cache-1 | xargs rm -f - fi - done - rmdir /usr/local/share/fonts 2> /dev/null || true - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/fontconfig.templates b/debian/fontconfig.templates deleted file mode 100644 index aa89b31..0000000 --- a/debian/fontconfig.templates +++ /dev/null @@ -1,27 +0,0 @@ -Template: fontconfig/hinting_type -Type: select -_Choices: Native, Autohinter, None -Default: Native -_Description: How should fonts be tuned for the screen? - Select Native if you mostly use Bitstream Vera (the default in Debian) or - any of the Microsoft fonts. Select Autohinter if you mostly use other - TrueType fonts. Select None if you want blurry text. - -Template: fontconfig/subpixel_rendering -Type: select -_Choices: Automatic, Always, Never -Default: Automatic -_Description: Enable subpixel rendering of text? - Rendering text at a subpixel level generally makes it look a bit better - on flat (LCD) screens, but can show color artifacts on CRT screens. The - "Automatic" choice will enable it only if a LCD screen is detected. - -Template: fontconfig/enable_bitmaps -Type: boolean -Default: false -_Description: Enable bitmapped fonts by default? - By default, only outline fonts are used by applications which support - fontconfig. Outline fonts are fonts which scale well to various sizes. - In contrast, bitmapped fonts are often lower quality. Enabling this option - will affect the systemwide default; this and many other fontconfig options - may be enabled or disabled on a per-user basis. diff --git a/debian/libfontconfig1-dev.install b/debian/libfontconfig1-dev.install deleted file mode 100644 index 50af778..0000000 --- a/debian/libfontconfig1-dev.install +++ /dev/null @@ -1,7 +0,0 @@ -debian/tmp/usr/include/fontconfig/* -debian/tmp/usr/lib/pkgconfig/fontconfig.pc -debian/tmp/usr/lib/libfontconfig*.a -debian/tmp/usr/lib/libfontconfig*.so -debian/tmp/usr/share/man/man3 -debian/tmp/usr/share/doc/fontconfig/fontconfig-devel* usr/share/doc/libfontconfig1-dev/ - diff --git a/debian/libfontconfig1.install b/debian/libfontconfig1.install deleted file mode 100644 index af6d5ed..0000000 --- a/debian/libfontconfig1.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libfontconfig*.so.* diff --git a/debian/local.conf.md5sum b/debian/local.conf.md5sum deleted file mode 100644 index 402ac6d..0000000 --- a/debian/local.conf.md5sum +++ /dev/null @@ -1,18 +0,0 @@ -175d36e26749eea8f1e6b98d4383a311 2.1.90-1a -85ca344319416083e7907d407472f51c 2.1.90-1b -0d5e958e03c3bc410bbf1edfd05c9a0a 2.1.92-1a -c59ba7d38a9e167781b2dea6202836c5 2.1.92-1b -85ca344319416083e7907d407472f51c 2.1.92-1c -5095e9ad666ed7615f4fea48c03c34c3 2.1.92-1d -30dd06e06a0bdfe5807aaec6dfd32c00 2.1.92-2a -abc56a60f57d08723367d2baabff52e8 2.1.92-2b -d70b4afe9a9500bbb64f85a3cf5d07d1 2.1.92-2c -5257c46342ff7e5322721f0bcefc7df2 2.1.92-2d -924af23e6df6c7947344fbbd9699ddbf 2.2.1-4a -ebc36a4fd11fc3dbcc1e6247d641fb1e 2.2.1-4b -ad908e2bf7c005e791060ab505778982 2.2.1-4c -2f20274fa03fc04050c9d36a783a1b4d 2.2.1-4d -de9be282507bca2c4dd90ce8ed8e14da 2.2.1-4e -b7d75b0803bcc247db190ffdcc1d2621 2.2.1-4f -77b9ecac7dde1e290214a0551ba71189 2.2.1-4g -559b9c549f10510a39b8ac104f7cf0e2 2.2.1-4h diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in deleted file mode 100644 index e8c4d38..0000000 --- a/debian/po/POTFILES.in +++ /dev/null @@ -1 +0,0 @@ -[type: gettext/rfc822deb] fontconfig.templates diff --git a/debian/po/cs.po b/debian/po/cs.po deleted file mode 100644 index f403e3e..0000000 --- a/debian/po/cs.po +++ /dev/null @@ -1,126 +0,0 @@ -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans -# -# Developers do not need to manually edit POT or PO files. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-10 19:01-0800\n" -"PO-Revision-Date: 2005-03-30 17:34+0200\n" -"Last-Translator: Miroslav Kure \n" -"Language-Team: Czech \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "Nativní, Autohinter, Nijak" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "Jak se mají fonty vyladit pro obrazovku?" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" -"Používáte-li větÅ¡inou Bitstream Vera (výchozí v Debianu) nebo některý z " -"fontů Microsoftu, vyberte Nativní. Autohinter je vhodný pro ostatní " -"TrueTypová písma. Chcete-li rozmazaný text, zvolte Nijak." - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "Automaticky, Vždy, Nikdy" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "Povolit podpixelové vykreslování textu?" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" -"Vykreslování textu na podpixelové úrovni způsobí, že na plochých (LCD) " -"obrazovkách vypadá o něco lépe, ale na CRT monitorech může zobrazovat " -"barevné artefakty. Možnost \"Automaticky\" povolí podpixelové vykreslování " -"pouze pokud bude rozpoznán LCD monitor." - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Povolit implicitně bitmapové fonty?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Implicitně jsou v aplikacích podporujících fontconfig používány pouze " -"obrysové fonty. Tyto fonty se velmi dobře zvětÅ¡ují a zmenÅ¡ují. Oproti nim " -"mohou zvětÅ¡ované bitmapové fonty vypadat kostrbatě. Tato volba ovlivní " -"implicitní nastavení celého systému, nicméně uživatelé si ji mohou změnit ve " -"svém osobním nastavení." - -msgid "With what method should fonts be hinted?" -msgstr "Která metoda hintingu se má pro fonty použít?" - -msgid "" -"Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -"screens)" -msgstr "" -"Interpret bytekódu (CRT monitory), Autohinter, Podpixelové renderování (LCD " -"obrazovky)" - -msgid "" -"The Freetype font library is able to render fonts with different methods. " -"Depending on your hardware and the fonts you generally use, some will give " -"better results." -msgstr "" -"Knihovna Freetype umí vykreslovat písma různými metodami. Podle vaÅ¡eho " -"hardwaru a typu použitých fontů můžete s některými metodami dosáhnout " -"lepších výsledků." - -msgid "" -"The autohinter module is the default; it gives correct results on most " -"configurations. The bytecode interpreter renders fonts very sharply, and is " -"often a better choice if you are using a cathode-ray screen. On the other " -"hand, the subpixel rendering method is optimized for high-quality rendering " -"on most liquid crystal displays." -msgstr "" -"Modul autohinter je implicitní, protože dává správné výsledky na větÅ¡ině " -"konfigurací. Interpret bytekódu kreslí písma velmi ostře a pokud máte " -"klasický monitor, bývá často lepší volbou. Analogicky je podpixelové " -"renderování přizpůsobeno pro vysoce kvalitní výstup na větÅ¡ině LCD monitorů." diff --git a/debian/po/da.po b/debian/po/da.po deleted file mode 100644 index fa8d849..0000000 --- a/debian/po/da.po +++ /dev/null @@ -1,146 +0,0 @@ -# translation of fontconfig debconf template to Danish -# Reviewed by Ole Laursen, 2004 -# Claus Hindsgaul , 2004, 2005. -# -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig_2.2.2-1_da\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-10 19:01-0800\n" -"PO-Revision-Date: 2005-04-14 10:34+0200\n" -"Last-Translator: Claus Hindsgaul \n" -"Language-Team: Danish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.9.1\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "Indbygget, Autohinter, Ingen" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "Hvordan skal skrifterne tilpasses skærmen?" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" -"Vælg Indbygget hvis du mest benytter Bitstream Vera (standarden i Debian) " -"eller nogen af Microsoft-skrifterne. Vælg Autohinter hvis du mest benytter " -"andre Truetype-skrifter. Vælg Ingen hvis du ønsker utydelig tekst." - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "Automatisk, Altid, Aldrig" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "Aktivér delpiksel-tekstoptegning?" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" -"Optegningen af tekst pÃ¥ delpikselniveau fÃ¥r generelt teksten til at se bedre " -"ud pÃ¥ fladskærme (LCD), men kan give uønskede farver i kanterne pÃ¥ CRT-skærme. " -"Valget \"Automatisk\" vil kun aktivere delpiksel-tekstoptegningen, hvis der " -"detekteres en LCD-skærm." - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Aktivér billedbaserede skrifttyper som standard?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Som udgangspunkt bruges kun vektor-skrifttyper af programmer, der " -"understøtter fontconfig. Vektor-skrifttyper skalerer godt til forskellige " -"størrelser. Derimod er billedbaserede skrifttyper (\"bitmap fonts\") ofte af " -"dÃ¥rligere kvalitet. Aktivering af denne funktion vil pÃ¥virke hele systemets " -"standardindstilling. Denne og mange andre fontconfig-tilvalg kan aktiveres " -"eller deaktiveres for hver enkelt bruger." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Hvilken metode skal benyttes til at tegne tekst?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Bytekode-fortolker (billedrør), Autohinter, Delpiksel-optegning (LCD-" -#~ "skærme)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "Skrifttypebiblioteket Freetype kan tegne skrifter med forskellige " -#~ "metoder. Afhængigt af dit udstyr og de skrifter, du normalt bruger, vil " -#~ "nogle være bedre end andre." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "Autohinter-modulet er valgt som standard; det giver de korrekte " -#~ "resultater i de fleste opsætninger. Bytekode-fortolkeren tegner " -#~ "skrifterne meget skarpt op, og er oftest det bedste velg, hvis du bruger " -#~ "en billedrørs-skærm. PÃ¥ den anden side er delpiksel-optegningsmetoden " -#~ "optimeret til visning pÃ¥ den høje kvalitet, fladskærme (LCD) besidder." - -#~ msgid "" -#~ "If you have an LCD display, then you will want to enable this option. It " -#~ "allows for higher-quality text rendering. For more information, please " -#~ "see the fontconfig manual in /usr/share/doc/fontconfig/ on your Debian " -#~ "system." -#~ msgstr "" -#~ "Hvis du har en LCD-skærm, bør du aktivere denne funktion. Den tillader " -#~ "tekstoptegning i højere kvalitet. Flere oplysninger finder du i " -#~ "fontconfigs brugervejledning i /usr/share/doc/fontconfig/ pÃ¥ dit " -#~ "Debiansystem." - -#~ msgid "Enable the freetype autohinter module?" -#~ msgstr "Aktivér freetype-autohinter-modul?" - -#~ msgid "" -#~ "Depending on your display and on which fonts you use, they can look " -#~ "better or worse when using the autohinter module. Enable it if you happen " -#~ "to prefer the look it gives to your fonts." -#~ msgstr "" -#~ "Afhængig af din skærm og hvilke skrifttyper, du bruger, kan de se bedre " -#~ "eller dÃ¥rligere ud, nÃ¥r du bruger autohinter-modulet. Aktivér det, hvis " -#~ "du foretrækker det udseende, det giver dine skrifttyper." - diff --git a/debian/po/de.po b/debian/po/de.po deleted file mode 100644 index 58f74e7..0000000 --- a/debian/po/de.po +++ /dev/null @@ -1,124 +0,0 @@ -# translation of fontconfig_2.2.2-2_templates.po to German -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans# -# Developers do not need to manually edit POT or PO files. -# Erik Schanze , 2004. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig_2.2.3-3_de\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-11-13 17:50+0100\n" -"Last-Translator: Erik Schanze \n" -"Language-Team: German \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.3.1\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Standardmäßig Bitmap-Schriften verwenden?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Standardmäßig werden von Anwendungen, die fontconfig unterstützen, nur " -"Outline-Schriften verwendet. Outline-Schriften können gut in verschiedene " -"Größen skaliert werden. Bitmap-Schriften sind im Gegensatz dazu oft von " -"geringerer Qualität. Mit dem Einschalten dieser Option wird sie zum " -"systemweiten Standard; diese und viele andere Einstellungen von fontconfig " -"können benutzerbezogen ein- und ausgeschaltet werden." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Wie sollen Schriften gerendert werden?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Bytecode-Interpreter (Röhrenmonitore), Autohinter, Subpixel-Rendering " -#~ "(Flachbildschirme)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "Die Schriftart-Bibliothek Freetype kann Schriften verschiedenartig " -#~ "rendern. Von Ihren Geräten und den normalerweise genutzten Schriften, " -#~ "hängt es ab, welche Methode zu besseren Ergebnissen führt." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "Das Modul Autohinter ist voreingestellt; es führt mit den meisten Geräten " -#~ "zu guten Ergebnissen. Der Bytecode-Interpreter stellt Schriften sehr " -#~ "scharfkantig dar und ist bei Kathodenstrahl-Monitoren meist die bessere " -#~ "Wahl. Dagegen ist das Subpixel-Rendering auf hohe Render-Qualität für die " -#~ "meisten Flüssigkristall-Bildschirme optimiert." diff --git a/debian/po/es.po b/debian/po/es.po deleted file mode 100644 index 4900eff..0000000 --- a/debian/po/es.po +++ /dev/null @@ -1,163 +0,0 @@ -# fontconfig debconf translation to spanish -# Copyright (C) 2004 Software in the Public Interest -# This file is distributed under the same license as the fontconfig package. -# -# Changes: -# - Initial translation -# Fco. Javier Sánchez Castelo , 2004 -# - Revision: -# Javier Fernández-Sanguino Peña -# - Translation of new paragraphs: -# Rubén Porras , 2004 -# -# Traductores, si no conoce el formato PO, merece la pena leer la -# documentación de gettext, especialmente las secciones dedicadas a este -# formato, por ejemplo ejecutando: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Equipo de traducción al español, por favor lean antes de traducir -# los siguientes documentos: -# -# - El proyecto de traducción de Debian al español -# http://www.debian.org/intl/spanish/coordinacion -# especialmente las notas de traducción en -# http://www.debian.org/intl/spanish/notas -# -# - La guía de traducción de po's de debconf: -# /usr/share/doc/po-debconf/README-trans -# o http://www.debian.org/intl/l10n/po-debconf/README-trans -msgid "" -msgstr "" -"Project-Id-Version: fontconfig 2.2.3-3\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-10-24 14:05+0200\n" -"Last-Translator: Rubén Porras\n" -"Language-Team: Debian Spanish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-15\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -#, fuzzy -msgid "Enable subpixel rendering of text?" -msgstr "¿Activar el renderizado de sub-pixel de texto?" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "¿Activar el tipo de letra «bitmapped» por omisión?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Por omisión, sólo las aplicaciones que admiten fontconfig usan tipos de " -"letra «outline». Estos tipos de letra escalan bastante bien en distintos " -"tamaños. Sin embargo, el tipo de letra bitmapped es habitualmente de peor " -"calidad. Activar esta opción afectará al valor por omisión de todo el " -"sistema; los usuarios podrán, de forma individual, activar ésta y muchas " -"otras opciones de fontconfig." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "¿Con qué método se deben interpretar los textos?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Intérprete «bytecode» (pantallas TRC), «Autohinter», Intérprete mediante " -#~ "subpíxeles (pantallas LCD)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "La biblioteca Freetype es capaz de interpretar los tipos de letra usando " -#~ "varios métodos. Dependiendo del hardware y los tipos de letra que use " -#~ "habitualmente, algunos darán mejores resultados." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "El módulo «autohinter» es el predeterminado; obtiene resultados correctos " -#~ "en la mayoría de las configuraciones. El intérprete «bytecode» genera " -#~ "tipos de letra muy marcada, y suele ser la mejor opción si usa una " -#~ "pantalla de rayos catódicos. Por otro lado, el intérprete mediante " -#~ "subpíxeles está optimizado para obtener resultados de alta calidad en " -#~ "pantallas de cristal líquido." - -#~ msgid "" -#~ "If you have an LCD display, then you will want to enable this option. It " -#~ "allows for higher-quality text rendering. For more information, please " -#~ "see the fontconfig manual in /usr/share/doc/fontconfig/ on your Debian " -#~ "system." -#~ msgstr "" -#~ "Si tiene un monitor LCD, entonces seguramente querrá activar esta opción. " -#~ "Esta permite renderizar el texto con mejor calidad. Para más información, " -#~ "por favor vea el manual de fontconfig en «/usr/share/doc/fontconfig/» en " -#~ "su sistema Debian." - -#~ msgid "Enable the freetype autohinter module?" -#~ msgstr "¿Activar el módulo «freetype autohinter»?" - -#~ msgid "" -#~ "Depending on your display and on which fonts you use, they can look " -#~ "better or worse when using the autohinter module. Enable it if you happen " -#~ "to prefer the look it gives to your fonts." -#~ msgstr "" -#~ "Dependiendo de su monitor y del tipo de letra que utilice, podrá " -#~ "visualizarla mejor o peor cuando use el módulo «autohinter». Actívelo si " -#~ "prefiere el aspecto que le da a sus tipos de letra." diff --git a/debian/po/fr.po b/debian/po/fr.po deleted file mode 100644 index 59ae2c1..0000000 --- a/debian/po/fr.po +++ /dev/null @@ -1,159 +0,0 @@ -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans -# -# Developers do not need to manually edit POT or PO files. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig 2.2.3-1\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-10-23 17:00+0200\n" -"Last-Translator: Philippe Batailler \n" -"Language-Team: French \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-15\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -#, fuzzy -msgid "Enable subpixel rendering of text?" -msgstr "Voulez-vous activer le lissage sous-pixel pour le texte ?" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Voulez-vous des polices de type « bitmap » par défaut ?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Par défaut, seules les polices de type contour (« outline ») sont utilisées " -"par les applications qui utilisent fontconfig. Ces polices gardent toutes " -"leurs qualités dans les différentes tailles. Les polices de type « bitmap », " -"au contraire, ont souvent une qualité moindre. Cette option affectera la " -"valeur par défaut pour tout le système ; chaque utilisateur peut activer ou " -"désactiver cette option ainsi que d'autres options de fontconfig." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Méthode à utiliser pour le rendu des textes :" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Interpréteur de bytecode (écrans CRT), Autohinter, Lissage sous-pixel " -#~ "(écrans LCD)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "La bibliothèque Freetype utilise plusieurs méthodes pour le rendu des " -#~ "polices. Selon votre matériel et les polices à afficher, certaines sont " -#~ "meilleures que d'autres." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "Le module autohinter est la méthode par défaut. Elle donne de bons " -#~ "résultats sur la plupart des configurations. L'interpréteur de bytecode " -#~ "offre un rendu précis, c'est souvent le meilleur choix si vous possédez " -#~ "un écran CRT. Enfin, la méthode du lissage sous-pixel offre un rendu de " -#~ "haute qualité sur la plupart des écrans LCD." - -#~ msgid "" -#~ "If you have an LCD display, then you will want to enable this option. It " -#~ "allows for higher-quality text rendering. For more information, please " -#~ "see the fontconfig manual in /usr/share/doc/fontconfig/ on your Debian " -#~ "system." -#~ msgstr "" -#~ "Si vous utilisez un écran LCD, cette option est pour vous. Elle donne une " -#~ "plus grande qualité au rendu des textes. Pour davantage d'informations, " -#~ "veuillez consulter le manuel de fontconfig dans /usr/share/doc/" -#~ "fontconfig/." - -#~ msgid "Enable the freetype autohinter module?" -#~ msgstr "Voulez-vous utiliser le module autohinter ?" - -#~ msgid "" -#~ "Depending on your display and on which fonts you use, they can look " -#~ "better or worse when using the autohinter module. Enable it if you happen " -#~ "to prefer the look it gives to your fonts." -#~ msgstr "" -#~ "Le module autohinter peut, ou non, améliorer l'affichage des polices que " -#~ "vous utilisez. Utilisez-le si vous pensez qu'il améliore l'apparence de " -#~ "vos polices." - -#~ msgid "Overwrite existing /etc/fonts/local.conf?" -#~ msgstr "Faut-il modifier le fichier /etc/fonts/local.conf ?" - -#~ msgid "" -#~ "You appear to have an already existing /etc/fonts/local.conf. Choosing to " -#~ "continue at this point will overwrite any changes you have made in this " -#~ "file. The curent version will be backed up to /etc/fonts/local.conf.old." -#~ msgstr "" -#~ "Un fichier /etc/fonts/local.conf existe déjà. Si vous continuez " -#~ "l'installation, les modifications que vous avez apportées à ce fichier " -#~ "seront effacées. La version actuelle sera sauvegardée dans /etc/fonts/" -#~ "local.conf.old." diff --git a/debian/po/ja.po b/debian/po/ja.po deleted file mode 100644 index bb63600..0000000 --- a/debian/po/ja.po +++ /dev/null @@ -1,88 +0,0 @@ -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans -# -# Developers do not need to manually edit POT or PO files. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-10 19:01-0800\n" -"PO-Revision-Date: 2005-04-01 09:12+0900\n" -"Last-Translator: Kenshi Muto \n" -"Language-Team: Japanese \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "ネイティブ, オートヒント, なし" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "画面に対してフォントを調整しますか?" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "Bitstream Vera (Debian のデフォルト) または Microsoft のフォントをよく使うのであれば、ネイティブを選びます。その他の TrueType フォントをよく使うのであれば、オートヒントを選びます。ぼんやりしたテキストでもよいなら、なしを選びます。" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "自動, 常に, なし" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "テキストのサブピクセルレンダリングを有効にしますか?" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "サブピクセルレベルでテキストを描画すると、一般にフラット (LCD) 画面で少し見栄えが良くなりますが、CRT 画面では、文字に色が散りばめられたように見えてしまいます。「自動」を選ぶと、LCD 画面を検出したときのみにこれを有効にします。" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "デフォルトでビットマップフォントを有効にしますか?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"デフォルトでは、アウトラインフォントのみが fontconfig をサポートするアプリ" -"ケーションで使われます。アウトラインフォントはさまざまなサイズに合わせて大き" -"さの変わるフォントです。対照的にビットマップフォントはたいてい低品質です。こ" -"の選択肢を有効にすると、システム全体のデフォルトに波及します。これとほかの多" -"くの fontconfig の選択肢は基本的にユーザごとに有効、無効にできます。" diff --git a/debian/po/nl.po b/debian/po/nl.po deleted file mode 100644 index 861e090..0000000 --- a/debian/po/nl.po +++ /dev/null @@ -1,125 +0,0 @@ -# translation of nl.po to Dutch -# translation of fontconfig_2.2.1-16_nl.po to Dutch -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans# -# Developers do not need to manually edit POT or PO files. -# Frans Pop , 2004. -# -msgid "" -msgstr "" -"Project-Id-Version: nl\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-11-03 22:00+0100\n" -"Last-Translator: Frans Pop \n" -"Language-Team: Dutch \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.3.1\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Bitmap-lettertypen standaard activeren?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Standaard worden alleen 'outline' lettertypen gebruikt door applicaties die " -"fontconfig ondersteunen. 'Outline' lettertypen zijn lettertypen die goed " -"geschaald kunnen worden naar verschillende lettergroottes. Daarentegen zijn " -"'bitmapped' lettertypen vaak van een lagere kwaliteit; deze, en vele andere, " -"opties van fontconfig kunnen voor elke gebruiker afzonderlijk ingesteld " -"worden." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Volgens welke methode moet tekst worden weergegeven?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Bytecode interpreter (CRT-monitoren), Autohinter, Subpixel weergave (LCD-" -#~ "monitoren)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "De Freetype lettertype-bibliotheek kan lettertypen weergeven volgens " -#~ "verschillende methoden. Afhankelijk van uw apparatuur en de lettertypen " -#~ "die u gewoonlijk gebruikt, kan de ene methode betere resultaten geven dan " -#~ "de andere." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "De module 'autohinter' is de standaardwaarde; het geeft op de meeste " -#~ "configuraties een goed resultaat. De 'bytecode interpreter' geeft " -#~ "lettertypen zeer scherp weer en is vaak een betere keus als u een CRT-" -#~ "monitor heeft. De methode 'subpixel weergave' daarentegen is " -#~ "geoptimaliseerd voor weergave met hoge kwaliteit op LCD-monitor." diff --git a/debian/po/pt.po b/debian/po/pt.po deleted file mode 100644 index 85a242b..0000000 --- a/debian/po/pt.po +++ /dev/null @@ -1,112 +0,0 @@ -# Portuguese translation of fontconfig -# 2004 Miguel Figueiredo -msgid "" -msgstr "" -"Project-Id-Version: fontconfig 2.2.3-3\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-10-24 12:23+0000\n" -"Last-Translator:Miguel Figueiredo \n" -"Language-Team: Portuguese \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Permitir tipos de letra bitmap por omissão?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Por omissão, apenas tipos de letra de contornos são utilizados em aplicações " -"que suportam o fontconfig. Tipos de fonte de contornos são tipos de letra " -"que escalam em vários tamanhos. Em contraste, tipos de letra bitmap têm " -"muitas vezes menos qualidade. Ligando esta opção irá afectar os valores por " -"omissão de todo o sistema; esta e muitas outras opções do fontconfig são " -"ligadas ou desligadas num controle por utilizador." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Com qual método deverá ser desenhado o texto?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Interpretador de Bytecode (ecrãs CRT), Autohinter, Subpixel rendering " -#~ "(ecrãs LCD)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "A biblioteca de tipos de letra Freetype consegue desenhar fontes com " -#~ "diferentes métodos. Dependendo do seu hardware e das fontes que utiliza " -#~ "normalmente, alguns darão melhores resultados." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "O módulo autohinter é o escolhido por omissão; dá resultados correctos na " -#~ "maioria das configurações. O interpretador de bytecode desenha os tipos " -#~ "de letra muito nítidos, e é muitas vezes a melhor escolha se está a " -#~ "utilizar um ecrã de raios catódicos. De outro modo, o método de desenho " -#~ "de subpixel é optimizado para desenho de alta qualidade na maioria dos " -#~ "ecrãs de cristais líquidos." diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po deleted file mode 100644 index 4427a8c..0000000 --- a/debian/po/pt_BR.po +++ /dev/null @@ -1,148 +0,0 @@ -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans -# -# Developers do not need to manually edit POT or PO files. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-10-30 13:01-0300\n" -"Last-Translator: André Luís Lopes \n" -"Language-Team: Debian-BR Project \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -#, fuzzy -msgid "Enable subpixel rendering of text?" -msgstr "Habilitar renderização de texto de sub-pixel ?" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Habilitar fontes bitmapped por padrão ?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Por padrão, somente fontes desenhadas são usadas por aplicações que suportam " -"o fontconfig. Fontes desenhadas (outline) são fontes que escalam bem em " -"diversos tamanhos. Em contraste, fontes bitmapped são geralmente de uma " -"qualidade menor. A habilitação desta opção irá afetar o padrão de todo o " -"sistema; essa e muitas outras opções do fontconfig podem ser habilitadas ou " -"desabilitadas para cada usuário." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Os textos devem ser renderizados usando qual método ?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Interpretador de bytecode (telas CRT), Autohinter, Renderização de " -#~ "subpixel (telas CRT)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "A biblioteca de fontes Freetype é capaz de renderizar fontes usando " -#~ "diferentes métodos. Dependendo de seu hardware e das fontes que você " -#~ "geralmente utiliza, alguns métodos poderão oferecer melhores resultados." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "O módulo autohinter é o padrão, pois fornece resultados corretos na " -#~ "maioria das configurações. O interpretador de bytecode renderiza fontes " -#~ "bastante afiadas e é geralmente uma melhor escolha caso você esteja " -#~ "usando um monitor de raios catódicos. Por outro lado, o método de " -#~ "renderização de subpixel é otimizado para renderização de alta qualidade " -#~ "na maioria dos displays de cristal líquido." - -#~ msgid "" -#~ "If you have an LCD display, then you will want to enable this option. It " -#~ "allows for higher-quality text rendering. For more information, please " -#~ "see the fontconfig manual in /usr/share/doc/fontconfig/ on your Debian " -#~ "system." -#~ msgstr "" -#~ "Caso você possua um monitor LCD você irá desejar habilitar esta opção. A " -#~ "mesma proporciona uma renderização de texto de alta qualidade. Para " -#~ "maiores informações, por favor consulte o manual do fontconfig em /usr/" -#~ "share/doc/fontconfig/ em seu sistema Debian." - -#~ msgid "Enable the freetype autohinter module?" -#~ msgstr "Habilitar o módulo freetype autohinter ?" - -#~ msgid "" -#~ "Depending on your display and on which fonts you use, they can look " -#~ "better or worse when using the autohinter module. Enable it if you happen " -#~ "to prefer the look it gives to your fonts." -#~ msgstr "" -#~ "Dependendo de seu monitor e das fontes que você usa, as mesmas podem ter " -#~ "uma melhor ou pior aparência quando você utiliza o módulo autohinter. " -#~ "Habilite-o caso você prefira a aparência que o mesmo oferece à suas " -#~ "fontes." diff --git a/debian/po/templates.pot b/debian/po/templates.pot deleted file mode 100644 index 4646e31..0000000 --- a/debian/po/templates.pot +++ /dev/null @@ -1,84 +0,0 @@ -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans -# -# Developers do not need to manually edit POT or PO files. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" diff --git a/debian/po/tr.po b/debian/po/tr.po deleted file mode 100644 index 008f046..0000000 --- a/debian/po/tr.po +++ /dev/null @@ -1,117 +0,0 @@ -# Turkish translation of fontconfig. -# This file is distributed under the same license as the fontconfig package. -# Gürkan Aslan , 2004. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-10-23 16:23+0300\n" -"Last-Translator: Gürkan Aslan \n" -"Language-Team: Turkish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "Biteşlemli yazıtipleri öntanımlı olarak etkinleştirilsin mi?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"Fontconfig'i destekleyen uygulamalarda ön tanımlı olarak sadece " -"ölçeklenebilir yazıtipleri kullanılır. Ölçeklenebilir yazıtipleri " -"kalitesinden birşey kaybetmeden çeşitli boyutlara ölçeklendirilebilir. Buna " -"karşılık, biteşlemli yazıtipleri çoğunlukla düşük kalitelidir. Bu seçeneği " -"etkinleştirmek sistem genelinde geçerli öntanımlı ayarları etkileyecektir; " -"alternatif olarak bu ve diğer birçok fontconfig seçeneğinin kullanıcı " -"bazında etkinleştirilmesi de tercih edilebilir." - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "Metinler hangi yöntemle kaplansın?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "" -#~ "Bytecode yorumlayıcı (CRT ekranlar), Otomatik sezinleyici (Autohinter), " -#~ "Piksel-altı kaplama (LCD ekranlar)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "Freetype yazıtipi kitaplığı yazıtiplerini farklı yöntemler kullanarak " -#~ "kaplayabilmektedir. Kullandığınız donanım ve yazıtiplerine bağlı olarak " -#~ "bu yöntemlerden bazıları diğerlerine nispetle daha iyi sonuçlar " -#~ "verecektir." - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "Öntanımlı seçenek otomatik sezinleyici modülüdür; çoğu yapılandırmada " -#~ "doğru sonuçlar verir. \"Bytecode\" yorumlayıcı, yazıtiplerini çok keskin " -#~ "hatlarla kaplar ve katod-ışınlı bir ekran (CRT) kullanıyorsunuz " -#~ "genellikle daha iyi bir seçimdir. Öte yandan, piksel-altı (subpixel) " -#~ "metin kaplama yöntemi çoğu sıvı kristal ekranda (LCD) yüksek kaplama " -#~ "kalitesi sağlamaya yönelik olarak iyileştirilmiştir." diff --git a/debian/po/zh_CN.po b/debian/po/zh_CN.po deleted file mode 100644 index 2c58a84..0000000 --- a/debian/po/zh_CN.po +++ /dev/null @@ -1,115 +0,0 @@ -# -# Translators, if you are not familiar with the PO format, gettext -# documentation is worth reading, especially sections dedicated to -# this format, e.g. by running: -# info -n '(gettext)PO Files' -# info -n '(gettext)Header Entry' -# -# Some information specific to po-debconf are available at -# /usr/share/doc/po-debconf/README-trans -# or http://www.debian.org/intl/l10n/po-debconf/README-trans -# -# Developers do not need to manually edit POT or PO files. -# -msgid "" -msgstr "" -"Project-Id-Version: fontconfig debconf\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-29 13:33-0800\n" -"PO-Revision-Date: 2004-11-03 00:14+1300\n" -"Last-Translator: Carlos Liu \n" -"Language-Team: Debian Chinese [GB] \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#. Type: select -#. Choices -#: ../fontconfig.templates:3 -msgid "Native, Autohinter, None" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "How should fonts be tuned for the screen?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:5 -msgid "" -"Select Native if you mostly use Bitstream Vera (the default in Debian) or " -"any of the Microsoft fonts. Select Autohinter if you mostly use other " -"TrueType fonts. Select None if you want blurry text." -msgstr "" - -#. Type: select -#. Choices -#: ../fontconfig.templates:12 -msgid "Automatic, Always, Never" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "Enable subpixel rendering of text?" -msgstr "" - -#. Type: select -#. Description -#: ../fontconfig.templates:14 -msgid "" -"Rendering text at a subpixel level generally makes it look a bit better on " -"flat (LCD) screens, but can show color artifacts on CRT screens. The " -"\"Automatic\" choice will enable it only if a LCD screen is detected." -msgstr "" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "Enable bitmapped fonts by default?" -msgstr "默认使用点阵字体吗?" - -#. Type: boolean -#. Description -#: ../fontconfig.templates:22 -msgid "" -"By default, only outline fonts are used by applications which support " -"fontconfig. Outline fonts are fonts which scale well to various sizes. In " -"contrast, bitmapped fonts are often lower quality. Enabling this option will " -"affect the systemwide default; this and many other fontconfig options may be " -"enabled or disabled on a per-user basis." -msgstr "" -"默认状态下,仅有轮廓字体可以被支持 fontconfig 的程序所使用。轮廓字体可以在不" -"同的尺寸上进行平滑缩放。而相反的,点阵字体通常只能提供低质量的显示效果。开启" -"此选项将会影响整个系统的默认设置。当然,此选项以及其它很多 fontconfig 设置都" -"可以基于每个用户单独进行开启或关闭。" - -#, fuzzy -#~ msgid "With what method should fonts be hinted?" -#~ msgstr "您希望使用哪种文本渲染方式?" - -#~ msgid "" -#~ "Bytecode interpreter (CRT screens), Autohinter, Subpixel rendering (LCD " -#~ "screens)" -#~ msgstr "Bytecode 解释器 (CRT 显示器), 自动微调, 次像素渲染 (LCD 液晶显示器)" - -#~ msgid "" -#~ "The Freetype font library is able to render fonts with different methods. " -#~ "Depending on your hardware and the fonts you generally use, some will " -#~ "give better results." -#~ msgstr "" -#~ "Freetype 字体库程序可以使用多种不同的方法进行字体渲染。根据您的硬件和通常" -#~ "所使用的字体,其中某些方法会有较好的显示效果。" - -#~ msgid "" -#~ "The autohinter module is the default; it gives correct results on most " -#~ "configurations. The bytecode interpreter renders fonts very sharply, and " -#~ "is often a better choice if you are using a cathode-ray screen. On the " -#~ "other hand, the subpixel rendering method is optimized for high-quality " -#~ "rendering on most liquid crystal displays." -#~ msgstr "" -#~ "自动微调模块是默认的选项,它能对大多数配置提供正确的显示结果。Bytecode 解" -#~ "释器的字体渲染效果非常锐利,比较适合用于阴极射线管显示器。而次像素渲染方式" -#~ "则是针对液晶显示器上高质量渲染的优化设置。" diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 49236eb..0000000 --- a/debian/rules +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/make -f -# -*- mode: makefile; coding: utf-8 -*- -# Copyright © 2002,2003 Colin Walters - -# This ensures the fontconfig package is built after libfontconfig1 -binary/fontconfig:: binary/libfontconfig1 - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/rules/simple-patchsys.mk -include /usr/share/cdbs/1/class/autotools.mk - -DEB_CONFIGURE_EXTRA_FLAGS := --enable-docs --with-add-fonts=/usr/X11R6/lib/X11/fonts,/usr/local/share/fonts - -# tight versioning -DEB_DH_MAKESHLIBS_ARGS_fontconfig-udeb := --no-act -DEB_DH_MAKESHLIBS_ARGS_libfontconfig1 := -V"libfontconfig1 (>= 2.3.0)" - -DEB_SHLIBDEPS_LIBRARY_fontconfig := libfontconfig1 -DEB_SHLIBDEPS_INCLUDE_fontconfig := debian/libfontconfig1/usr/lib/ - -DEB_DH_STRIP_ARGS := --dbg-package=libfontconfig1 - -clean:: - chmod +w debian/po/*.po - debconf-updatepo - rm -f config/Makedefs Makefile {src,fontconfig}/Makefile fc-{cache,list}/Makefile fontconfig-config fontconfig.pc config.h - -# work around dh_installman bug -binary-post-install/libfontconfig1-dev:: - if test -f debian/libfontconfig1-dev/usr/share/man/man3/fonts-conf.5; then \ - mkdir -p debian/libfontconfig1-dev/usr/share/man/man5/; \ - mv debian/libfontconfig1-dev/usr/share/man/man3/fonts-conf.5 debian/libfontconfig1-dev/usr/share/man/man5/fonts-conf.5; \ - fi - -%.1: %.sgml - docbook-to-man $< > $@ - -# defoma stuff -binary-post-install/fontconfig:: - dh_installdefoma diff --git a/doc/Makefile.am b/doc/Makefile.am index b1a2aee..3477eb7 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -86,7 +86,7 @@ docdir=@DOCDIR@ DOC_FILES=$(TXT) $(PDF) $(HTML_FILES) LOCAL_DOCS=$(man3_MANS) $(man5_MANS) $(DOC_FILES) $(HTML_DIR)/* -EXTRA_DIST=$(LOCAL_DOCS) $(SGML) $(DOC_FUNCS_FNCS) $(FNCS_TMPL) confdir.sgml.in +EXTRA_DIST=$(LOCAL_DOCS) $(SGML) $(DOC_FUNCS_FNCS) func.sgml confdir.sgml.in SUFFIXES=.fncs .sgml .txt .html @@ -142,8 +142,9 @@ fontconfig-devel.txt: local-fontconfig-devel.sgml $(DOC_FUNCS_SGML) version.sgml fontconfig-devel.pdf: local-fontconfig-devel.sgml $(DOC_FUNCS_SGML) version.sgml confdir.sgml $(RM) $@ - $(DOC2PDF) local-fontconfig-devel.sgml - mv local-fontconfig-devel.pdf $@ + ../missing --run $(DOC2PDF) $< && mv local-$@ $@ \ + || echo Failed to generate $@ >&2; \ + (test -f $@ || echo $(DOC2PDF) is required to generate this file >> $@) fontconfig-user.html: local-fontconfig-user.sgml version.sgml confdir.sgml $(RM) $@ local-$@ $@.tmp @@ -159,8 +160,9 @@ fontconfig-user.txt: local-fontconfig-user.sgml version.sgml confdir.sgml fontconfig-user.pdf: local-fontconfig-user.sgml version.sgml confdir.sgml $(RM) $@ - $(DOC2PDF) local-fontconfig-user.sgml - mv local-fontconfig-user.pdf $@ + ../missing --run $(DOC2PDF) $< && mv local-$@ $@ \ + || echo Failed to generate $@ >&2; \ + (test -f $@ || echo $(DOC2PDF) is required to generate this file >> $@) STRIPNL=awk '{ if (NR > 1) printf ("\n"); printf ("%s", $$0); }' confdir.sgml: ${DOC_SRC}/confdir.sgml.in diff --git a/doc/edit-sgml.c b/doc/edit-sgml.c index 3542a5a..77cc807 100644 --- a/doc/edit-sgml.c +++ b/doc/edit-sgml.c @@ -77,7 +77,7 @@ static void ReplaceDispose (Replace *r); static void -Bail (char *format, char *arg); +Bail (const char *format, const char *arg); static Replace * ReplaceRead (FILE *f); @@ -249,7 +249,7 @@ ReplaceDispose (Replace *r) } static void -Bail (char *format, char *arg) +Bail (const char *format, const char *arg) { fprintf (stderr, "fatal: "); fprintf (stderr, format, arg); diff --git a/doc/fcconfig.fncs b/doc/fcconfig.fncs index 3680b0e..db7ee02 100644 --- a/doc/fcconfig.fncs +++ b/doc/fcconfig.fncs @@ -290,3 +290,14 @@ in 'config'. Any include files referenced from within 'file' will be loaded with FcConfigLoad and also parsed. If 'complain' is FcFalse, no warning will be displayed if 'file' does not exist. @@ + +@RET@ const FcChar8 * +@FUNC@ FcConfigNormalizeFontDir +@TYPE1@ FcConfig * @ARG1@ config +@TYPE2@ const FcChar8 * @ARG2@ dir +@PURPOSE@ normalize a font directory +@DESC@ +Converts the directory name given in 'dir' to a normal form, i.e. one +of the forms which are derived from the font directories specified +in the config file. +@@ diff --git a/doc/fcpattern.fncs b/doc/fcpattern.fncs index 9a2e405..b049966 100644 --- a/doc/fcpattern.fncs +++ b/doc/fcpattern.fncs @@ -246,7 +246,7 @@ value need be passed for this. The values are added to `pattern', if returned. Example -pattern = FcPatternBuild (0, FC_FAMILY, FtTypeString, "Times", (char *) 0); +pattern = FcPatternBuild (0, FC_FAMILY, FcTypeString, "Times", (char *) 0); FcPatternVaBuild is used when the arguments are already in the form of a diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml index 5e240dd..a1f6b39 100644 --- a/doc/fontconfig-user.sgml +++ b/doc/fontconfig-user.sgml @@ -3,8 +3,6 @@ ]> - Sep 16, 2003"> + Sep 22, 2005"> 1"> @@ -88,6 +88,13 @@ manpage.1: manpage.sgml This cache is used to speed up application startup when using the fontconfig library. + Note that &dhpackage; must be executed + once per architecture to generate font information customized + for that architecture. On a subsequent run, + &dhpackage; will augment the cache + information files with the information for the new + architecture. + OPTIONS @@ -153,7 +160,7 @@ manpage.1: manpage.sgml FILES - fonts.cache-1 + fonts.cache-2 These files are generated by &dhpackage; and contain maps from file names to font properties. They are diff --git a/fc-case/fc-case.c b/fc-case/fc-case.c index 588ccf3..a4fffde 100644 --- a/fc-case/fc-case.c +++ b/fc-case/fc-case.c @@ -31,11 +31,11 @@ typedef enum _caseFoldClass { CaseFoldCommon, CaseFoldFull, CaseFoldSimple, CaseFoldTurkic } CaseFoldClass; typedef struct _caseFoldClassMap { - char *name; + const char *name; CaseFoldClass class; } CaseFoldClassMap; -static CaseFoldClassMap caseFoldClassMap[] = { +static const CaseFoldClassMap caseFoldClassMap[] = { { "C", CaseFoldCommon }, { "F", CaseFoldFull }, { "S", CaseFoldSimple }, @@ -51,7 +51,7 @@ typedef struct _caseFoldRaw { } CaseFoldRaw; static void -panic (char *reason) +panic (const char *reason) { fprintf (stderr, "fc-case: panic %s\n", reason); exit (1); @@ -102,10 +102,10 @@ utf8_size (FcChar32 ucs4) } static FcChar8 *foldChars; -int nfoldChars; -int maxFoldChars; -FcChar32 minFoldChar; -FcChar32 maxFoldChar; +static int nfoldChars; +static int maxFoldChars; +static FcChar32 minFoldChar; +static FcChar32 maxFoldChar; static void addChar (FcChar32 c) @@ -148,7 +148,7 @@ foldExtends (FcCaseFold *fold, CaseFoldRaw *raw) return 0; } -static char * +static const char * case_fold_method_name (FcChar16 method) { switch (method) { diff --git a/fc-cat/.cvsignore b/fc-cat/.cvsignore new file mode 100644 index 0000000..1cbed0c --- /dev/null +++ b/fc-cat/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile +Makefile.in +fc-cat +fc-cat.1 diff --git a/fc-cat/Makefile.am b/fc-cat/Makefile.am new file mode 100644 index 0000000..91e5ad7 --- /dev/null +++ b/fc-cat/Makefile.am @@ -0,0 +1,55 @@ +# +# $Id$ +# +# Copyright © 2003 Keith Packard +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Keith Packard not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Keith Packard makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +DOC2MAN = docbook2man + +FC_CAT_SRC=${top_srcdir}/fc-cat + +SGML = ${FC_CAT_SRC}/fc-cat.sgml + +INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) + +bin_PROGRAMS=fc-cat + +EXTRA_DIST=fc-cat.sgml + +fc_cat_LDADD = $(FREETYPE_LIBS) $(LIBXML2_LIBS) $(EXPAT_LIBS) ${top_builddir}/src/libfontconfig.la + +if USEDOCBOOK + +man_MANS=fc-cat.1 + +${man_MANS}: ${SGML} + $(RM) $@ + $(DOC2MAN) ${SGML} + $(RM) manpage.refs manpage.links + +all-local: $(man_MANS) + +clean-local: + $(RM) $(man_MANS) + +else +all-local: +clean-local: +endif diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c new file mode 100644 index 0000000..bb804ab --- /dev/null +++ b/fc-cat/fc-cat.c @@ -0,0 +1,407 @@ +/* + * $RCSId: xc/lib/fontconfig/fc-cache/fc-cache.c,v 1.8tsi Exp $ + * + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include +#else +#ifdef linux +#define HAVE_GETOPT_LONG 1 +#endif +#define HAVE_GETOPT 1 +#endif + +#include "../src/fccache.c" +#include "../fc-arch/fcarch.h" +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_GETOPT +#define HAVE_GETOPT 0 +#endif +#ifndef HAVE_GETOPT_LONG +#define HAVE_GETOPT_LONG 0 +#endif + +#if HAVE_GETOPT_LONG +#undef _GNU_SOURCE +#define _GNU_SOURCE +#include +const struct option longopts[] = { + {"version", 0, 0, 'V'}, + {"verbose", 0, 0, 'v'}, + {"recurse", 0, 0, 'r'}, + {"help", 0, 0, '?'}, + {NULL,0,0,0}, +}; +#else +#if HAVE_GETOPT +extern char *optarg; +extern int optind, opterr, optopt; +#endif +#endif + +/* + * POSIX has broken stdio so that getc must do thread-safe locking, + * this is a serious performance problem for applications doing large + * amounts of IO with getc (as is done here). If available, use + * the getc_unlocked varient instead. + */ + +#if defined(getc_unlocked) || defined(_IO_getc_unlocked) +#define GETC(f) getc_unlocked(f) +#define PUTC(c,f) putc_unlocked(c,f) +#else +#define GETC(f) getc(f) +#define PUTC(c,f) putc(c,f) +#endif + +static FcBool +write_chars (FILE *f, const FcChar8 *chars) +{ + FcChar8 c; + while ((c = *chars++)) + { + switch (c) { + case '"': + case '\\': + if (PUTC ('\\', f) == EOF) + return FcFalse; + /* fall through */ + default: + if (PUTC (c, f) == EOF) + return FcFalse; + } + } + return FcTrue; +} + +static FcBool +write_ulong (FILE *f, unsigned long t) +{ + int pow; + unsigned long temp, digit; + + temp = t; + pow = 1; + while (temp >= 10) + { + temp /= 10; + pow *= 10; + } + temp = t; + while (pow) + { + digit = temp / pow; + if (PUTC ((char) digit + '0', f) == EOF) + return FcFalse; + temp = temp - pow * digit; + pow = pow / 10; + } + return FcTrue; +} + +static FcBool +write_int (FILE *f, int i) +{ + return write_ulong (f, (unsigned long) i); +} + +static FcBool +write_string (FILE *f, const FcChar8 *string) +{ + + if (PUTC ('"', f) == EOF) + return FcFalse; + if (!write_chars (f, string)) + return FcFalse; + if (PUTC ('"', f) == EOF) + return FcFalse; + return FcTrue; +} + +static void +usage (char *program) +{ +#if HAVE_GETOPT_LONG + fprintf (stderr, "usage: %s [-V?] [--version] [--help] {*-%s.cache-2|directory}...\n", + program, FC_ARCHITECTURE); +#else + fprintf (stderr, "usage: %s [-fsvV?] {*-%s.cache-2|directory}...\n", + program, FC_ARCHITECTURE); +#endif + fprintf (stderr, "Reads font information cache from:\n"); + fprintf (stderr, " 1) specified fontconfig cache file\n"); + fprintf (stderr, " 2) related to a particular font directory\n"); + fprintf (stderr, "\n"); +#if HAVE_GETOPT_LONG + fprintf (stderr, " -V, --version display font config version and exit\n"); + fprintf (stderr, " -?, --help display this help and exit\n"); +#else + fprintf (stderr, " -V (version) display font config version and exit\n"); + fprintf (stderr, " -? (help) display this help and exit\n"); +#endif + exit (1); +} + +/* + * return the path from the directory containing 'cache' to 'file' + */ + +static const FcChar8 * +file_base_name (const char *cache, const FcChar8 *file) +{ + const FcChar8 *cache_slash; + int cache_len = strlen (cache); + + if (!strncmp (cache, file, cache_len) && file[cache_len] == '/') + return file + cache_len + 1; + return file; +} + +static FcBool +cache_print_set (FcFontSet *set, FcStrSet *dirs, char *base_name, FcBool verbose) +{ + FcPattern *font; + FcChar8 *name, *dir; + const FcChar8 *file, *base; + int ret; + int n; + int id; + int ndir = 0; + FcStrList *list; + + list = FcStrListCreate (dirs); + if (!list) + goto bail2; + + while ((dir = FcStrListNext (list))) + { + base = file_base_name (base_name, dir); + if (!write_string (stdout, base)) + goto bail3; + if (PUTC (' ', stdout) == EOF) + goto bail3; + if (!write_int (stdout, 0)) + goto bail3; + if (PUTC (' ', stdout) == EOF) + goto bail3; + if (!write_string (stdout, FC_FONT_FILE_DIR)) + goto bail3; + if (PUTC ('\n', stdout) == EOF) + goto bail3; + ndir++; + } + + for (n = 0; n < set->nfont; n++) + { + FcPattern **fonts = FcFontSetFonts (set); + FcPattern *encoded_font = fonts[n]; + FcPattern *font = FcEncodedOffsetToPtr (set, encoded_font, FcPattern); + + if (FcPatternGetString (font, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) + goto bail3; + base = file_base_name (base_name, file); + if (FcPatternGetInteger (font, FC_INDEX, 0, &id) != FcResultMatch) + goto bail3; + if (!write_string (stdout, base)) + goto bail3; + if (PUTC (' ', stdout) == EOF) + goto bail3; + if (!write_int (stdout, id)) + goto bail3; + if (PUTC (' ', stdout) == EOF) + goto bail3; + name = FcNameUnparse (font); + if (!name) + goto bail3; + ret = write_string (stdout, name); + FcStrFree (name); + if (!ret) + goto bail3; + if (PUTC ('\n', stdout) == EOF) + goto bail3; + } + if (verbose && !set->nfont && !ndir) + printf ("\n"); + + FcStrListDone (list); + + return FcTrue; + +bail3: + FcStrListDone (list); +bail2: + return FcFalse; +} + +int +main (int argc, char **argv) +{ + int i; + int ret = 0; + FcFontSet *fs; + FcStrSet *dirs; + FcStrSet *args = NULL; + FcStrList *arglist; + FcCache *cache; + FcConfig *config; + FcChar8 *arg; + int verbose = 0; + int recurse = 0; + FcBool first = FcTrue; +#if HAVE_GETOPT_LONG || HAVE_GETOPT + int c; + +#if HAVE_GETOPT_LONG + while ((c = getopt_long (argc, argv, "Vvr?", longopts, NULL)) != -1) +#else + while ((c = getopt (argc, argv, "Vvr?")) != -1) +#endif + { + switch (c) { + case 'V': + fprintf (stderr, "fontconfig version %d.%d.%d\n", + FC_MAJOR, FC_MINOR, FC_REVISION); + exit (0); + case 'v': + verbose++; + break; + case 'r': + recurse++; + break; + default: + usage (argv[0]); + } + } + i = optind; +#else + i = 1; +#endif + + config = FcInitLoadConfig (); + if (!config) + { + fprintf (stderr, "%s: Can't init font config library\n", argv[0]); + return 1; + } + FcConfigSetCurrent (config); + + args = FcStrSetCreate (); + if (!args) + { + fprintf (stderr, "%s: malloc failure\n", argv[0]); + return 1; + } + if (i < argc) + { + for (; i < argc; i++) + { + if (!FcStrSetAddFilename (args, argv[i])) + { + fprintf (stderr, "%s: malloc failure\n", argv[0]); + return 1; + } + } + arglist = FcStrListCreate (args); + if (!arglist) + { + fprintf (stderr, "%s: malloc failure\n", argv[0]); + return 1; + } + } + else + { + recurse++; + arglist = FcConfigGetFontDirs (config); + while ((arg = FcStrListNext (arglist))) + if (!FcStrSetAdd (args, arg)) + { + fprintf (stderr, "%s: malloc failure\n", argv[0]); + return 1; + } + FcStrListDone (arglist); + } + arglist = FcStrListCreate (args); + if (!arglist) + { + fprintf (stderr, "%s: malloc failure\n", argv[0]); + return 1; + } + + while ((arg = FcStrListNext (arglist))) + { + int j; + off_t size; + intptr_t *cache_dirs; + FcChar8 *cache_file = NULL; + struct stat file_stat; + + if (FcFileIsDir (arg)) + cache = FcDirCacheLoad (arg, config, &cache_file); + else + cache = FcDirCacheLoadFile (arg, &file_stat); + if (!cache) + { + perror ((char *) arg); + ret++; + continue; + } + + dirs = FcStrSetCreate (); + fs = FcCacheSet (cache); + cache_dirs = FcCacheDirs (cache); + for (j = 0; j < cache->dirs_count; j++) + { + FcStrSetAdd (dirs, FcOffsetToPtr (cache_dirs, + cache_dirs[j], + FcChar8)); + if (recurse) + FcStrSetAdd (args, FcOffsetToPtr (cache_dirs, + cache_dirs[j], + FcChar8)); + } + + if (verbose) + { + if (!first) + printf ("\n"); + printf ("Directory: %s\nCache: %s\n--------\n", + FcCacheDir(cache), cache_file ? cache_file : arg); + first = FcFalse; + } + cache_print_set (fs, dirs, FcCacheDir (cache), verbose); + + FcStrSetDestroy (dirs); + + FcDirCacheUnload (cache); + if (cache_file) + FcStrFree (cache_file); + } + + return 0; +} diff --git a/fc-cat/fc-cat.sgml b/fc-cat/fc-cat.sgml new file mode 100644 index 0000000..812b0fa --- /dev/null +++ b/fc-cat/fc-cat.sgml @@ -0,0 +1,139 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Patrick"> + Lam"> + + Sep 22, 2005"> + + 1"> + plam@mit.edu"> + + fc-cat"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2005 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + read font information cache files + + + + &dhpackage; < fonts-cache-2-file > + + + + + + + + + + DESCRIPTION + + &dhpackage; reads a font information cache file + and emits it in ASCII form. + + + + OPTIONS + + This program follows the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + Show summary of options. + + + + + + + + Show version of the program and exit. + + + + + + + SEE ALSO + + fc-cache (1). + + The fontconfig user's guide, in HTML format: + /usr/share/doc/fontconfig/fontconfig-user.html. + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail;. + + +
+ + diff --git a/fc-glyphname/fc-glyphname.c b/fc-glyphname/fc-glyphname.c index 2c69c2b..faaa63b 100644 --- a/fc-glyphname/fc-glyphname.c +++ b/fc-glyphname/fc-glyphname.c @@ -25,7 +25,7 @@ #include "fcint.h" static int -rawindex (FcGlyphName *gn); +rawindex (const FcGlyphName *gn); static void scan (FILE *f, char *filename); @@ -43,7 +43,7 @@ static void insert (FcGlyphName *gn, FcGlyphName **table, FcChar32 h); static void -dump (FcGlyphName **table, char *name); +dump (FcGlyphName * const *table, const char *name); static FcGlyphName * FcAllocGlyphName (FcChar32 ucs, FcChar8 *name) @@ -59,9 +59,13 @@ FcAllocGlyphName (FcChar32 ucs, FcChar8 *name) } static void -fatal (char *file, int lineno, char *msg) +fatal (const char *file, int lineno, const char *msg) { - fprintf (stderr, "%s:%d: %s\n", file, lineno, msg); + if (lineno) + fprintf (stderr, "%s:%d: %s\n", file, lineno, msg); + else + fprintf (stderr, "%s: %s\n", file, msg); + exit (1); } @@ -69,15 +73,15 @@ fatal (char *file, int lineno, char *msg) #define MAX_GLYPHNAME 10240 #define MAX_NAMELEN 1024 -FcGlyphName *raw[MAX_GLYPHNAME]; -int nraw; -int max_name_len; -FcGlyphName *name_to_ucs[MAX_GLYPHNAME*2]; -FcGlyphName *ucs_to_name[MAX_GLYPHNAME*2]; -int hash, rehash; +static FcGlyphName *raw[MAX_GLYPHNAME]; +static int nraw; +static int max_name_len; +static FcGlyphName *name_to_ucs[MAX_GLYPHNAME*2]; +static FcGlyphName *ucs_to_name[MAX_GLYPHNAME*2]; +static unsigned int hash, rehash; static int -rawindex (FcGlyphName *gn) +rawindex (const FcGlyphName *gn) { int i; @@ -211,11 +215,11 @@ insert (FcGlyphName *gn, FcGlyphName **table, FcChar32 h) } static void -dump (FcGlyphName **table, char *name) +dump (FcGlyphName * const *table, const char *name) { int i; - printf ("static FcGlyphName *%s[%d] = {\n", name, hash); + printf ("static const FcGlyphName *%s[%d] = {\n", name, hash); for (i = 0; i < hash; i++) if (table[i]) @@ -235,11 +239,12 @@ main (int argc, char **argv) int i; i = 0; - while (*++argv) + while (argv[i+1]) { if (i == MAX_GLYPHFILE) fatal (*argv, 0, "Too many glyphname files"); - files[i++] = *argv; + files[i] = argv[i+1]; + i++; } files[i] = 0; qsort (files, i, sizeof (char *), compare_string); @@ -284,7 +289,7 @@ main (int argc, char **argv) */ for (i = 0; i < nraw; i++) - printf ("static struct { FcChar32 ucs; FcChar8 name[%d]; }" + printf ("static const struct { const FcChar32 ucs; const FcChar8 name[%d]; }" " glyph%d = { 0x%lx, \"%s\" };\n", (int) strlen ((char *) raw[i]->name) + 1, i, (unsigned long) raw[i]->ucs, raw[i]->name); diff --git a/fc-lang/as.orth b/fc-lang/as.orth new file mode 100644 index 0000000..b5d7294 --- /dev/null +++ b/fc-lang/as.orth @@ -0,0 +1,28 @@ +# +# Copyright © 2006 Keith Packard +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Keith Packard not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Keith Packard makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# Assamese +# +# Behdad Esfahbod says: +# +# Seems like copying file for Bengali should be enough. +# +include bn.orth diff --git a/fc-lang/de.orth b/fc-lang/de.orth index 20bac03..b9a4dc2 100644 --- a/fc-lang/de.orth +++ b/fc-lang/de.orth @@ -47,3 +47,4 @@ #201c # double quotes #201e # double quotes #2039-203a # angle quotes +20AC # EURO SIGN diff --git a/fc-lang/el.orth b/fc-lang/el.orth index bae0c89..0e5a732 100644 --- a/fc-lang/el.orth +++ b/fc-lang/el.orth @@ -30,3 +30,4 @@ 038c 038e-03a1 03a3-03ce +20AC # EURO SIGN diff --git a/fc-lang/en.orth b/fc-lang/en.orth index 94988b3..7e504fa 100644 --- a/fc-lang/en.orth +++ b/fc-lang/en.orth @@ -38,3 +38,4 @@ 00f6 #2018-2019 # single quotes #201c-201d # double quotes +20AC # EURO SIGN diff --git a/fc-lang/es.orth b/fc-lang/es.orth index 10798f6..77947f3 100644 --- a/fc-lang/es.orth +++ b/fc-lang/es.orth @@ -47,4 +47,5 @@ 00F3 # LATIN SMALL LETTER O WITH ACUTE 00FA # LATIN SMALL LETTER U WITH ACUTE 00FC # LATIN SMALL LETTER U WITH DIAERESIS +20AC # EURO SIGN # diff --git a/fc-lang/fc-lang.c b/fc-lang/fc-lang.c index 75e92f7..69dfac2 100644 --- a/fc-lang/fc-lang.c +++ b/fc-lang/fc-lang.c @@ -25,6 +25,7 @@ #include "fcint.h" #include "fccharset.c" #include "fcstr.c" +#include "fcserialize.c" /* * fc-lang @@ -47,6 +48,8 @@ FcMemFree (int kind, int size) { } +int FcDebugVal; + FcChar8 * FcConfigHome (void) { @@ -54,9 +57,12 @@ FcConfigHome (void) } static void -fatal (char *file, int lineno, char *msg) +fatal (const char *file, int lineno, const char *msg) { - fprintf (stderr, "%s:%d: %s\n", file, lineno, msg); + if (lineno) + fprintf (stderr, "%s:%d: %s\n", file, lineno, msg); + else + fprintf (stderr, "%s: %s\n", file, msg); exit (1); } @@ -64,18 +70,24 @@ static char * get_line (FILE *f, char *line, int *lineno) { char *hash; + int end; if (!fgets (line, 1024, f)) return 0; ++(*lineno); hash = strchr (line, '#'); if (hash) *hash = '\0'; + + end = strlen (line); + while (end > 0 && isspace (line[end-1])) + line[--end] = '\0'; + if (line[0] == '\0' || line[0] == '\n' || line[0] == '\032' || line[0] == '\r') return get_line (f, line, lineno); return line; } -char *dir = 0; +static char *dir = 0; static FILE * scanopen (char *file) @@ -104,31 +116,31 @@ scanopen (char *file) * Comments begin with '#' */ -static FcCharSet * -scan (FILE *f, char *file) +static const FcCharSet * +scan (FILE *f, char *file, FcCharSetFreezer *freezer) { - FcCharSet *c = 0; - FcCharSet *n; - int start, end, ucs4; - char line[1024]; - int lineno = 0; + FcCharSet *c = 0; + const FcCharSet *n; + int start, end, ucs4; + char line[1024]; + int lineno = 0; while (get_line (f, line, &lineno)) { if (!strncmp (line, "include", 7)) { file = strchr (line, ' '); - while (*file == ' ') + if (!file) + fatal (line, lineno, + "invalid syntax, expected: include filename"); + while (isspace(*file)) file++; - end = strlen (file); - if (file[end-1] == '\n') - file[end-1] = '\0'; f = scanopen (file); if (!f) fatal (file, 0, "can't open"); - c = scan (f, file); + n = scan (f, file, freezer); fclose (f); - return c; + return n; } if (strchr (line, '-')) { @@ -149,7 +161,7 @@ scan (FILE *f, char *file) fatal (file, lineno, "out of memory"); } } - n = FcCharSetFreeze (c); + n = FcCharSetFreeze (freezer, c); FcCharSetDestroy (c); return n; } @@ -211,36 +223,44 @@ static int compare (const void *a, const void *b) int main (int argc, char **argv) { - char *files[MAX_LANG]; - FcCharSet *sets[MAX_LANG]; - int duplicate[MAX_LANG]; - int country[MAX_LANG]; - char *names[MAX_LANG]; - char *langs[MAX_LANG]; + static char *files[MAX_LANG]; + static const FcCharSet *sets[MAX_LANG]; + static int duplicate[MAX_LANG]; + static int country[MAX_LANG]; + static char *names[MAX_LANG]; + static char *langs[MAX_LANG]; + static int off[MAX_LANG]; FILE *f; int ncountry = 0; int i = 0; - FcCharLeaf **leaves, **sleaves; + int nsets = 0; + int argi; + FcCharLeaf **leaves; int total_leaves = 0; - int l, sl, tl; - int c; - char line[1024]; - FcChar32 map[MAX_LANG_SET_MAP]; + int l, sl, tl, tn; + static char line[1024]; + static FcChar32 map[MAX_LANG_SET_MAP]; int num_lang_set_map; int setRangeStart[26]; int setRangeEnd[26]; FcChar8 setRangeChar; + FcCharSetFreezer *freezer; - while (*++argv) + freezer = FcCharSetFreezerCreate (); + if (!freezer) + fatal (argv[0], 0, "out of memory"); + argi = 1; + while (argv[argi]) { - if (!strcmp (*argv, "-d")) + if (!strcmp (argv[argi], "-d")) { - dir = *++argv; + argi++; + dir = argv[argi++]; continue; } if (i == MAX_LANG) - fatal (*argv, 0, "Too many languages"); - files[i++] = *argv; + fatal (argv[0], 0, "Too many languages"); + files[i++] = argv[argi++]; } files[i] = 0; qsort (files, i, sizeof (char *), compare); @@ -250,7 +270,7 @@ main (int argc, char **argv) f = scanopen (files[i]); if (!f) fatal (files[i], 0, strerror (errno)); - sets[i] = scan (f, files[i]); + sets[i] = scan (f, files[i], freezer); names[i] = get_name (files[i]); langs[i] = get_lang(names[i]); if (strchr (langs[i], '-')) @@ -260,6 +280,7 @@ main (int argc, char **argv) i++; fclose (f); } + nsets = i; sets[i] = 0; leaves = malloc (total_leaves * sizeof (FcCharLeaf *)); tl = 0; @@ -268,14 +289,13 @@ main (int argc, char **argv) */ for (i = 0; sets[i]; i++) { - sleaves = sets[i]->leaves; for (sl = 0; sl < sets[i]->num; sl++) { for (l = 0; l < tl; l++) - if (leaves[l] == sleaves[sl]) + if (leaves[l] == FcCharSetLeaf(sets[i], sl)) break; if (l == tl) - leaves[tl++] = sleaves[sl]; + leaves[tl++] = FcCharSetLeaf(sets[i], sl); } } @@ -292,23 +312,6 @@ main (int argc, char **argv) printf ("/* total size: %d unique leaves: %d */\n\n", total_leaves, tl); - /* - * Dump leaves - */ - printf ("static const FcCharLeaf leaves[%d] = {\n", tl); - for (l = 0; l < tl; l++) - { - printf (" { { /* %d */", l); - for (i = 0; i < 256/32; i++) - { - if (i % 4 == 0) - printf ("\n "); - printf (" 0x%08x,", leaves[l]->map[i]); - } - printf ("\n } },\n"); - } - printf ("};\n\n"); - printf ("#define L(n) ((FcCharLeaf *) &leaves[n])\n\n"); /* * Find duplicate charsets @@ -327,85 +330,121 @@ main (int argc, char **argv) } } + tn = 0; + for (i = 0; sets[i]; i++) { + if (duplicate[i] >= 0) + continue; + off[i] = tn; + tn += sets[i]->num; + } + + printf ("#define LEAF0 (%d * sizeof (FcLangCharSet))\n", nsets); + printf ("#define OFF0 (LEAF0 + %d * sizeof (FcCharLeaf))\n", tl); + printf ("#define NUM0 (OFF0 + %d * sizeof (intptr_t))\n", tn); + printf ("#define SET(n) (n * sizeof (FcLangCharSet) + offsetof (FcLangCharSet, charset))\n"); + printf ("#define OFF(s,o) (OFF0 + o * sizeof (intptr_t) - SET(s))\n"); + printf ("#define NUM(s,n) (NUM0 + n * sizeof (FcChar16) - SET(s))\n"); + printf ("#define LEAF(o,l) (LEAF0 + l * sizeof (FcCharLeaf) - (OFF0 + o * sizeof (intptr_t)))\n"); + printf ("#define fcLangCharSets (fcLangData.langCharSets)\n"); + printf ("\n"); + + printf ("static const struct {\n" + " FcLangCharSet langCharSets[%d];\n" + " FcCharLeaf leaves[%d];\n" + " intptr_t leaf_offsets[%d];\n" + " FcChar16 numbers[%d];\n" + "} fcLangData = {\n", + nsets, tl, tn, tn); + /* - * Find ranges for each letter for faster searching + * Dump sets */ - setRangeChar = 'a'; + + printf ("{\n"); for (i = 0; sets[i]; i++) { - char c = names[i][0]; - - while (setRangeChar <= c && c <= 'z') - setRangeStart[setRangeChar++ - 'a'] = i; + int j = duplicate[i]; + + if (j < 0) + j = i; + + printf (" { (FcChar8 *) \"%s\", " + " { FC_REF_CONSTANT, %d, OFF(%d,%d), NUM(%d,%d) } }, /* %d */\n", + langs[i], + sets[j]->num, i, off[j], i, off[j], i); } - for (setRangeChar = 'a'; setRangeChar < 'z'; setRangeChar++) - setRangeEnd[setRangeChar - 'a'] = setRangeStart[setRangeChar+1-'a'] - 1; - setRangeEnd[setRangeChar - 'a'] = i - 1; + printf ("},\n"); /* - * Dump arrays + * Dump leaves */ + printf ("{\n"); + for (l = 0; l < tl; l++) + { + printf (" { { /* %d */", l); + for (i = 0; i < 256/32; i++) + { + if (i % 4 == 0) + printf ("\n "); + printf (" 0x%08x,", leaves[l]->map[i]); + } + printf ("\n } },\n"); + } + printf ("},\n"); + + /* + * Dump leaves + */ + printf ("{\n"); for (i = 0; sets[i]; i++) { int n; if (duplicate[i] >= 0) continue; - printf ("static const FcCharLeaf *leaves_%s[%d] = {\n", - names[i], sets[i]->num); + printf (" /* %s */\n", names[i]); for (n = 0; n < sets[i]->num; n++) { - if (n % 8 == 0) + if (n % 4 == 0) printf (" "); for (l = 0; l < tl; l++) - if (leaves[l] == sets[i]->leaves[n]) + if (leaves[l] == FcCharSetLeaf(sets[i], n)) break; if (l == tl) fatal (names[i], 0, "can't find leaf"); - printf (" L(%3d),", l); - if (n % 8 == 7) + printf (" LEAF(%3d,%3d),", off[i], l); + if (n % 4 == 3) printf ("\n"); } - if (n % 8 != 0) + if (n % 4 != 0) printf ("\n"); - printf ("};\n\n"); + } + printf ("},\n"); - printf ("static const FcChar16 numbers_%s[%d] = {\n", - names[i], sets[i]->num); + printf ("{\n"); + for (i = 0; sets[i]; i++) + { + int n; + + if (duplicate[i] >= 0) + continue; + printf (" /* %s */\n", names[i]); for (n = 0; n < sets[i]->num; n++) { if (n % 8 == 0) printf (" "); - printf (" 0x%04x,", sets[i]->numbers[n]); + printf (" 0x%04x,", FcCharSetNumbers (sets[i])[n]); if (n % 8 == 7) printf ("\n"); } if (n % 8 != 0) printf ("\n"); - printf ("};\n\n"); } - printf ("#undef L\n\n"); + printf ("}\n"); - /* - * Dump sets - */ - - printf ("static const FcLangCharSet fcLangCharSets[] = {\n"); - for (i = 0; sets[i]; i++) - { - int j = duplicate[i]; - - if (j < 0) - j = i; - printf (" { (FcChar8 *) \"%s\",\n" - " { FC_REF_CONSTANT, %d, " - "(FcCharLeaf **) leaves_%s, " - "(FcChar16 *) numbers_%s } },\n", - langs[i], - sets[j]->num, names[j], names[j]); - } printf ("};\n\n"); + printf ("#define NUM_LANG_CHAR_SET %d\n", i); num_lang_set_map = (i + 31) / 32; printf ("#define NUM_LANG_SET_MAP %d\n", num_lang_set_map); @@ -414,6 +453,7 @@ main (int argc, char **argv) */ if (ncountry) { + int c; int ncountry_ent = 0; printf ("\n"); printf ("static const FcChar32 fcLangCountrySets[][NUM_LANG_SET_MAP] = {\n"); @@ -422,7 +462,7 @@ main (int argc, char **argv) i = country[c]; if (i >= 0) { - int l = strchr (langs[i], '-') - langs[i]; + int lang = strchr (langs[i], '-') - langs[i]; int d, k; for (k = 0; k < num_lang_set_map; k++) @@ -442,7 +482,7 @@ main (int argc, char **argv) for (k = 0; k < num_lang_set_map; k++) printf (" 0x%08x,", map[k]); printf (" }, /* %*.*s */\n", - l, l, langs[i]); + lang, lang, langs[i]); ++ncountry_ent; } } @@ -451,6 +491,23 @@ main (int argc, char **argv) } + /* + * Find ranges for each letter for faster searching + */ + setRangeChar = 'a'; + memset(setRangeStart, '\0', sizeof (setRangeStart)); + memset(setRangeEnd, '\0', sizeof (setRangeEnd)); + for (i = 0; sets[i]; i++) + { + char c = names[i][0]; + + while (setRangeChar <= c && c <= 'z') + setRangeStart[setRangeChar++ - 'a'] = i; + } + for (setRangeChar = 'a'; setRangeChar < 'z'; setRangeChar++) + setRangeEnd[setRangeChar - 'a'] = setRangeStart[setRangeChar+1-'a'] - 1; + setRangeEnd[setRangeChar - 'a'] = i - 1; + /* * Dump sets start/finish for the fastpath */ diff --git a/fc-lang/fc-lang.man b/fc-lang/fc-lang.man index 6789591..4dd62f3 100644 --- a/fc-lang/fc-lang.man +++ b/fc-lang/fc-lang.man @@ -37,5 +37,3 @@ determine language coverage for fonts which don't contain this information. .TP 15 .B fclang.tmpl.h The template file in which the tables are inserted -.SH "SEE ALSO" -fontconfig(3) diff --git a/fc-lang/fi.orth b/fc-lang/fi.orth index 3c53ea4..971bb83 100644 --- a/fc-lang/fi.orth +++ b/fc-lang/fi.orth @@ -49,4 +49,4 @@ #2019 # single quote #201d # double quote #203a # angle quote - +20AC # EURO SIGN diff --git a/fc-lang/fr.orth b/fc-lang/fr.orth index 7b8b7d3..e3cc052 100644 --- a/fc-lang/fr.orth +++ b/fc-lang/fr.orth @@ -56,3 +56,4 @@ 00FF # LATIN SMALL LETTER Y WITH DIAERESIS 00C6 # LATIN CAPITAL LETTER AE (ash) * 00E6 # LATIN SMALL LETTER AE (ash) * +20AC # EURO SIGN diff --git a/fc-lang/iso639-1 b/fc-lang/iso639-1 index cb4224b..6dfb17e 100644 --- a/fc-lang/iso639-1 +++ b/fc-lang/iso639-1 @@ -3,7 +3,7 @@ AB * Abkhazian Abkhazia (Georgia) Caucasian F. AF * Afrikaans South Africa, Namibia Indo-European F., Germanic Br. 10 AM * Amharic Ethiopia Hamito-Semitic F., Semitic Br. 20 AR * Arabic Middle East, N Africa Hamito-Semitic F., Semitic Br. 218 -AS Assamese Assam (India) Indo-European F., Indo-Iranian Br. 23 +AS * Assamese Assam (India) Indo-European F., Indo-Iranian Br. 23 AY * Aymara Bolivia, Peru Andean-Equatorial F., Andean Br. 2 AZ * Azerbaijani Iran, Azerbaijan Uralo-Altaic F., Turkic Br. 15 BA * Bashkir Bashkir (S Urals, Russia) Uralo-Altaic F., Turkic Br. 1 @@ -63,7 +63,7 @@ KS * Kashmiri Kashmir (India-Pakistan) Indo-European F., Indo-Iranian Br. 4 KU * Kurdish, Zimany Kurdy Turkey, Iran, Iraq, Syria Indo-European F., Indo-Iranian Br. 11 KY * Kirghiz Kirghiz, Sinkiang (China), Afghanistan Uralo-Altaic F., Turkic Br. 2 KY from Kyrgyz LA * Latin Indo-European F., Italic Br. Ancient language nearing extinction -LN Lingala, liNgala Zaire, Congo Niger-Kordofanian F., Non-Mande Br. 7 +LN * Lingala, liNgala Zaire, Congo Niger-Kordofanian F., Non-Mande Br. 7 LO * Laothian, Pha Xa Lao, Lao Laos, Thailand Sino-Tibetan F., Sino-Siamese Br. 4 LT * Lithuanian Lithuania Indo-European F., Balto-Slavic Br. 3 LV * Latvian, Lettish Latvia Indo-European F., Balto-Slavic Br. 2 diff --git a/fc-lang/iso639-2 b/fc-lang/iso639-2 index c4f1d8a..62cdb40 100644 --- a/fc-lang/iso639-2 +++ b/fc-lang/iso639-2 @@ -240,7 +240,7 @@ built. * lat la Latin latin * lav lv Latvian letton * lez Lezghian lezghien - lin ln Lingala lingala +* lin ln Lingala lingala * lit lt Lithuanian lituanien lol Mongo mongo loz Lozi lozi diff --git a/fc-lang/it.orth b/fc-lang/it.orth index 3d00647..04e8703 100644 --- a/fc-lang/it.orth +++ b/fc-lang/it.orth @@ -49,3 +49,4 @@ 00f2-00f3 00f9 00fa +20AC # EURO SIGN diff --git a/fc-lang/ka.orth b/fc-lang/ka.orth index 7c67e84..8a77983 100644 --- a/fc-lang/ka.orth +++ b/fc-lang/ka.orth @@ -27,7 +27,7 @@ 10d0-10f0 #10f1-10f6 # Archaic letters not included in modern fonts #10f7-10f8 # additional letters for Mingrelian and Svan -10fb +#10fb # Ancient Georgian paragraph separator #2018 # single quote #201a # single quote #201c # double quote diff --git a/fc-lang/ln.orth b/fc-lang/ln.orth new file mode 100644 index 0000000..f90c30e --- /dev/null +++ b/fc-lang/ln.orth @@ -0,0 +1,43 @@ +# +# $RCSId: xc/lib/fontconfig/fc-lang/ln.orth,v 1.1 2006/03/08 14:22:16 plam Exp $ +# +# Copyright © 2006 Danis Jacquerye +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Keith Packard not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Keith Packard makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# Lingala (LN) +0041-005a # r used in borrowed words, x and q unused. +0061-007a +00c1-00c2 # tonal orthography +00c9-00ca +00cd-00ce +00d3-00d4 +00da-00db +00e1-00e2 +00e9-00ea +00ed-00ee +00f3-00f4 +00fa-00fb +011a-011b +0186 +0190 +0254 +025b +0301-0302 # combining diacritics for accented 0186, 0190, 0254, 025b +030c diff --git a/fc-lang/nl.orth b/fc-lang/nl.orth index d6e0088..c07dd46 100644 --- a/fc-lang/nl.orth +++ b/fc-lang/nl.orth @@ -60,4 +60,5 @@ 00fb 00fc #0132-0133 # IJ and ij ligatures +20AC # EURO SIGN diff --git a/fc-lang/pt.orth b/fc-lang/pt.orth index 4b0a72b..cca7bf0 100644 --- a/fc-lang/pt.orth +++ b/fc-lang/pt.orth @@ -62,3 +62,4 @@ 00fc ##203a # angle quote # +20AC # EURO SIGN diff --git a/fc-lang/zh_hk.orth b/fc-lang/zh_hk.orth index 89661f1..1bea833 100644 --- a/fc-lang/zh_hk.orth +++ b/fc-lang/zh_hk.orth @@ -2237,4 +2237,4 @@ 9F99 9F9F 9FA5 -F907 +20547 diff --git a/fc-lang/zh_mo.orth b/fc-lang/zh_mo.orth index fa4d0d3..92c5ba2 100644 --- a/fc-lang/zh_mo.orth +++ b/fc-lang/zh_mo.orth @@ -23,5 +23,10 @@ # # Chinese in Macau (ZH-MO) # -# Just use Big5 as for ZH-TW -include zh_tw.orth +# from Abel Cheung: +# +# a majority of Macau people speak Cantonese too, and also uses additional +# traditional Chinese chars from Hong Kong (there are already some place names +# that can't be represented in just chars used in Taiwan). +# +include zh_hk.orth diff --git a/fc-list/Makefile.am b/fc-list/Makefile.am index e16ae41..88cbf6e 100644 --- a/fc-list/Makefile.am +++ b/fc-list/Makefile.am @@ -31,10 +31,9 @@ bin_PROGRAMS=fc-list INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) -EXTRA_DIST=$(SGML) - -fc_list_LDADD = ${top_builddir}/src/libfontconfig.la +EXTRA_DIST=fc-list.sgml +fc_list_LDADD = $(FREETYPE_LIBS) $(LIBXML2_LIBS) $(EXPAT_LIBS) ${top_builddir}/src/libfontconfig.la if USEDOCBOOK diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c index 04026cf..b85dfd7 100644 --- a/fc-list/fc-list.c +++ b/fc-list/fc-list.c @@ -85,7 +85,7 @@ static void usage (char *program) int main (int argc, char **argv) { - int verbose = 0; + /*int verbose = 0;*/ int i; FcObjectSet *os = 0; FcFontSet *fs; @@ -105,7 +105,7 @@ main (int argc, char **argv) FC_MAJOR, FC_MINOR, FC_REVISION); exit (0); case 'v': - verbose = 1; + /* verbose = 1; */ break; default: usage (argv[0]); diff --git a/fc-match/.cvsignore b/fc-match/.cvsignore index 3c5091d..5c153e9 100644 --- a/fc-match/.cvsignore +++ b/fc-match/.cvsignore @@ -3,3 +3,4 @@ Makefile Makefile.in fc-match +fc-match.1 diff --git a/fc-match/Makefile.am b/fc-match/Makefile.am index 71dc164..c35ca22 100644 --- a/fc-match/Makefile.am +++ b/fc-match/Makefile.am @@ -23,10 +23,33 @@ bin_PROGRAMS=fc-match -man_MANS=fc-match.1 +DOC2MAN = docbook2man + +FC_MATCH_SRC=${top_srcdir}/fc-match + +SGML = ${FC_MATCH_SRC}/fc-match.sgml INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) -EXTRA_DIST=$(man_MANS) +EXTRA_DIST=fc-match.sgml + +fc_match_LDADD = $(FREETYPE_LIBS) $(LIBXML2_LIBS) $(EXPAT_LIBS) ${top_builddir}/src/libfontconfig.la + +if USEDOCBOOK + +man_MANS=fc-match.1 + +${man_MANS}: ${SGML} + $(RM) $@ + $(DOC2MAN) ${SGML} + $(RM) manpage.refs manpage.links + +all-local: $(man_MANS) + +clean-local: + $(RM) $(man_MANS) -fc_match_LDADD = ${top_builddir}/src/libfontconfig.la +else +all-local: +clean-local: +endif diff --git a/fc-match/fc-match.1 b/fc-match/fc-match.1 deleted file mode 100644 index 3f33eee..0000000 --- a/fc-match/fc-match.1 +++ /dev/null @@ -1,39 +0,0 @@ -.\" -.\" Copyright © 2003 Keith Packard -.\" -.\" Permission to use, copy, modify, distribute, and sell this software and its -.\" documentation for any purpose is hereby granted without fee, provided that -.\" the above copyright notice appear in all copies and that both that -.\" copyright notice and this permission notice appear in supporting -.\" documentation, and that the name of Keith Packard not be used in -.\" advertising or publicity pertaining to distribution of the software without -.\" specific, written prior permission. Keith Packard makes no -.\" representations about the suitability of this software for any purpose. It -.\" is provided "as is" without express or implied warranty. -.\" -.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -.\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR -.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -.\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -.\" PERFORMANCE OF THIS SOFTWARE. -.\" -.\" -.\" $RCSId: xc/programs/fc-match/fc-match.man,v 1.3 2001/02/09 03:47:56 tsi Exp $ -.\" -.TH FC-MATCH 1 __vendorversion__ -.SH NAME -fc-match \- match available fonts -.SH SYNOPSIS -.B "fc-match" -.RI [-svV?] [--sort] [--verbose] [--version] [ font-pattern ] -.SH DESCRIPTION -.I fc-match -matches font-pattern (empty pattern by default) using the normal fontconfig -matching rules to find the best font available. If --sort is given, the -sorted list of best matching fonts is displayed. With --verbose, the whole -font pattern for each match is printed, otherwise only the file, family and -style are printed. -.SH "SEE ALSO" -fontconfig(3) diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c index 3ddba74..5f36f00 100644 --- a/fc-match/fc-match.c +++ b/fc-match/fc-match.c @@ -22,11 +22,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include -#include -#include -#include -#include #ifdef HAVE_CONFIG_H #include #else @@ -36,6 +31,12 @@ #define HAVE_GETOPT 1 #endif +#include +#include +#include +#include +#include + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -47,7 +48,7 @@ #undef _GNU_SOURCE #define _GNU_SOURCE #include -const struct option longopts[] = { +static const struct option longopts[] = { {"sort", 0, 0, 's'}, {"version", 0, 0, 'V'}, {"verbose", 0, 0, 'v'}, @@ -134,6 +135,9 @@ main (int argc, char **argv) else pat = FcPatternCreate (); + if (!pat) + return 1; + FcConfigSubstitute (0, pat, FcMatchPattern); FcDefaultSubstitute (pat); @@ -147,8 +151,7 @@ main (int argc, char **argv) if (match) FcFontSetAdd (fs, match); } - if (pat) - FcPatternDestroy (pat); + FcPatternDestroy (pat); if (fs) { @@ -184,5 +187,6 @@ main (int argc, char **argv) } FcFontSetDestroy (fs); } + FcFini (); return 0; } diff --git a/fc-match/fc-match.sgml b/fc-match/fc-match.sgml new file mode 100644 index 0000000..d68cc22 --- /dev/null +++ b/fc-match/fc-match.sgml @@ -0,0 +1,169 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Patrick"> + Lam"> + + Apr 6, 2006"> + + 1"> + plam@csail.mit.edu"> + + fc-match"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + match available fonts + + + + &dhpackage; + + + + + + + + + + + + DESCRIPTION + + &dhpackage; matches font-pattern (empty +pattern by default) using the normal fontconfig matching rules to find +the best font available. If --sort is given, the sorted list of best +matching fonts is displayed. With --verbose, the whole font pattern +for each match is printed, otherwise only the file, family and style +are printed.. + + + + OPTIONS + + This program follows the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + Print whole font pattern for each match. + + + + + + + + Show summary of options. + + + + + + + + Show version of the program and exit. + + + + + + + + Displays sorted list of best matching fonts. + + + + + + + Displays fonts matching + font-pattern (uses empty pattern by default). + + + + + + + SEE ALSO + + fc-list (1). + + The fontconfig user's guide, in HTML format: + /usr/share/doc/fontconfig/fontconfig-user.html. + + + + AUTHOR + + This manual page was updated by &dhusername; &dhemail;. + + +
+ + diff --git a/fontconfig.pc.in b/fontconfig.pc.in index 8f599c1..d7c02c7 100644 --- a/fontconfig.pc.in +++ b/fontconfig.pc.in @@ -7,4 +7,5 @@ Name: Fontconfig Description: Font configuration and customization library Version: @VERSION@ Libs: -L${libdir} -lfontconfig +Libs.private: @EXPAT_LIBS@ Cflags: -I${includedir} diff --git a/fontconfig/fcprivate.h b/fontconfig/fcprivate.h index ac68bfc..9be4c01 100644 --- a/fontconfig/fcprivate.h +++ b/fontconfig/fcprivate.h @@ -59,22 +59,22 @@ __v__.u.d = va_arg (va, double); \ break; \ case FcTypeString: \ - __v__.u.s = va_arg (va, FcChar8 *); \ + __v__.u.s = va_arg (va, const FcChar8 *); \ break; \ case FcTypeBool: \ __v__.u.b = va_arg (va, FcBool); \ break; \ case FcTypeMatrix: \ - __v__.u.m = va_arg (va, FcMatrix *); \ + __v__.u.m = va_arg (va, const FcMatrix *); \ break; \ case FcTypeCharSet: \ - __v__.u.c = va_arg (va, FcCharSet *); \ + __v__.u.c = va_arg (va, const FcCharSet *); \ break; \ case FcTypeFTFace: \ __v__.u.f = va_arg (va, FT_Face); \ break; \ case FcTypeLangSet: \ - __v__.u.l = va_arg (va, FcLangSet *); \ + __v__.u.l = va_arg (va, const FcLangSet *); \ break; \ } \ if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 79e9cfd..6ca1cf4 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -27,6 +27,12 @@ #include +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0))) +#else +#define FC_ATTRIBUTE_SENTINEL(x) +#endif + typedef unsigned char FcChar8; typedef unsigned short FcChar16; typedef unsigned int FcChar32; @@ -40,7 +46,7 @@ typedef int FcBool; #define FC_MAJOR 2 #define FC_MINOR 3 -#define FC_REVISION 2 +#define FC_REVISION 96 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION)) @@ -54,7 +60,7 @@ typedef int FcBool; * it means multiple copies of the font information. */ -#define FC_CACHE_VERSION "1" +#define FC_CACHE_VERSION "2" #define FcTrue 1 #define FcFalse 0 @@ -96,7 +102,10 @@ typedef int FcBool; #define FC_CAPABILITY "capability" /* String */ #define FC_FONTFORMAT "fontformat" /* String */ #define FC_EMBOLDEN "embolden" /* Bool - true if emboldening needed*/ +#define FC_EMBEDDED_BITMAP "embeddedbitmap" /* Bool - true to enable embedded bitmaps */ +#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */ +#define FC_CACHE_SUFFIX ".cache-"FC_CACHE_VERSION #define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION #define FC_USER_CACHE_FILE ".fonts.cache-"FC_CACHE_VERSION @@ -228,7 +237,7 @@ typedef struct _FcObjectSet { } FcObjectSet; typedef enum _FcMatchKind { - FcMatchPattern, FcMatchFont + FcMatchPattern, FcMatchFont, FcMatchScan } FcMatchKind; typedef enum _FcLangResult { @@ -522,7 +531,7 @@ FcObjectSet * FcObjectSetVaBuild (const char *first, va_list va); FcObjectSet * -FcObjectSetBuild (const char *first, ...); +FcObjectSetBuild (const char *first, ...) FC_ATTRIBUTE_SENTINEL(0); FcFontSet * FcFontSetList (FcConfig *config, @@ -739,7 +748,7 @@ FcPattern * FcPatternVaBuild (FcPattern *orig, va_list va); FcPattern * -FcPatternBuild (FcPattern *orig, ...); +FcPatternBuild (FcPattern *orig, ...) FC_ATTRIBUTE_SENTINEL(0); /* fcstr.c */ @@ -841,4 +850,6 @@ FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain); _FCFUNCPROTOEND +#undef FC_ATTRIBUTE_SENTINEL + #endif /* _FONTCONFIG_H_ */ diff --git a/fonts.conf.in b/fonts.conf.in index 869fec1..adc44e8 100644 --- a/fonts.conf.in +++ b/fonts.conf.in @@ -27,6 +27,11 @@ @FC_FONTPATH@ ~/.fonts + + + @FC_CACHEDIR@ + ~/.fontconfig + @@ -73,6 +78,7 @@ --> Bitstream Vera Serif + DejaVu Serif Times New Roman Thorndale AMT Times @@ -92,6 +98,7 @@ --> Bitstream Vera Sans + DejaVu Sans Helvetica Arial Verdana @@ -113,6 +120,7 @@ --> Bitstream Vera Sans Mono + DejaVu Sans Mono Courier Courier New Andale Mono @@ -142,21 +150,52 @@ - Times - Nimbus Roman No9 L + Avant Garde + URW Gothic L + + + Bookman + URW Bookman L + + + Courier + Nimbus Mono L Helvetica Nimbus Sans L - Courier - Nimbus Mono L + New Century Schoolbook + Century Schoolbook L + + + Palatino + URW Palladio L + + + Times + Nimbus Roman No9 L - + + Zapf Chancery + URW Chancery L + + + Zapf Dingbats + Dingbats + + + + Symbol + + + Standard Symbols L + + + + false + - 100 + medium - - 200 + + medium - + true + + + bold + diff --git a/fonts.dtd b/fonts.dtd index 6c9a33d..06f1a12 100644 --- a/fonts.dtd +++ b/fonts.dtd @@ -22,6 +22,18 @@ + + + + + target (pattern|font|scan) "pattern"> +#include +#include +#include +#include +#if defined(HAVE_MMAP) || defined(__CYGWIN__) +# include +# include +#elif defined(_WIN32) +# include +#endif -/* - * POSIX has broken stdio so that getc must do thread-safe locking, - * this is a serious performance problem for applications doing large - * amounts of IO with getc (as is done here). If available, use - * the getc_unlocked varient instead. - */ - -#if defined(getc_unlocked) || defined(_IO_getc_unlocked) -#define GETC(f) getc_unlocked(f) -#define PUTC(c,f) putc_unlocked(c,f) -#else -#define GETC(f) getc(f) -#define PUTC(c,f) putc(c,f) +#ifndef O_BINARY +#define O_BINARY 0 #endif -#define FC_DBG_CACHE_REF 1024 +struct MD5Context { + FcChar32 buf[4]; + FcChar32 bits[2]; + unsigned char in[64]; +}; -static FcChar8 * -FcCacheReadString (FILE *f, FcChar8 *dest, int len) -{ - int c; - FcBool escape; - FcChar8 *d; - int size; - int i; - - while ((c = GETC (f)) != EOF) - if (c == '"') - break; - if (c == EOF) - return FcFalse; - if (len == 0) - return FcFalse; - - size = len; - i = 0; - d = dest; - escape = FcFalse; - while ((c = GETC (f)) != EOF) - { - if (!escape) - { - switch (c) { - case '"': - c = '\0'; - break; - case '\\': - escape = FcTrue; - continue; - } - } - if (i == size) - { - FcChar8 *new = malloc (size * 2); /* freed in caller */ - if (!new) - break; - memcpy (new, d, size); - size *= 2; - if (d != dest) - free (d); - d = new; - } - d[i++] = c; - if (c == '\0') - return d; - escape = FcFalse; - } - if (d != dest) - free (d); - return 0; -} +static void MD5Init(struct MD5Context *ctx); +static void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len); +static void MD5Final(unsigned char digest[16], struct MD5Context *ctx); +static void MD5Transform(FcChar32 buf[4], FcChar32 in[16]); -static FcBool -FcCacheReadUlong (FILE *f, unsigned long *dest) -{ - unsigned long t; - int c; +#define CACHEBASE_LEN (1 + 32 + 1 + sizeof (FC_ARCHITECTURE) + sizeof (FC_CACHE_SUFFIX)) - while ((c = GETC (f)) != EOF) - { - if (!isspace (c)) - break; - } - if (c == EOF) - return FcFalse; - t = 0; - for (;;) - { - if (c == EOF || isspace (c)) - break; - if (!isdigit (c)) - return FcFalse; - t = t * 10 + (c - '0'); - c = GETC (f); - } - *dest = t; - return FcTrue; -} +static const char bin2hex[] = { '0', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', 'a', 'b', + 'c', 'd', 'e', 'f' }; -static FcBool -FcCacheReadInt (FILE *f, int *dest) +static FcChar8 * +FcDirCacheBasename (const FcChar8 * dir, FcChar8 cache_base[CACHEBASE_LEN]) { - unsigned long t; - FcBool ret; + unsigned char hash[16]; + FcChar8 *hex_hash; + int cnt; + struct MD5Context ctx; - ret = FcCacheReadUlong (f, &t); - if (ret) - *dest = (int) t; - return ret; -} + MD5Init (&ctx); + MD5Update (&ctx, (unsigned char *)dir, strlen ((char *) dir)); -static FcBool -FcCacheReadTime (FILE *f, time_t *dest) -{ - unsigned long t; - FcBool ret; + MD5Final (hash, &ctx); - ret = FcCacheReadUlong (f, &t); - if (ret) - *dest = (time_t) t; - return ret; -} - -static FcBool -FcCacheWriteChars (FILE *f, const FcChar8 *chars) -{ - FcChar8 c; - while ((c = *chars++)) + cache_base[0] = '/'; + hex_hash = cache_base + 1; + for (cnt = 0; cnt < 16; ++cnt) { - switch (c) { - case '"': - case '\\': - if (PUTC ('\\', f) == EOF) - return FcFalse; - /* fall through */ - default: - if (PUTC (c, f) == EOF) - return FcFalse; - } + hex_hash[2*cnt ] = bin2hex[hash[cnt] >> 4]; + hex_hash[2*cnt+1] = bin2hex[hash[cnt] & 0xf]; } - return FcTrue; + hex_hash[2*cnt] = 0; + strcat ((char *) cache_base, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX); + + return cache_base; } -static FcBool -FcCacheWriteString (FILE *f, const FcChar8 *string) +FcBool +FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config) { + FcChar8 *cache_hashed = NULL; + FcChar8 cache_base[CACHEBASE_LEN]; + FcStrList *list; + FcChar8 *cache_dir; - if (PUTC ('"', f) == EOF) - return FcFalse; - if (!FcCacheWriteChars (f, string)) - return FcFalse; - if (PUTC ('"', f) == EOF) - return FcFalse; - return FcTrue; -} + FcDirCacheBasename (dir, cache_base); -static FcBool -FcCacheWritePath (FILE *f, const FcChar8 *dir, const FcChar8 *file) -{ - if (PUTC ('"', f) == EOF) - return FcFalse; - if (dir) - if (!FcCacheWriteChars (f, dir)) - return FcFalse; -#ifdef _WIN32 - if (dir && - dir[strlen((const char *) dir) - 1] != '/' && - dir[strlen((const char *) dir) - 1] != '\\') + list = FcStrListCreate (config->cacheDirs); + if (!list) + return FcFalse; + + while ((cache_dir = FcStrListNext (list))) { - if (!FcCacheWriteChars (f, "\\")) - return FcFalse; + cache_hashed = FcStrPlus (cache_dir, cache_base); + if (!cache_hashed) + break; + (void) unlink ((char *) cache_hashed); } -#else - if (dir && dir[strlen((const char *) dir) - 1] != '/') - if (PUTC ('/', f) == EOF) - return FcFalse; -#endif - if (!FcCacheWriteChars (f, file)) - return FcFalse; - if (PUTC ('"', f) == EOF) + FcStrListDone (list); + /* return FcFalse if something went wrong */ + if (cache_dir) return FcFalse; return FcTrue; } -static FcBool -FcCacheWriteUlong (FILE *f, unsigned long t) +static int +FcDirCacheOpenFile (const FcChar8 *cache_file, struct stat *file_stat) { - int pow; - unsigned long temp, digit; + int fd; - temp = t; - pow = 1; - while (temp >= 10) + fd = open((char *) cache_file, O_RDONLY | O_BINARY); + if (fd < 0) + return fd; + if (fstat (fd, file_stat) < 0) { - temp /= 10; - pow *= 10; + close (fd); + return -1; } - temp = t; - while (pow) - { - digit = temp / pow; - if (PUTC ((char) digit + '0', f) == EOF) - return FcFalse; - temp = temp - pow * digit; - pow = pow / 10; - } - return FcTrue; + return fd; } +/* + * Look for a cache file for the specified dir. Attempt + * to use each one we find, stopping when the callback + * indicates success + */ static FcBool -FcCacheWriteInt (FILE *f, int i) +FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, + FcBool (*callback) (int fd, off_t size, void *closure), + void *closure, FcChar8 **cache_file_ret) { - return FcCacheWriteUlong (f, (unsigned long) i); -} + int fd = -1; + FcChar8 cache_base[CACHEBASE_LEN]; + FcStrList *list; + FcChar8 *cache_dir; + struct stat file_stat, dir_stat; + FcBool ret = FcFalse; -static FcBool -FcCacheWriteTime (FILE *f, time_t t) -{ - return FcCacheWriteUlong (f, (unsigned long) t); -} + if (stat ((char *) dir, &dir_stat) < 0) + return FcFalse; -static FcBool -FcCacheFontSetAdd (FcFontSet *set, - FcStrSet *dirs, - const FcChar8 *dir, - int dir_len, - const FcChar8 *file, - const FcChar8 *name, - FcConfig *config) -{ - FcChar8 path_buf[8192], *path; - int len; - FcBool ret = FcFalse; - FcPattern *font; - FcPattern *frozen; + FcDirCacheBasename (dir, cache_base); - path = path_buf; - len = (dir_len + 1 + strlen ((const char *) file) + 1); - if (len > sizeof (path_buf)) - { - path = malloc (len); /* freed down below */ - if (!path) - return FcFalse; - } - strncpy ((char *) path, (const char *) dir, dir_len); -#ifdef _WIN32 - if (dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\' ) - path[dir_len++] = '\\'; -#else - if (dir[dir_len - 1] != '/') - path[dir_len++] = '/'; -#endif - strcpy ((char *) path + dir_len, (const char *) file); - if (config && !FcConfigAcceptFilename (config, path)) - ret = FcTrue; - else if (!FcStrCmp (name, FC_FONT_FILE_DIR)) - { - if (FcDebug () & FC_DBG_CACHEV) - printf (" dir cache dir \"%s\"\n", path); - ret = FcStrSetAdd (dirs, path); - } - else if (!FcStrCmp (name, FC_FONT_FILE_INVALID)) - { - ret = FcTrue; - } - else + list = FcStrListCreate (config->cacheDirs); + if (!list) + return FcFalse; + + while ((cache_dir = FcStrListNext (list))) { - font = FcNameParse (name); - if (font) - { - FcChar8 *family; - - if (FcDebug () & FC_DBG_CACHEV) - printf (" dir cache file \"%s\"\n", file); - ret = FcPatternAddString (font, FC_FILE, path); - /* - * Make sure the pattern has the file name as well as - * already containing at least one family name. - */ - if (ret && - FcPatternGetString (font, FC_FAMILY, 0, &family) == FcResultMatch && - (!config || FcConfigAcceptFont (config, font))) + FcChar8 *cache_hashed = FcStrPlus (cache_dir, cache_base); + if (!cache_hashed) + break; + fd = FcDirCacheOpenFile (cache_hashed, &file_stat); + if (fd >= 0) { + if (dir_stat.st_mtime <= file_stat.st_mtime) { - frozen = FcPatternFreeze (font); - ret = (frozen != 0); + ret = (*callback) (fd, file_stat.st_size, closure); if (ret) - ret = FcFontSetAdd (set, frozen); + { + if (cache_file_ret) + *cache_file_ret = cache_hashed; + else + FcStrFree (cache_hashed); + close (fd); + break; + } } - FcPatternDestroy (font); + close (fd); } + FcStrFree (cache_hashed); } - if (path != path_buf) free (path); - return ret; + FcStrListDone (list); + return ret; } -static unsigned int -FcCacheHash (const FcChar8 *string, int len) -{ - unsigned int h = 0; - FcChar8 c; - - while (len-- && (c = *string++)) - h = (h << 1) ^ c; - return h; -} +#define FC_CACHE_MIN_MMAP 1024 /* - * Verify the saved timestamp for a file + * Map a cache file into memory */ -FcBool -FcGlobalCacheCheckTime (const FcChar8 *file, FcGlobalCacheInfo *info) +static FcCache * +FcDirCacheMapFd (int fd, off_t size) { - struct stat statb; + FcCache *cache = NULL; + FcBool allocated = FcFalse; - if (stat ((char *) file, &statb) < 0) + if (size < sizeof (FcCache)) + return NULL; + /* + * For small cache files, just read them into memory + */ + if (size >= FC_CACHE_MIN_MMAP) { - if (FcDebug () & FC_DBG_CACHE) - printf (" file %s missing\n", file); - return FcFalse; +#if defined(HAVE_MMAP) || defined(__CYGWIN__) + cache = mmap (0, size, PROT_READ, MAP_SHARED, fd, 0); +#elif defined(_WIN32) + { + HANDLE hFileMap; + + cache = NULL; + hFileMap = CreateFileMapping((HANDLE) _get_osfhandle(fd), NULL, + PAGE_READONLY, 0, 0, NULL); + if (hFileMap != NULL) + { + cache = MapViewOfFile (hFileMap, FILE_MAP_READ, 0, 0, size); + CloseHandle (hFileMap); + } + } +#endif } - if (statb.st_mtime != info->time) + if (!cache) { - if (FcDebug () & FC_DBG_CACHE) - printf (" timestamp mismatch (was %d is %d)\n", - (int) info->time, (int) statb.st_mtime); - return FcFalse; + cache = malloc (size); + if (!cache) + return NULL; + + if (read (fd, cache, size) != size) + { + free (cache); + return NULL; + } + allocated = FcTrue; + } + if (cache->magic != FC_CACHE_MAGIC_MMAP || + cache->version < FC_CACHE_CONTENT_VERSION || + cache->size != size) + { + if (allocated) + free (cache); + else + { +#if defined(HAVE_MMAP) || defined(__CYGWIN__) + munmap (cache, size); +#elif defined(_WIN32) + UnmapViewOfFile (cache); +#endif + } + return NULL; } - return FcTrue; + + /* Mark allocated caches so they're freed rather than unmapped */ + if (allocated) + cache->magic = FC_CACHE_MAGIC_ALLOC; + + return cache; } void -FcGlobalCacheReferenced (FcGlobalCache *cache, - FcGlobalCacheInfo *info) +FcDirCacheUnload (FcCache *cache) { - if (!info->referenced) - { - info->referenced = FcTrue; - cache->referenced++; - if (FcDebug () & FC_DBG_CACHE_REF) - printf ("Reference %d %s\n", cache->referenced, info->file); + switch (cache->magic) { + case FC_CACHE_MAGIC_ALLOC: + free (cache); + break; + case FC_CACHE_MAGIC_MMAP: +#if defined(HAVE_MMAP) || defined(__CYGWIN__) + munmap (cache, cache->size); +#elif defined(_WIN32) + UnmapViewOfFile (cache); +#endif + break; } } -/* - * Break a path into dir/base elements and compute the base hash - * and the dir length. This is shared between the functions - * which walk the file caches - */ - -typedef struct _FcFilePathInfo { - const FcChar8 *dir; - int dir_len; - const FcChar8 *base; - unsigned int base_hash; -} FcFilePathInfo; - -static FcFilePathInfo -FcFilePathInfoGet (const FcChar8 *path) +static FcBool +FcDirCacheMapHelper (int fd, off_t size, void *closure) { - FcFilePathInfo i; - FcChar8 *slash; + FcCache *cache = FcDirCacheMapFd (fd, size); - slash = FcStrLastSlash (path); - if (slash) - { - i.dir = path; - i.dir_len = slash - path; - if (!i.dir_len) - i.dir_len = 1; - i.base = slash + 1; - } - else - { - i.dir = (const FcChar8 *) "."; - i.dir_len = 1; - i.base = path; - } - i.base_hash = FcCacheHash (i.base, -1); - return i; + if (!cache) + return FcFalse; + *((FcCache **) closure) = cache; + return FcTrue; } -FcGlobalCacheDir * -FcGlobalCacheDirGet (FcGlobalCache *cache, - const FcChar8 *dir, - int len, - FcBool create_missing) +FcCache * +FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file) { - unsigned int hash = FcCacheHash (dir, len); - FcGlobalCacheDir *d, **prev; + FcCache *cache = NULL; - for (prev = &cache->ents[hash % FC_GLOBAL_CACHE_DIR_HASH_SIZE]; - (d = *prev); - prev = &(*prev)->next) - { - if (d->info.hash == hash && d->len == len && - !strncmp ((const char *) d->info.file, - (const char *) dir, len)) - break; - } - if (!(d = *prev)) - { - int i; - if (!create_missing) - return 0; - d = malloc (sizeof (FcGlobalCacheDir) + len + 1); - if (!d) - return 0; - FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCacheDir) + len + 1); - d->next = *prev; - *prev = d; - d->info.hash = hash; - d->info.file = (FcChar8 *) (d + 1); - strncpy ((char *) d->info.file, (const char *) dir, len); - d->info.file[len] = '\0'; - d->info.time = 0; - d->info.referenced = FcFalse; - d->len = len; - for (i = 0; i < FC_GLOBAL_CACHE_FILE_HASH_SIZE; i++) - d->ents[i] = 0; - d->subdirs = 0; - } - return d; + if (!FcDirCacheProcess (config, dir, + FcDirCacheMapHelper, + &cache, cache_file)) + return NULL; + return cache; } -static FcGlobalCacheInfo * -FcGlobalCacheDirAdd (FcGlobalCache *cache, - const FcChar8 *dir, - time_t time, - FcBool replace, - FcBool create_missing) +FcCache * +FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat) { - FcGlobalCacheDir *d; - FcFilePathInfo i; - FcGlobalCacheSubdir *subdir; - FcGlobalCacheDir *parent; - - i = FcFilePathInfoGet (dir); - parent = FcGlobalCacheDirGet (cache, i.dir, i.dir_len, create_missing); - /* - * Tricky here -- directories containing fonts.cache-1 files - * need entries only when the parent doesn't have a cache file. - * That is, when the parent already exists in the cache, is - * referenced and has a "real" timestamp. The time of 0 is - * special and marks directories which got stuck in the - * global cache for this very reason. Yes, it could - * use a separate boolean field, and probably should. - */ - if (!parent || (!create_missing && - (!parent->info.referenced || - (parent->info.time == 0)))) - return 0; - /* - * Add this directory to the cache - */ - d = FcGlobalCacheDirGet (cache, dir, strlen ((const char *) dir), FcTrue); - if (!d) - return 0; - d->info.time = time; - /* - * Add this directory to the subdirectory list of the parent - */ - subdir = malloc (sizeof (FcGlobalCacheSubdir)); - if (!subdir) - return 0; - FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCacheSubdir)); - subdir->ent = d; - subdir->next = parent->subdirs; - parent->subdirs = subdir; - return &d->info; + int fd; + FcCache *cache; + + fd = FcDirCacheOpenFile (cache_file, file_stat); + if (fd < 0) + return NULL; + cache = FcDirCacheMapFd (fd, file_stat->st_size); + close (fd); + return cache; } -static void -FcGlobalCacheDirDestroy (FcGlobalCacheDir *d) +/* + * Validate a cache file by reading the header and checking + * the magic number and the size field + */ +static FcBool +FcDirCacheValidateHelper (int fd, off_t size, void *closure) { - FcGlobalCacheFile *f, *next; - int h; - FcGlobalCacheSubdir *s, *nexts; - - for (h = 0; h < FC_GLOBAL_CACHE_FILE_HASH_SIZE; h++) - for (f = d->ents[h]; f; f = next) - { - next = f->next; - FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheFile) + - strlen ((char *) f->info.file) + 1 + - strlen ((char *) f->name) + 1); - free (f); - } - for (s = d->subdirs; s; s = nexts) - { - nexts = s->next; - FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheSubdir)); - free (s); - } - FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheDir) + d->len + 1); - free (d); + FcBool ret = FcTrue; + FcCache c; + struct stat file_stat; + + if (read (fd, &c, sizeof (FcCache)) != sizeof (FcCache)) + ret = FcFalse; + else if (c.magic != FC_CACHE_MAGIC_MMAP) + ret = FcFalse; + else if (c.version < FC_CACHE_CONTENT_VERSION) + ret = FcFalse; + else if (fstat (fd, &file_stat) < 0) + ret = FcFalse; + else if (file_stat.st_size != c.size) + ret = FcFalse; + return ret; } -/* - * If the parent is in the global cache and referenced, add - * an entry for 'dir' to the global cache. This is used - * for directories with fonts.cache files - */ +static FcBool +FcDirCacheValidConfig (const FcChar8 *dir, FcConfig *config) +{ + return FcDirCacheProcess (config, dir, + FcDirCacheValidateHelper, + NULL, NULL); +} -void -FcGlobalCacheReferenceSubdir (FcGlobalCache *cache, - const FcChar8 *dir) +FcBool +FcDirCacheValid (const FcChar8 *dir) { - FcGlobalCacheInfo *info; - info = FcGlobalCacheDirAdd (cache, dir, 0, FcFalse, FcFalse); - if (info && !info->referenced) - { - info->referenced = FcTrue; - cache->referenced++; - } + FcConfig *config; + + config = FcConfigGetCurrent (); + if (!config) + return FcFalse; + + return FcDirCacheValidConfig (dir, config); } /* - * Check to see if the global cache contains valid data for 'dir'. - * If so, scan the global cache for files and directories in 'dir'. - * else, return False. + * Build a cache structure from the given contents */ -FcBool -FcGlobalCacheScanDir (FcFontSet *set, - FcStrSet *dirs, - FcGlobalCache *cache, - const FcChar8 *dir, - FcConfig *config) +FcCache * +FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, FcStrSet *dirs) { - FcGlobalCacheDir *d = FcGlobalCacheDirGet (cache, dir, - strlen ((const char *) dir), - FcFalse); - FcGlobalCacheFile *f; - int h; - int dir_len; - FcGlobalCacheSubdir *subdir; - FcBool any_in_cache = FcFalse; - - if (FcDebug() & FC_DBG_CACHE) - printf ("FcGlobalCacheScanDir %s\n", dir); + FcSerialize *serialize = FcSerializeCreate (); + FcCache *cache; + int i; + intptr_t cache_offset; + intptr_t dirs_offset; + FcChar8 *dir_serialize; + intptr_t *dirs_serialize; + FcFontSet *set_serialize; - if (!d) - { - if (FcDebug () & FC_DBG_CACHE) - printf ("\tNo dir cache entry\n"); - return FcFalse; - } + if (!serialize) + return NULL; + /* + * Space for cache structure + */ + cache_offset = FcSerializeReserve (serialize, sizeof (FcCache)); + /* + * Directory name + */ + if (!FcStrSerializeAlloc (serialize, dir)) + goto bail1; + /* + * Subdirs + */ + dirs_offset = FcSerializeAlloc (serialize, dirs, dirs->num * sizeof (FcChar8 *)); + for (i = 0; i < dirs->num; i++) + if (!FcStrSerializeAlloc (serialize, dirs->strs[i])) + goto bail1; /* - * See if the timestamp recorded in the global cache - * matches the directory time, if not, return False + * Patterns */ - if (!FcGlobalCacheCheckTime (d->info.file, &d->info)) - { - if (FcDebug () & FC_DBG_CACHE) - printf ("\tdir cache entry time mismatch\n"); - return FcFalse; - } + if (!FcFontSetSerializeAlloc (serialize, set)) + goto bail1; + + /* Serialize layout complete. Now allocate space and fill it */ + cache = malloc (serialize->size); + if (!cache) + goto bail1; + /* shut up valgrind */ + memset (cache, 0, serialize->size); + + serialize->linear = cache; + + cache->magic = FC_CACHE_MAGIC_ALLOC; + cache->version = FC_CACHE_CONTENT_VERSION; + cache->size = serialize->size; /* - * Add files from 'dir' to the fontset + * Serialize directory name */ - dir_len = strlen ((const char *) dir); - for (h = 0; h < FC_GLOBAL_CACHE_FILE_HASH_SIZE; h++) - for (f = d->ents[h]; f; f = f->next) - { - if (FcDebug() & FC_DBG_CACHEV) - printf ("FcGlobalCacheScanDir add file %s\n", f->info.file); - any_in_cache = FcTrue; - if (!FcCacheFontSetAdd (set, dirs, dir, dir_len, - f->info.file, f->name, config)) - { - cache->broken = FcTrue; - return FcFalse; - } - FcGlobalCacheReferenced (cache, &f->info); - } + dir_serialize = FcStrSerialize (serialize, dir); + if (!dir_serialize) + goto bail2; + cache->dir = FcPtrToOffset (cache, dir_serialize); + /* - * Add directories in 'dir' to 'dirs' + * Serialize sub dirs */ - for (subdir = d->subdirs; subdir; subdir = subdir->next) + dirs_serialize = FcSerializePtr (serialize, dirs); + if (!dirs_serialize) + goto bail2; + cache->dirs = FcPtrToOffset (cache, dirs_serialize); + cache->dirs_count = dirs->num; + for (i = 0; i < dirs->num; i++) { - FcFilePathInfo info = FcFilePathInfoGet (subdir->ent->info.file); - - any_in_cache = FcTrue; - if (!FcCacheFontSetAdd (set, dirs, dir, dir_len, - info.base, FC_FONT_FILE_DIR, config)) - { - cache->broken = FcTrue; - return FcFalse; - } - FcGlobalCacheReferenced (cache, &subdir->ent->info); + FcChar8 *d_serialize = FcStrSerialize (serialize, dirs->strs[i]); + if (!d_serialize) + goto bail2; + dirs_serialize[i] = FcPtrToOffset (dirs_serialize, d_serialize); } - FcGlobalCacheReferenced (cache, &d->info); - /* - * To recover from a bug in previous versions of fontconfig, - * return FcFalse if no entries in the cache were found - * for this directory. This will cause any empty directories - * to get rescanned every time fontconfig is initialized. This - * might get removed at some point when the older cache files are - * presumably fixed. + * Serialize font set */ - return any_in_cache; -} + set_serialize = FcFontSetSerialize (serialize, set); + if (!set_serialize) + goto bail2; + cache->set = FcPtrToOffset (cache, set_serialize); -/* - * Locate the cache entry for a particular file - */ -FcGlobalCacheFile * -FcGlobalCacheFileGet (FcGlobalCache *cache, - const FcChar8 *file, - int id, - int *count) -{ - FcFilePathInfo i = FcFilePathInfoGet (file); - FcGlobalCacheDir *d = FcGlobalCacheDirGet (cache, i.dir, - i.dir_len, FcFalse); - FcGlobalCacheFile *f, *match = 0; - int max = -1; - - if (!d) - return 0; - for (f = d->ents[i.base_hash % FC_GLOBAL_CACHE_FILE_HASH_SIZE]; f; f = f->next) - { - if (f->info.hash == i.base_hash && - !strcmp ((const char *) f->info.file, (const char *) i.base)) - { - if (f->id == id) - match = f; - if (f->id > max) - max = f->id; - } - } - if (count) - *count = max + 1; - return match; -} + FcSerializeDestroy (serialize); -/* - * Add a file entry to the cache - */ -static FcGlobalCacheInfo * -FcGlobalCacheFileAdd (FcGlobalCache *cache, - const FcChar8 *path, - int id, - time_t time, - const FcChar8 *name, - FcBool replace) -{ - FcFilePathInfo i = FcFilePathInfoGet (path); - FcGlobalCacheDir *d = FcGlobalCacheDirGet (cache, i.dir, - i.dir_len, FcTrue); - FcGlobalCacheFile *f, **prev; - int size; - - if (!d) - return 0; - for (prev = &d->ents[i.base_hash % FC_GLOBAL_CACHE_FILE_HASH_SIZE]; - (f = *prev); - prev = &(*prev)->next) - { - if (f->info.hash == i.base_hash && - f->id == id && - !strcmp ((const char *) f->info.file, (const char *) i.base)) - { - break; - } - } - if (*prev) - { - if (!replace) - return 0; - - f = *prev; - if (f->info.referenced) - cache->referenced--; - *prev = f->next; - FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheFile) + - strlen ((char *) f->info.file) + 1 + - strlen ((char *) f->name) + 1); - free (f); - } - size = (sizeof (FcGlobalCacheFile) + - strlen ((char *) i.base) + 1 + - strlen ((char *) name) + 1); - f = malloc (size); - if (!f) - return 0; - FcMemAlloc (FC_MEM_CACHE, size); - f->next = *prev; - *prev = f; - f->info.hash = i.base_hash; - f->info.file = (FcChar8 *) (f + 1); - f->info.time = time; - f->info.referenced = FcFalse; - f->id = id; - f->name = f->info.file + strlen ((char *) i.base) + 1; - strcpy ((char *) f->info.file, (const char *) i.base); - strcpy ((char *) f->name, (const char *) name); - return &f->info; -} - -FcGlobalCache * -FcGlobalCacheCreate (void) -{ - FcGlobalCache *cache; - int h; - - cache = malloc (sizeof (FcGlobalCache)); - if (!cache) - return 0; - FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCache)); - for (h = 0; h < FC_GLOBAL_CACHE_DIR_HASH_SIZE; h++) - cache->ents[h] = 0; - cache->entries = 0; - cache->referenced = 0; - cache->updated = FcFalse; - cache->broken = FcFalse; return cache; -} - -void -FcGlobalCacheDestroy (FcGlobalCache *cache) -{ - FcGlobalCacheDir *d, *next; - int h; - for (h = 0; h < FC_GLOBAL_CACHE_DIR_HASH_SIZE; h++) - { - for (d = cache->ents[h]; d; d = next) - { - next = d->next; - FcGlobalCacheDirDestroy (d); - } - } - FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCache)); +bail2: free (cache); +bail1: + FcSerializeDestroy (serialize); + return NULL; } -/* - * Cache file syntax is quite simple: - * - * "file_name" id time "font_name" \n - */ - -void -FcGlobalCacheLoad (FcGlobalCache *cache, - const FcChar8 *cache_file) -{ - FILE *f; - FcChar8 file_buf[8192], *file; - int id; - time_t time; - FcChar8 name_buf[8192], *name; - FcGlobalCacheInfo *info; - - f = fopen ((char *) cache_file, "r"); - if (!f) - return; - - cache->updated = FcFalse; - file = 0; - name = 0; - while ((file = FcCacheReadString (f, file_buf, sizeof (file_buf))) && - FcCacheReadInt (f, &id) && - FcCacheReadTime (f, &time) && - (name = FcCacheReadString (f, name_buf, sizeof (name_buf)))) - { - if (FcDebug () & FC_DBG_CACHEV) - printf ("FcGlobalCacheLoad \"%s\" \"%20.20s\"\n", file, name); - if (!FcStrCmp (name, FC_FONT_FILE_DIR)) - info = FcGlobalCacheDirAdd (cache, file, time, FcFalse, FcTrue); - else - info = FcGlobalCacheFileAdd (cache, file, id, time, name, FcFalse); - if (!info) - cache->broken = FcTrue; - else - cache->entries++; - if (FcDebug () & FC_DBG_CACHE_REF) - printf ("FcGlobalCacheLoad entry %d %s\n", - cache->entries, file); - if (file != file_buf) - free (file); - if (name != name_buf) - free (name); - file = 0; - name = 0; - } - if (file && file != file_buf) - free (file); - if (name && name != name_buf) - free (name); - fclose (f); -} - -FcBool -FcGlobalCacheUpdate (FcGlobalCache *cache, - const FcChar8 *file, - int id, - const FcChar8 *name) +static FcBool +FcMakeDirectory (const FcChar8 *dir) { - const FcChar8 *match; - struct stat statb; - FcGlobalCacheInfo *info; - - match = file; - - if (stat ((char *) file, &statb) < 0) + FcChar8 *parent; + FcBool ret; + + if (strlen ((char *) dir) == 0) return FcFalse; - if (S_ISDIR (statb.st_mode)) - info = FcGlobalCacheDirAdd (cache, file, statb.st_mtime, - FcTrue, FcTrue); - else - info = FcGlobalCacheFileAdd (cache, file, id, statb.st_mtime, - name, FcTrue); - if (info) - { - FcGlobalCacheReferenced (cache, info); - cache->updated = FcTrue; - } + + parent = FcStrDirname (dir); + if (!parent) + return FcFalse; + if (access ((char *) parent, W_OK|X_OK) == 0) + ret = mkdir ((char *) dir, 0777) == 0; + else if (access ((char *) parent, F_OK) == -1) + ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0); else - cache->broken = FcTrue; - return info != 0; + ret = FcFalse; + FcStrFree (parent); + return ret; } +/* write serialized state to the cache file */ FcBool -FcGlobalCacheSave (FcGlobalCache *cache, - const FcChar8 *cache_file) +FcDirCacheWrite (FcCache *cache, FcConfig *config) { - FILE *f; - int dir_hash, file_hash; - FcGlobalCacheDir *dir; - FcGlobalCacheFile *file; - FcAtomic *atomic; - - if (!cache->updated && cache->referenced == cache->entries) - return FcTrue; - - if (cache->broken) - return FcFalse; + FcChar8 *dir = FcCacheDir (cache); + FcChar8 cache_base[CACHEBASE_LEN]; + FcChar8 *cache_hashed; + int fd; + FcAtomic *atomic; + FcStrList *list; + FcChar8 *cache_dir = NULL; + FcChar8 *test_dir; + int magic; + int written; -#if defined (HAVE_GETUID) && defined (HAVE_GETEUID) - /* Set-UID programs can't safely update the cache */ - if (getuid () != geteuid ()) - return FcFalse; -#endif + /* + * Write it to the first directory in the list which is writable + */ - atomic = FcAtomicCreate (cache_file); - if (!atomic) - goto bail0; - if (!FcAtomicLock (atomic)) - goto bail1; - f = fopen ((char *) FcAtomicNewFile(atomic), "w"); - if (!f) - goto bail2; - - for (dir_hash = 0; dir_hash < FC_GLOBAL_CACHE_DIR_HASH_SIZE; dir_hash++) - { - for (dir = cache->ents[dir_hash]; dir; dir = dir->next) + list = FcStrListCreate (config->cacheDirs); + if (!list) + return FcFalse; + while ((test_dir = FcStrListNext (list))) { + if (access ((char *) test_dir, W_OK|X_OK) == 0) { - if (!dir->info.referenced) - continue; - if (!FcCacheWriteString (f, dir->info.file)) - goto bail4; - if (PUTC (' ', f) == EOF) - goto bail4; - if (!FcCacheWriteInt (f, 0)) - goto bail4; - if (PUTC (' ', f) == EOF) - goto bail4; - if (!FcCacheWriteTime (f, dir->info.time)) - goto bail4; - if (PUTC (' ', f) == EOF) - goto bail4; - if (!FcCacheWriteString (f, (FcChar8 *) FC_FONT_FILE_DIR)) - goto bail4; - if (PUTC ('\n', f) == EOF) - goto bail4; - - for (file_hash = 0; file_hash < FC_GLOBAL_CACHE_FILE_HASH_SIZE; file_hash++) - { - for (file = dir->ents[file_hash]; file; file = file->next) + cache_dir = test_dir; + break; + } + else + { + /* + * If the directory doesn't exist, try to create it + */ + if (access ((char *) test_dir, F_OK) == -1) { + if (FcMakeDirectory (test_dir)) { - if (!file->info.referenced) - continue; - if (!FcCacheWritePath (f, dir->info.file, file->info.file)) - goto bail4; - if (PUTC (' ', f) == EOF) - goto bail4; - if (!FcCacheWriteInt (f, file->id < 0 ? 0 : file->id)) - goto bail4; - if (PUTC (' ', f) == EOF) - goto bail4; - if (!FcCacheWriteTime (f, file->info.time)) - goto bail4; - if (PUTC (' ', f) == EOF) - goto bail4; - if (!FcCacheWriteString (f, file->name)) - goto bail4; - if (PUTC ('\n', f) == EOF) - goto bail4; + cache_dir = test_dir; + break; } } } } + FcStrListDone (list); + if (!cache_dir) + return FcFalse; + + FcDirCacheBasename (dir, cache_base); + cache_hashed = FcStrPlus (cache_dir, cache_base); + if (!cache_hashed) + return FcFalse; + + if (FcDebug () & FC_DBG_CACHE) + printf ("FcDirCacheWriteDir dir \"%s\" file \"%s\"\n", + dir, cache_hashed); + + atomic = FcAtomicCreate ((FcChar8 *)cache_hashed); + if (!atomic) + goto bail1; - if (fclose (f) == EOF) + if (!FcAtomicLock (atomic)) goto bail3; + + fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY, 0666); + if (fd == -1) + goto bail4; - if (!FcAtomicReplaceOrig (atomic)) - goto bail3; + /* Temporarily switch magic to MMAP while writing to file */ + magic = cache->magic; + if (magic != FC_CACHE_MAGIC_MMAP) + cache->magic = FC_CACHE_MAGIC_MMAP; + + /* + * Write cache contents to file + */ + written = write (fd, cache, cache->size); + + /* Switch magic back */ + if (magic != FC_CACHE_MAGIC_MMAP) + cache->magic = magic; + if (written != cache->size) + { + perror ("write cache"); + goto bail5; + } + + close(fd); + if (!FcAtomicReplaceOrig(atomic)) + goto bail4; + FcStrFree (cache_hashed); FcAtomicUnlock (atomic); FcAtomicDestroy (atomic); - - cache->updated = FcFalse; return FcTrue; -bail4: - fclose (f); -bail3: - FcAtomicDeleteNew (atomic); -bail2: + bail5: + close (fd); + bail4: FcAtomicUnlock (atomic); -bail1: + bail3: FcAtomicDestroy (atomic); -bail0: + bail1: + FcStrFree (cache_hashed); return FcFalse; } -FcBool -FcDirCacheValid (const FcChar8 *dir) +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +#ifndef HIGHFIRST +#define byteReverse(buf, len) /* Nothing */ +#else +/* + * Note: this code is harmless on little-endian machines. + */ +void byteReverse(unsigned char *buf, unsigned longs) { - FcChar8 *cache_file = FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE); - struct stat file_stat, dir_stat; + FcChar32 t; + do { + t = (FcChar32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(FcChar32 *) buf = t; + buf += 4; + } while (--longs); +} +#endif - if (stat ((char *) dir, &dir_stat) < 0) - { - FcStrFree (cache_file); - return FcFalse; - } - if (stat ((char *) cache_file, &file_stat) < 0) - { - FcStrFree (cache_file); - return FcFalse; - } - FcStrFree (cache_file); - /* - * If the directory has been modified more recently than - * the cache file, the cache is not valid - */ - if (dir_stat.st_mtime - file_stat.st_mtime > 0) - return FcFalse; - return FcTrue; +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +static void MD5Init(struct MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; } -FcBool -FcDirCacheReadDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir, FcConfig *config) +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +static void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len) { - FcChar8 *cache_file = FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE); - FILE *f; - FcChar8 *base; - int id; - int dir_len; - FcChar8 file_buf[8192], *file; - FcChar8 name_buf[8192], *name; - FcBool ret = FcFalse; - - if (!cache_file) - goto bail0; - - if (FcDebug () & FC_DBG_CACHE) - printf ("FcDirCacheReadDir cache_file \"%s\"\n", cache_file); - - f = fopen ((char *) cache_file, "r"); - if (!f) - { - if (FcDebug () & FC_DBG_CACHE) - printf (" no cache file\n"); - goto bail1; - } + FcChar32 t; - if (!FcDirCacheValid (dir)) - { - if (FcDebug () & FC_DBG_CACHE) - printf (" cache file older than directory\n"); - goto bail2; + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((FcChar32) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + unsigned char *p = (unsigned char *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (FcChar32 *) ctx->in); + buf += t; + len -= t; } - - base = (FcChar8 *) strrchr ((char *) cache_file, '/'); - if (!base) - goto bail2; - base++; - dir_len = base - cache_file; - - file = 0; - name = 0; - while ((file = FcCacheReadString (f, file_buf, sizeof (file_buf))) && - FcCacheReadInt (f, &id) && - (name = FcCacheReadString (f, name_buf, sizeof (name_buf)))) - { - if (!FcCacheFontSetAdd (set, dirs, cache_file, dir_len, - file, name, config)) - goto bail3; - if (file != file_buf) - free (file); - if (name != name_buf) - free (name); - file = name = 0; + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (FcChar32 *) ctx->in); + buf += 64; + len -= 64; } - if (FcDebug () & FC_DBG_CACHE) - printf (" cache loaded\n"); - - ret = FcTrue; -bail3: - if (file && file != file_buf) - free (file); - if (name && name != name_buf) - free (name); -bail2: - fclose (f); -bail1: - FcStrFree (cache_file); -bail0: - return ret; + + /* Handle any remaining bytes of data. */ + + memcpy(ctx->in, buf, len); } /* - * return the path from the directory containing 'cache' to 'file' + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) */ - -static const FcChar8 * -FcFileBaseName (const FcChar8 *cache, const FcChar8 *file) +static void MD5Final(unsigned char digest[16], struct MD5Context *ctx) { - const FcChar8 *cache_slash; - - cache_slash = FcStrLastSlash (cache); - if (cache_slash && !strncmp ((const char *) cache, (const char *) file, - (cache_slash + 1) - cache)) - return file + ((cache_slash + 1) - cache); - return file; + unsigned count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (FcChar32 *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((FcChar32 *) ctx->in)[14] = ctx->bits[0]; + ((FcChar32 *) ctx->in)[15] = ctx->bits[1]; + + MD5Transform(ctx->buf, (FcChar32 *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } -FcBool -FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) -{ - FcChar8 *cache_file = FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE); - FcPattern *font; - FILE *f; - FcChar8 *name; - const FcChar8 *file, *base; - int n; - int id; - FcBool ret; - FcStrList *list; - if (!cache_file) - goto bail0; - if (FcDebug () & FC_DBG_CACHE) - printf ("FcDirCacheWriteDir cache_file \"%s\"\n", cache_file); - - f = fopen ((char *) cache_file, "w"); - if (!f) - { - if (FcDebug () & FC_DBG_CACHE) - printf (" can't create \"%s\"\n", cache_file); - goto bail1; - } - - list = FcStrListCreate (dirs); - if (!list) - goto bail2; - - while ((dir = FcStrListNext (list))) - { - base = FcFileBaseName (cache_file, dir); - if (!FcCacheWriteString (f, base)) - goto bail3; - if (PUTC (' ', f) == EOF) - goto bail3; - if (!FcCacheWriteInt (f, 0)) - goto bail3; - if (PUTC (' ', f) == EOF) - goto bail3; - if (!FcCacheWriteString (f, FC_FONT_FILE_DIR)) - goto bail3; - if (PUTC ('\n', f) == EOF) - goto bail3; - } - - for (n = 0; n < set->nfont; n++) - { - font = set->fonts[n]; - if (FcPatternGetString (font, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) - goto bail3; - base = FcFileBaseName (cache_file, file); - if (FcPatternGetInteger (font, FC_INDEX, 0, &id) != FcResultMatch) - goto bail3; - if (FcDebug () & FC_DBG_CACHEV) - printf (" write file \"%s\"\n", base); - if (!FcCacheWriteString (f, base)) - goto bail3; - if (PUTC (' ', f) == EOF) - goto bail3; - if (!FcCacheWriteInt (f, id)) - goto bail3; - if (PUTC (' ', f) == EOF) - goto bail3; - name = FcNameUnparse (font); - if (!name) - goto bail3; - ret = FcCacheWriteString (f, name); - FcStrFree (name); - if (!ret) - goto bail3; - if (PUTC ('\n', f) == EOF) - goto bail3; - } - - FcStrListDone (list); +/* The four core functions - F1 is optimized somewhat */ - if (fclose (f) == EOF) - goto bail1; - - FcStrFree (cache_file); +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) - if (FcDebug () & FC_DBG_CACHE) - printf (" cache written\n"); - return FcTrue; - -bail3: - FcStrListDone (list); -bail2: - fclose (f); -bail1: - unlink ((char *) cache_file); - FcStrFree (cache_file); -bail0: - return FcFalse; +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +static void MD5Transform(FcChar32 buf[4], FcChar32 in[16]) +{ + register FcChar32 a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; } diff --git a/src/fccfg.c b/src/fccfg.c index 59137ca..2f0d311 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -23,6 +23,8 @@ */ #include "fcint.h" +#include +#include #if defined (_WIN32) && (defined (PIC) || defined (DLL_EXPORT)) #define STRICT @@ -75,44 +77,21 @@ FcConfigCreate (void) if (!config->rejectPatterns) goto bail7; - config->cache = 0; - if (FcConfigHome()) - if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE))) - goto bail8; - -#ifdef _WIN32 - if (config->cache == 0) - { - /* If no home, use the temp folder. */ - FcChar8 dummy[1]; - int templen = GetTempPath (1, dummy); - FcChar8 *temp = malloc (templen + 1); - - if (temp) - { - FcChar8 *cache_dir; - - GetTempPath (templen + 1, temp); - cache_dir = FcStrPlus (temp, FC_USER_CACHE_FILE); - free (temp); - if (!FcConfigSetCache (config, cache_dir)) - { - FcStrFree (cache_dir); - goto bail6; - } - FcStrFree (cache_dir); - } - } -#endif - + config->cacheDirs = FcStrSetCreate (); + if (!config->cacheDirs) + goto bail8; + config->blanks = 0; config->substPattern = 0; config->substFont = 0; + config->substScan = 0; config->maxObjects = 0; for (set = FcSetSystem; set <= FcSetApplication; set++) config->fonts[set] = 0; + config->caches = NULL; + config->rescanTime = time(0); config->rescanInterval = 30; @@ -139,11 +118,6 @@ bail0: return 0; } -typedef struct _FcFileTime { - time_t time; - FcBool set; -} FcFileTime; - static FcFileTime FcConfigNewestFile (FcStrSet *files) { @@ -166,6 +140,19 @@ FcConfigNewestFile (FcStrSet *files) return newest; } +FcFileTime +FcConfigModifiedTime (FcConfig *config) +{ + if (!config) + { + FcFileTime v = { 0, FcFalse }; + config = FcConfigGetCurrent (); + if (!config) + return v; + } + return FcConfigNewestFile (config->configFiles); +} + FcBool FcConfigUptoDate (FcConfig *config) { @@ -210,12 +197,14 @@ void FcConfigDestroy (FcConfig *config) { FcSetName set; + FcCacheList *cl, *cl_next; if (config == _fcConfig) _fcConfig = 0; FcStrSetDestroy (config->configDirs); FcStrSetDestroy (config->fontDirs); + FcStrSetDestroy (config->cacheDirs); FcStrSetDestroy (config->configFiles); FcStrSetDestroy (config->acceptGlobs); FcStrSetDestroy (config->rejectGlobs); @@ -225,71 +214,139 @@ FcConfigDestroy (FcConfig *config) if (config->blanks) FcBlanksDestroy (config->blanks); - if (config->cache) - FcStrFree (config->cache); - FcSubstDestroy (config->substPattern); FcSubstDestroy (config->substFont); + FcSubstDestroy (config->substScan); for (set = FcSetSystem; set <= FcSetApplication; set++) if (config->fonts[set]) FcFontSetDestroy (config->fonts[set]); + for (cl = config->caches; cl; cl = cl_next) + { + cl_next = cl->next; + FcDirCacheUnload (cl->cache); + free (cl); + } + free (config); FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig)); } +/* + * Add cache to configuration, adding fonts and directories + */ + +FcBool +FcConfigAddCache (FcConfig *config, FcCache *cache) +{ + FcCacheList *cl = malloc (sizeof (FcCacheList)); + FcFontSet *fs; + intptr_t *dirs; + int i; + + /* + * Add to cache list + */ + if (!cl) + return FcFalse; + cl->cache = cache; + cl->next = config->caches; + config->caches = cl; + + /* + * Add fonts + */ + fs = FcCacheSet (cache); + if (fs) + { + for (i = 0; i < fs->nfont; i++) + { + FcPattern *font = FcFontSetFont (fs, i); + FcChar8 *font_file; + + /* + * Check to see if font is banned by filename + */ + if (FcPatternObjectGetString (font, FC_FILE_OBJECT, + 0, &font_file) == FcResultMatch && + !FcConfigAcceptFilename (config, font_file)) + { + continue; + } + + /* + * Check to see if font is banned by pattern + */ + if (!FcConfigAcceptFont (config, font)) + continue; + + FcFontSetAdd (config->fonts[FcSetSystem], font); + } + } + + /* + * Add directories + */ + dirs = FcCacheDirs (cache); + if (dirs) + { + for (i = 0; i < cache->dirs_count; i++) + { + FcChar8 *dir = FcOffsetToPtr (dirs, dirs[i], FcChar8); + if (FcConfigAcceptFilename (config, dir)) + FcConfigAddFontDir (config, dir); + } + } + return FcTrue; +} + /* * Scan the current list of directories in the configuration - * and build the set of available fonts. Update the - * per-user cache file to reflect the new configuration + * and build the set of available fonts. */ FcBool FcConfigBuildFonts (FcConfig *config) { FcFontSet *fonts; - FcGlobalCache *cache; - FcStrList *list; + FcStrList *dirlist; FcChar8 *dir; + FcCache *cache; + if (!config) + { + config = FcConfigGetCurrent (); + if (!config) + return FcFalse; + } + fonts = FcFontSetCreate (); if (!fonts) - goto bail0; + goto bail; - cache = FcGlobalCacheCreate (); - if (!cache) - goto bail1; - - if (config->cache) - FcGlobalCacheLoad (cache, config->cache); - - list = FcConfigGetFontDirs (config); - if (!list) - goto bail1; - - while ((dir = FcStrListNext (list))) + FcConfigSetFonts (config, fonts, FcSetSystem); + + dirlist = FcStrListCreate (config->fontDirs); + if (!dirlist) + goto bail; + + while ((dir = FcStrListNext (dirlist))) { if (FcDebug () & FC_DBG_FONTSET) - printf ("scan dir %s\n", dir); - FcDirScanConfig (fonts, config->fontDirs, cache, - config->blanks, dir, FcFalse, config); + printf ("adding fonts from%s\n", dir); + cache = FcDirCacheRead (dir, FcFalse, config); + if (!cache) + continue; + FcConfigAddCache (config, cache); } - FcStrListDone (list); + FcStrListDone (dirlist); if (FcDebug () & FC_DBG_FONTSET) FcFontSetPrint (fonts); - if (config->cache) - FcGlobalCacheSave (cache, config->cache); - FcGlobalCacheDestroy (cache); - - FcConfigSetFonts (config, fonts, FcSetSystem); - return FcTrue; -bail1: - FcFontSetDestroy (fonts); -bail0: +bail: return FcFalse; } @@ -361,6 +418,25 @@ FcConfigGetFontDirs (FcConfig *config) return FcStrListCreate (config->fontDirs); } +FcBool +FcConfigAddCacheDir (FcConfig *config, + const FcChar8 *d) +{ + return FcStrSetAddFilename (config->cacheDirs, d); +} + +FcStrList * +FcConfigGetCacheDirs (FcConfig *config) +{ + if (!config) + { + config = FcConfigGetCurrent (); + if (!config) + return 0; + } + return FcStrListCreate (config->cacheDirs); +} + FcBool FcConfigAddConfigFile (FcConfig *config, const FcChar8 *f) @@ -388,30 +464,10 @@ FcConfigGetConfigFiles (FcConfig *config) return FcStrListCreate (config->configFiles); } -FcBool -FcConfigSetCache (FcConfig *config, - const FcChar8 *c) -{ - FcChar8 *new = FcStrCopyFilename (c); - - if (!new) - return FcFalse; - if (config->cache) - FcStrFree (config->cache); - config->cache = new; - return FcTrue; -} - FcChar8 * FcConfigGetCache (FcConfig *config) { - if (!config) - { - config = FcConfigGetCurrent (); - if (!config) - return 0; - } - return config->cache; + return NULL; } FcFontSet * @@ -437,8 +493,6 @@ FcConfigSetFonts (FcConfig *config, config->fonts[set] = fonts; } - - FcBlanks * FcConfigGetBlanks (FcConfig *config) { @@ -455,17 +509,21 @@ FcBool FcConfigAddBlank (FcConfig *config, FcChar32 blank) { - FcBlanks *b; + FcBlanks *b, *freeme = 0; b = config->blanks; if (!b) { - b = FcBlanksCreate (); + freeme = b = FcBlanksCreate (); if (!b) return FcFalse; } if (!FcBlanksAdd (b, blank)) + { + if (freeme) + FcBlanksDestroy (freeme); return FcFalse; + } config->blanks = b; return FcTrue; } @@ -505,14 +563,23 @@ FcConfigAddEdit (FcConfig *config, FcTest *t; int num; + switch (kind) { + case FcMatchPattern: + prev = &config->substPattern; + break; + case FcMatchFont: + prev = &config->substFont; + break; + case FcMatchScan: + prev = &config->substScan; + break; + default: + return FcFalse; + } subst = (FcSubst *) malloc (sizeof (FcSubst)); if (!subst) return FcFalse; FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst)); - if (kind == FcMatchPattern) - prev = &config->substPattern; - else - prev = &config->substFont; for (; *prev; prev = &(*prev)->next); *prev = subst; subst->next = 0; @@ -562,12 +629,12 @@ FcConfigPromote (FcValue v, FcValue u) } FcBool -FcConfigCompareValue (const FcValue left_o, +FcConfigCompareValue (const FcValue *left_o, FcOp op, - const FcValue right_o) + const FcValue *right_o) { - FcValue left = left_o; - FcValue right = right_o; + FcValue left = FcValueCanonicalize(left_o); + FcValue right = FcValueCanonicalize(right_o); FcBool ret = FcFalse; left = FcConfigPromote (left, right); @@ -632,7 +699,7 @@ FcConfigCompareValue (const FcValue left_o, ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) != 0; break; case FcOpNotContains: - ret = FcStrStrIgnoreCase (left.u.s, right.u.s) == 0; + ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) == 0; break; default: break; @@ -743,6 +810,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) FcValue v, vl, vr; FcResult r; FcMatrix *m; + FcChar8 *str; switch (e->op) { case FcOpInteger: @@ -755,8 +823,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) break; case FcOpString: v.type = FcTypeString; - v.u.s = e->u.sval; - v = FcValueSave (v); + v.u.s = FcStrStaticName(e->u.sval); break; case FcOpMatrix: v.type = FcTypeMatrix; @@ -773,9 +840,10 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) v.u.b = e->u.bval; break; case FcOpField: - r = FcPatternGet (p, e->u.field, 0, &v); + r = FcPatternObjectGet (p, e->u.object, 0, &v); if (r != FcResultMatch) v.type = FcTypeVoid; + v = FcValueSave (v); break; case FcOpConst: if (FcNameConstant (e->u.constant, &v.u.i)) @@ -808,7 +876,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) vl = FcConfigEvaluate (p, e->u.tree.left); vr = FcConfigEvaluate (p, e->u.tree.right); v.type = FcTypeBool; - v.u.b = FcConfigCompareValue (vl, e->op, vr); + v.u.b = FcConfigCompareValue (&vl, e->op, &vr); FcValueDestroy (vl); FcValueDestroy (vr); break; @@ -873,7 +941,10 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) switch (e->op) { case FcOpPlus: v.type = FcTypeString; - v.u.s = FcStrPlus (vl.u.s, vr.u.s); + str = FcStrPlus (vl.u.s, vr.u.s); + v.u.s = FcStrStaticName (str); + FcStrFree (str); + if (!v.u.s) v.type = FcTypeVoid; break; @@ -1021,10 +1092,10 @@ FcConfigMatchValueList (FcPattern *p, e = 0; } - for (v = values; v; v = v->next) + for (v = values; v; v = FcValueListNext(v)) { /* Compare the pattern value to the match expression value */ - if (FcConfigCompareValue (v->value, t->op, value)) + if (FcConfigCompareValue (&v->value, t->op, &value)) { if (!ret) ret = v; @@ -1057,39 +1128,40 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding) if (e->op == FcOpComma) { l->value = FcConfigEvaluate (p, e->u.tree.left); - l->next = FcConfigValues (p, e->u.tree.right, binding); + l->next = FcConfigValues (p, e->u.tree.right, binding); } else { l->value = FcConfigEvaluate (p, e); - l->next = 0; + l->next = NULL; } l->binding = binding; - while (l && l->value.type == FcTypeVoid) + if (l->value.type == FcTypeVoid) { - FcValueList *next = l->next; - + FcValueList *next = FcValueListNext(l); + FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList)); free (l); l = next; } + return l; } static FcBool -FcConfigAdd (FcValueList **head, +FcConfigAdd (FcValueListPtr *head, FcValueList *position, FcBool append, FcValueList *new) { - FcValueList **prev, *last, *v; + FcValueListPtr *prev, last, v; FcValueBinding sameBinding; if (position) sameBinding = position->binding; else sameBinding = FcValueBindingWeak; - for (v = new; v; v = v->next) + for (v = new; v != NULL; v = FcValueListNext(v)) if (v->binding == FcValueBindingSame) v->binding = sameBinding; if (append) @@ -1097,14 +1169,16 @@ FcConfigAdd (FcValueList **head, if (position) prev = &position->next; else - for (prev = head; *prev; prev = &(*prev)->next) + for (prev = head; *prev != NULL; + prev = &(*prev)->next) ; } else { if (position) { - for (prev = head; *prev; prev = &(*prev)->next) + for (prev = head; *prev != NULL; + prev = &(*prev)->next) { if (*prev == position) break; @@ -1115,7 +1189,7 @@ FcConfigAdd (FcValueList **head, if (FcDebug () & FC_DBG_EDIT) { - if (!*prev) + if (*prev == NULL) printf ("position not on list\n"); } } @@ -1130,7 +1204,7 @@ FcConfigAdd (FcValueList **head, if (new) { last = new; - while (last->next) + while (last->next != NULL) last = last->next; last->next = *prev; @@ -1148,17 +1222,17 @@ FcConfigAdd (FcValueList **head, } static void -FcConfigDel (FcValueList **head, +FcConfigDel (FcValueListPtr *head, FcValueList *position) { - FcValueList **prev; + FcValueListPtr *prev; - for (prev = head; *prev; prev = &(*prev)->next) + for (prev = head; *prev != NULL; prev = &(*prev)->next) { if (*prev == position) { *prev = position->next; - position->next = 0; + position->next = NULL; FcValueListDestroy (position); break; } @@ -1167,13 +1241,13 @@ FcConfigDel (FcValueList **head, static void FcConfigPatternAdd (FcPattern *p, - const char *object, + FcObject object, FcValueList *list, FcBool append) { if (list) { - FcPatternElt *e = FcPatternInsertElt (p, object); + FcPatternElt *e = FcPatternObjectInsertElt (p, object); if (!e) return; @@ -1186,24 +1260,24 @@ FcConfigPatternAdd (FcPattern *p, */ static void FcConfigPatternDel (FcPattern *p, - const char *object) + FcObject object) { - FcPatternElt *e = FcPatternFindElt (p, object); + FcPatternElt *e = FcPatternObjectFindElt (p, object); if (!e) return; - while (e->values) + while (e->values != NULL) FcConfigDel (&e->values, e->values); } static void FcConfigPatternCanon (FcPattern *p, - const char *object) + FcObject object) { - FcPatternElt *e = FcPatternFindElt (p, object); + FcPatternElt *e = FcPatternObjectFindElt (p, object); if (!e) return; - if (!e->values) - FcPatternDel (p, object); + if (e->values == NULL) + FcPatternObjectDel (p, object); } FcBool @@ -1227,6 +1301,20 @@ FcConfigSubstituteWithPat (FcConfig *config, return FcFalse; } + switch (kind) { + case FcMatchPattern: + s = config->substPattern; + break; + case FcMatchFont: + s = config->substFont; + break; + case FcMatchScan: + s = config->substScan; + break; + default: + return FcFalse; + } + st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState)); if (!st && config->maxObjects) return FcFalse; @@ -1237,10 +1325,6 @@ FcConfigSubstituteWithPat (FcConfig *config, printf ("FcConfigSubstitute "); FcPatternPrint (p); } - if (kind == FcMatchPattern) - s = config->substPattern; - else - s = config->substFont; for (; s; s = s->next) { /* @@ -1260,7 +1344,7 @@ FcConfigSubstituteWithPat (FcConfig *config, else m = p; if (m) - st[i].elt = FcPatternFindElt (m, t->field); + st[i].elt = FcPatternObjectFindElt (m, t->object); else st[i].elt = 0; /* @@ -1314,8 +1398,7 @@ FcConfigSubstituteWithPat (FcConfig *config, for (t = s->test, i = 0; t; t = t->next, i++) { if ((t->kind == FcMatchFont || kind == FcMatchPattern) && - !FcStrCmpIgnoreCase ((FcChar8 *) t->field, - (FcChar8 *) e->field)) + t->object == e->object) { /* * KLUDGE - the pattern may have been reallocated or @@ -1324,7 +1407,7 @@ FcConfigSubstituteWithPat (FcConfig *config, * the element again */ if (e != s->edit && st[i].elt) - st[i].elt = FcPatternFindElt (p, t->field); + st[i].elt = FcPatternObjectFindElt (p, t->object); if (!st[i].elt) t = 0; break; @@ -1339,7 +1422,7 @@ FcConfigSubstituteWithPat (FcConfig *config, if (t) { FcValueList *thisValue = st[i].value; - FcValueList *nextValue = thisValue ? thisValue->next : 0; + FcValueList *nextValue = thisValue; /* * Append the new list of values after the current value @@ -1348,7 +1431,8 @@ FcConfigSubstituteWithPat (FcConfig *config, /* * Delete the marked value */ - FcConfigDel (&st[i].elt->values, thisValue); + if (thisValue) + FcConfigDel (&st[i].elt->values, thisValue); /* * Adjust any pointers into the value list to ensure * future edits occur at the same place @@ -1366,8 +1450,8 @@ FcConfigSubstituteWithPat (FcConfig *config, * Delete all of the values and insert * the new set */ - FcConfigPatternDel (p, e->field); - FcConfigPatternAdd (p, e->field, l, FcTrue); + FcConfigPatternDel (p, e->object); + FcConfigPatternAdd (p, e->object, l, FcTrue); /* * Adjust any pointers into the value list as they no * longer point to anything valid @@ -1390,7 +1474,7 @@ FcConfigSubstituteWithPat (FcConfig *config, } /* fall through ... */ case FcOpPrependFirst: - FcConfigPatternAdd (p, e->field, l, FcFalse); + FcConfigPatternAdd (p, e->object, l, FcFalse); break; case FcOpAppend: if (t) @@ -1400,9 +1484,10 @@ FcConfigSubstituteWithPat (FcConfig *config, } /* fall through ... */ case FcOpAppendLast: - FcConfigPatternAdd (p, e->field, l, FcTrue); + FcConfigPatternAdd (p, e->object, l, FcTrue); break; default: + FcValueListDestroy (l); break; } } @@ -1411,7 +1496,7 @@ FcConfigSubstituteWithPat (FcConfig *config, * any properties without data */ for (e = s->edit; e; e = e->next) - FcConfigPatternCanon (p, e->field); + FcConfigPatternCanon (p, e->object); if (FcDebug () & FC_DBG_EDIT) { @@ -1707,7 +1792,7 @@ FcConfigAppFontAddFile (FcConfig *config, FcConfigSetFonts (config, set, FcSetApplication); } - if (!FcFileScanConfig (set, subdirs, 0, config->blanks, file, FcFalse, config)) + if (!FcFileScanConfig (set, subdirs, config->blanks, file, config)) { FcStrSetDestroy (subdirs); return FcFalse; @@ -1720,6 +1805,7 @@ FcConfigAppFontAddFile (FcConfig *config, } FcStrListDone (sublist); } + FcStrSetDestroy (subdirs); return FcTrue; } @@ -1754,7 +1840,7 @@ FcConfigAppFontAddDir (FcConfig *config, FcConfigSetFonts (config, set, FcSetApplication); } - if (!FcDirScanConfig (set, subdirs, 0, config->blanks, dir, FcFalse, config)) + if (!FcDirScanConfig (set, subdirs, config->blanks, dir, FcFalse, config)) { FcStrSetDestroy (subdirs); return FcFalse; @@ -1767,6 +1853,7 @@ FcConfigAppFontAddDir (FcConfig *config, } FcStrListDone (sublist); } + FcStrSetDestroy (subdirs); return FcTrue; } diff --git a/src/fccharset.c b/src/fccharset.c index 8003bcc..3dac4ce 100644 --- a/src/fccharset.c +++ b/src/fccharset.c @@ -22,13 +22,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include #include "fcint.h" +#include /* #define CHECK */ -/* #define CHATTY */ - FcCharSet * FcCharSetCreate (void) { @@ -40,8 +38,8 @@ FcCharSetCreate (void) FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharSet)); fcs->ref = 1; fcs->num = 0; - fcs->leaves = 0; - fcs->numbers = 0; + fcs->leaves_offset = 0; + fcs->numbers_offset = 0; return fcs; } @@ -54,11 +52,11 @@ FcCharSetNew (void) return FcCharSetCreate (); } - void FcCharSetDestroy (FcCharSet *fcs) { int i; + if (fcs->ref == FC_REF_CONSTANT) return; if (--fcs->ref > 0) @@ -66,17 +64,17 @@ FcCharSetDestroy (FcCharSet *fcs) for (i = 0; i < fcs->num; i++) { FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf)); - free (fcs->leaves[i]); + free (FcCharSetLeaf (fcs, i)); } - if (fcs->leaves) + if (fcs->num) { - FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcCharLeaf *)); - free (fcs->leaves); + FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (intptr_t)); + free (FcCharSetLeaves (fcs)); } - if (fcs->numbers) + if (fcs->num) { FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16)); - free (fcs->numbers); + free (FcCharSetNumbers (fcs)); } FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); free (fcs); @@ -91,7 +89,7 @@ FcCharSetDestroy (FcCharSet *fcs) static int FcCharSetFindLeafPos (const FcCharSet *fcs, FcChar32 ucs4) { - FcChar16 *numbers = fcs->numbers; + FcChar16 *numbers = FcCharSetNumbers(fcs); FcChar16 page; int low = 0; int high = fcs->num - 1; @@ -120,7 +118,7 @@ FcCharSetFindLeaf (const FcCharSet *fcs, FcChar32 ucs4) { int pos = FcCharSetFindLeafPos (fcs, ucs4); if (pos >= 0) - return fcs->leaves[pos]; + return FcCharSetLeaf(fcs, pos); return 0; } @@ -130,39 +128,55 @@ FcCharSetPutLeaf (FcCharSet *fcs, FcCharLeaf *leaf, int pos) { - FcCharLeaf **leaves; - FcChar16 *numbers; + intptr_t *leaves = FcCharSetLeaves (fcs); + FcChar16 *numbers = FcCharSetNumbers (fcs); ucs4 >>= 8; if (ucs4 >= 0x10000) return FcFalse; - if (!fcs->leaves) - leaves = malloc (sizeof (FcCharLeaf *)); + if (!fcs->num) + leaves = malloc (sizeof (*leaves)); else - leaves = realloc (fcs->leaves, (fcs->num + 1) * sizeof (FcCharLeaf *)); + { + intptr_t *new_leaves = realloc (leaves, (fcs->num + 1) * + sizeof (*leaves)); + intptr_t distance = (intptr_t) new_leaves - (intptr_t) leaves; + + if (new_leaves && distance) + { + int i; + + for (i = 0; i < fcs->num; i++) + new_leaves[i] -= distance; + } + leaves = new_leaves; + } if (!leaves) return FcFalse; + if (fcs->num) - FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcCharLeaf *)); - FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *)); - fcs->leaves = leaves; - if (!fcs->numbers) + FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (intptr_t)); + FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (intptr_t)); + fcs->leaves_offset = FcPtrToOffset (fcs, leaves); + + if (!fcs->num) numbers = malloc (sizeof (FcChar16)); else - numbers = realloc (fcs->numbers, (fcs->num + 1) * sizeof (FcChar16)); + numbers = realloc (numbers, (fcs->num + 1) * sizeof (FcChar16)); if (!numbers) return FcFalse; + if (fcs->num) FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16)); FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16)); - fcs->numbers = numbers; + fcs->numbers_offset = FcPtrToOffset (fcs, numbers); - memmove (fcs->leaves + pos + 1, fcs->leaves + pos, - (fcs->num - pos) * sizeof (FcCharLeaf *)); - memmove (fcs->numbers + pos + 1, fcs->numbers + pos, - (fcs->num - pos) * sizeof (FcChar16)); - fcs->numbers[pos] = (FcChar16) ucs4; - fcs->leaves[pos] = leaf; + memmove (leaves + pos + 1, leaves + pos, + (fcs->num - pos) * sizeof (*leaves)); + memmove (numbers + pos + 1, numbers + pos, + (fcs->num - pos) * sizeof (*numbers)); + numbers[pos] = (FcChar16) ucs4; + leaves[pos] = FcPtrToOffset (leaves, leaf); fcs->num++; return FcTrue; } @@ -180,7 +194,7 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4) pos = FcCharSetFindLeafPos (fcs, ucs4); if (pos >= 0) - return fcs->leaves[pos]; + return FcCharSetLeaf(fcs, pos); leaf = calloc (1, sizeof (FcCharLeaf)); if (!leaf) @@ -205,8 +219,9 @@ FcCharSetInsertLeaf (FcCharSet *fcs, FcChar32 ucs4, FcCharLeaf *leaf) if (pos >= 0) { FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf)); - free (fcs->leaves[pos]); - fcs->leaves[pos] = leaf; + free (FcCharSetLeaf (fcs, pos)); + FcCharSetLeaves(fcs)[pos] = FcPtrToOffset (FcCharSetLeaves(fcs), + leaf); return FcTrue; } pos = -pos - 1; @@ -257,13 +272,10 @@ FcCharSetIterSet (const FcCharSet *fcs, FcCharSetIter *iter) iter->leaf = 0; return; } - iter->ucs4 = (FcChar32) fcs->numbers[pos] << 8; + iter->ucs4 = (FcChar32) FcCharSetNumbers(fcs)[pos] << 8; } - iter->leaf = fcs->leaves[pos]; + iter->leaf = FcCharSetLeaf(fcs, pos); iter->pos = pos; -#ifdef CHATTY - printf ("set %08x: %08x\n", iter->ucs4, (FcChar32) iter->leaf); -#endif } static void @@ -277,36 +289,18 @@ FcCharSetIterNext (const FcCharSet *fcs, FcCharSetIter *iter) } else { - iter->ucs4 = (FcChar32) fcs->numbers[pos] << 8; - iter->leaf = fcs->leaves[pos]; + iter->ucs4 = (FcChar32) FcCharSetNumbers(fcs)[pos] << 8; + iter->leaf = FcCharSetLeaf(fcs, pos); iter->pos = pos; } } -#ifdef CHATTY -static void -FcCharSetDump (const FcCharSet *fcs) -{ - int pos; - - printf ("fcs %08x:\n", (FcChar32) fcs); - for (pos = 0; pos < fcs->num; pos++) - { - FcCharLeaf *leaf = fcs->leaves[pos]; - FcChar32 ucs4 = (FcChar32) fcs->numbers[pos] << 8; - - printf (" %08x: %08x\n", ucs4, (FcChar32) leaf); - } -} -#endif static void FcCharSetIterStart (const FcCharSet *fcs, FcCharSetIter *iter) { -#ifdef CHATTY - FcCharSetDump (fcs); -#endif iter->ucs4 = 0; + iter->pos = 0; FcCharSetIterSet (fcs, iter); } @@ -560,7 +554,7 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b) int i = 256/32; if (ai.ucs4 == bi.ucs4) { - FcChar32 *bm = bi.leaf->map;; + FcChar32 *bm = bi.leaf->map; while (i--) count += FcCharSetPopCount (*am++ & ~*bm++); } @@ -594,15 +588,15 @@ FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b) ai = 0; while (ai < a->num && bi < b->num) { - an = a->numbers[ai]; - bn = b->numbers[bi]; + an = FcCharSetNumbers(a)[ai]; + bn = FcCharSetNumbers(b)[bi]; /* * Check matching pages */ if (an == bn) { - FcChar32 *am = a->leaves[ai]->map; - FcChar32 *bm = b->leaves[bi]->map; + FcChar32 *am = FcCharSetLeaf(a, ai)->map; + FcChar32 *bm = FcCharSetLeaf(b, bi)->map; if (am != bm) { @@ -633,7 +627,7 @@ FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b) while (low <= high) { int mid = (low + high) >> 1; - bn = b->numbers[mid]; + bn = FcCharSetNumbers(b)[mid]; if (bn == an) { high = mid; @@ -645,7 +639,7 @@ FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b) high = mid - 1; } bi = high; - while (bi < b->num && b->numbers[bi] < an) + while (bi < b->num && FcCharSetNumbers(b)[bi] < an) bi++; } } @@ -836,6 +830,133 @@ FcCharSetUnparseValue (FcStrBuf *buf, FcChar32 value) return FcTrue; } +FcCharSet * +FcNameParseCharSet (FcChar8 *string) +{ + FcCharSet *c; + FcChar32 ucs4; + FcCharLeaf *leaf; + FcCharLeaf temp; + FcChar32 bits; + int i; + + c = FcCharSetCreate (); + if (!c) + goto bail0; + while (*string) + { + string = FcCharSetParseValue (string, &ucs4); + if (!string) + goto bail1; + bits = 0; + for (i = 0; i < 256/32; i++) + { + string = FcCharSetParseValue (string, &temp.map[i]); + if (!string) + goto bail1; + bits |= temp.map[i]; + } + if (bits) + { + leaf = malloc (sizeof (FcCharLeaf)); + if (!leaf) + goto bail1; + *leaf = temp; + if (!FcCharSetInsertLeaf (c, ucs4, leaf)) + goto bail1; + } + } + return c; +bail1: + if (c->num) + { + FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcCharLeaf *)); + free (FcCharSetLeaves (c)); + } + if (c->num) + { + FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcChar16)); + free (FcCharSetNumbers (c)); + } + FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); + free (c); +bail0: + return NULL; +} + +FcBool +FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c) +{ + FcCharSetIter ci; + int i; +#ifdef CHECK + int len = buf->len; +#endif + + for (FcCharSetIterStart (c, &ci); + ci.leaf; + FcCharSetIterNext (c, &ci)) + { + if (!FcCharSetUnparseValue (buf, ci.ucs4)) + return FcFalse; + for (i = 0; i < 256/32; i++) + if (!FcCharSetUnparseValue (buf, ci.leaf->map[i])) + return FcFalse; + } +#ifdef CHECK + { + FcCharSet *check; + FcChar32 missing; + FcCharSetIter ci, checki; + + /* null terminate for parser */ + FcStrBufChar (buf, '\0'); + /* step back over null for life after test */ + buf->len--; + check = FcNameParseCharSet (buf->buf + len); + FcCharSetIterStart (c, &ci); + FcCharSetIterStart (check, &checki); + while (ci.leaf || checki.leaf) + { + if (ci.ucs4 < checki.ucs4) + { + printf ("Missing leaf node at 0x%x\n", ci.ucs4); + FcCharSetIterNext (c, &ci); + } + else if (checki.ucs4 < ci.ucs4) + { + printf ("Extra leaf node at 0x%x\n", checki.ucs4); + FcCharSetIterNext (check, &checki); + } + else + { + int i = 256/32; + FcChar32 *cm = ci.leaf->map; + FcChar32 *checkm = checki.leaf->map; + + for (i = 0; i < 256; i += 32) + { + if (*cm != *checkm) + printf ("Mismatching sets at 0x%08x: 0x%08x != 0x%08x\n", + ci.ucs4 + i, *cm, *checkm); + cm++; + checkm++; + } + FcCharSetIterNext (c, &ci); + FcCharSetIterNext (check, &checki); + } + } + if ((missing = FcCharSetSubtractCount (c, check))) + printf ("%d missing in reparsed result\n", missing); + if ((missing = FcCharSetSubtractCount (check, c))) + printf ("%d extra in reparsed result\n", missing); + FcCharSetDestroy (check); + } +#endif + + return FcTrue; +} + typedef struct _FcCharLeafEnt FcCharLeafEnt; struct _FcCharLeafEnt { @@ -845,36 +966,63 @@ struct _FcCharLeafEnt { }; #define FC_CHAR_LEAF_BLOCK (4096 / sizeof (FcCharLeafEnt)) -static FcCharLeafEnt **FcCharLeafBlocks; -static int FcCharLeafBlockCount; +#define FC_CHAR_LEAF_HASH_SIZE 257 + +typedef struct _FcCharSetEnt FcCharSetEnt; + +struct _FcCharSetEnt { + FcCharSetEnt *next; + FcChar32 hash; + FcCharSet set; +}; + +typedef struct _FcCharSetOrigEnt FcCharSetOrigEnt; + +struct _FcCharSetOrigEnt { + FcCharSetOrigEnt *next; + const FcCharSet *orig; + const FcCharSet *frozen; +}; + +#define FC_CHAR_SET_HASH_SIZE 67 + +struct _FcCharSetFreezer { + FcCharLeafEnt *leaf_hash_table[FC_CHAR_LEAF_HASH_SIZE]; + FcCharLeafEnt **leaf_blocks; + int leaf_block_count; + FcCharSetEnt *set_hash_table[FC_CHAR_SET_HASH_SIZE]; + FcCharSetOrigEnt *orig_hash_table[FC_CHAR_SET_HASH_SIZE]; + FcCharLeafEnt *current_block; + int leaf_remain; + int leaves_seen; + int charsets_seen; + int leaves_allocated; + int charsets_allocated; +}; static FcCharLeafEnt * -FcCharLeafEntCreate (void) +FcCharLeafEntCreate (FcCharSetFreezer *freezer) { - static FcCharLeafEnt *block; - static int remain; - - if (!remain) + if (!freezer->leaf_remain) { FcCharLeafEnt **newBlocks; - FcCharLeafBlockCount++; - newBlocks = realloc (FcCharLeafBlocks, FcCharLeafBlockCount * sizeof (FcCharLeafEnt *)); + freezer->leaf_block_count++; + newBlocks = realloc (freezer->leaf_blocks, freezer->leaf_block_count * sizeof (FcCharLeafEnt *)); if (!newBlocks) return 0; - FcCharLeafBlocks = newBlocks; - block = FcCharLeafBlocks[FcCharLeafBlockCount-1] = malloc (FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt)); - if (!block) + freezer->leaf_blocks = newBlocks; + freezer->current_block = freezer->leaf_blocks[freezer->leaf_block_count-1] = malloc (FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt)); + if (!freezer->current_block) return 0; FcMemAlloc (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt)); - remain = FC_CHAR_LEAF_BLOCK; + freezer->leaf_remain = FC_CHAR_LEAF_BLOCK; } - remain--; - return block++; + freezer->leaf_remain--; + freezer->leaves_allocated++; + return freezer->current_block++; } -#define FC_CHAR_LEAF_HASH_SIZE 257 - static FcChar32 FcCharLeafHash (FcCharLeaf *leaf) { @@ -886,29 +1034,22 @@ FcCharLeafHash (FcCharLeaf *leaf) return hash; } -static int FcCharLeafTotal; -static int FcCharLeafUsed; - -static FcCharLeafEnt *FcCharLeafHashTable[FC_CHAR_LEAF_HASH_SIZE]; - static FcCharLeaf * -FcCharSetFreezeLeaf (FcCharLeaf *leaf) +FcCharSetFreezeLeaf (FcCharSetFreezer *freezer, FcCharLeaf *leaf) { FcChar32 hash = FcCharLeafHash (leaf); - FcCharLeafEnt **bucket = &FcCharLeafHashTable[hash % FC_CHAR_LEAF_HASH_SIZE]; + FcCharLeafEnt **bucket = &freezer->leaf_hash_table[hash % FC_CHAR_LEAF_HASH_SIZE]; FcCharLeafEnt *ent; - FcCharLeafTotal++; for (ent = *bucket; ent; ent = ent->next) { if (ent->hash == hash && !memcmp (&ent->leaf, leaf, sizeof (FcCharLeaf))) return &ent->leaf; } - ent = FcCharLeafEntCreate(); + ent = FcCharLeafEntCreate(freezer); if (!ent) return 0; - FcCharLeafUsed++; ent->leaf = *leaf; ent->hash = hash; ent->next = *bucket; @@ -916,78 +1057,62 @@ FcCharSetFreezeLeaf (FcCharLeaf *leaf) return &ent->leaf; } -static void -FcCharSetThawAllLeaf (void) -{ - int i; - - for (i = 0; i < FC_CHAR_LEAF_HASH_SIZE; i++) - FcCharLeafHashTable[i] = 0; - - FcCharLeafTotal = 0; - FcCharLeafUsed = 0; - - for (i = 0; i < FcCharLeafBlockCount; i++) - free (FcCharLeafBlocks[i]); - - free (FcCharLeafBlocks); - FcCharLeafBlocks = 0; - FcCharLeafBlockCount = 0; -} - -typedef struct _FcCharSetEnt FcCharSetEnt; - -struct _FcCharSetEnt { - FcCharSetEnt *next; - FcChar32 hash; - FcCharSet set; -}; - -#define FC_CHAR_SET_HASH_SIZE 67 - static FcChar32 FcCharSetHash (FcCharSet *fcs) { FcChar32 hash = 0; - FcChar32 *p; int i; /* hash in leaves */ - p = (FcChar32 *) fcs->leaves; - for (i = 0; i < fcs->num * sizeof (FcCharLeaf *) / sizeof (FcChar32); i++) - hash = ((hash << 1) | (hash >> 31)) ^ *p++; + for (i = 0; i < fcs->num * (int) (sizeof (FcCharLeaf *) / sizeof (FcChar32)); i++) + hash = ((hash << 1) | (hash >> 31)) ^ (FcChar32)(FcCharSetLeaf(fcs, i)->map); /* hash in numbers */ for (i = 0; i < fcs->num; i++) - hash = ((hash << 1) | (hash >> 31)) ^ fcs->numbers[i]; + hash = ((hash << 1) | (hash >> 31)) ^ *FcCharSetNumbers(fcs); return hash; } -static int FcCharSetTotal; -static int FcCharSetUsed; -static int FcCharSetTotalEnts, FcCharSetUsedEnts; - -static FcCharSetEnt *FcCharSetHashTable[FC_CHAR_SET_HASH_SIZE]; +static FcBool +FcCharSetFreezeOrig (FcCharSetFreezer *freezer, const FcCharSet *orig, const FcCharSet *frozen) +{ + FcCharSetOrigEnt **bucket = &freezer->orig_hash_table[((uintptr_t) orig) & FC_CHAR_SET_HASH_SIZE]; + FcCharSetOrigEnt *ent; + + ent = malloc (sizeof (FcCharSetOrigEnt)); + if (!ent) + return FcFalse; + ent->orig = orig; + ent->frozen = frozen; + ent->next = *bucket; + *bucket = ent; + return FcTrue; +} static FcCharSet * -FcCharSetFreezeBase (FcCharSet *fcs) +FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs, const FcCharSet *orig) { FcChar32 hash = FcCharSetHash (fcs); - FcCharSetEnt **bucket = &FcCharSetHashTable[hash % FC_CHAR_SET_HASH_SIZE]; + FcCharSetEnt **bucket = &freezer->set_hash_table[hash % FC_CHAR_SET_HASH_SIZE]; FcCharSetEnt *ent; int size; + int i; - FcCharSetTotal++; - FcCharSetTotalEnts += fcs->num; for (ent = *bucket; ent; ent = ent->next) { if (ent->hash == hash && ent->set.num == fcs->num && - !memcmp (ent->set.leaves, fcs->leaves, - fcs->num * sizeof (FcCharLeaf *)) && - !memcmp (ent->set.numbers, fcs->numbers, + !memcmp (FcCharSetNumbers(&ent->set), + FcCharSetNumbers(fcs), fcs->num * sizeof (FcChar16))) { - return &ent->set; + FcBool ok = FcTrue; + int i; + + for (i = 0; i < fcs->num; i++) + if (FcCharSetLeaf(&ent->set, i) != FcCharSetLeaf(fcs, i)) + ok = FcFalse; + if (ok) + return &ent->set; } } @@ -998,84 +1123,89 @@ FcCharSetFreezeBase (FcCharSet *fcs) if (!ent) return 0; FcMemAlloc (FC_MEM_CHARSET, size); - FcCharSetUsed++; - FcCharSetUsedEnts += fcs->num; + + freezer->charsets_allocated++; ent->set.ref = FC_REF_CONSTANT; ent->set.num = fcs->num; if (fcs->num) { - ent->set.leaves = (FcCharLeaf **) (ent + 1); - ent->set.numbers = (FcChar16 *) (ent->set.leaves + fcs->num); - memcpy (ent->set.leaves, fcs->leaves, fcs->num * sizeof (FcCharLeaf *)); - memcpy (ent->set.numbers, fcs->numbers, fcs->num * sizeof (FcChar16)); + intptr_t *ent_leaves; + + ent->set.leaves_offset = sizeof (ent->set); + ent->set.numbers_offset = (ent->set.leaves_offset + + fcs->num * sizeof (intptr_t)); + + ent_leaves = FcCharSetLeaves (&ent->set); + for (i = 0; i < fcs->num; i++) + ent_leaves[i] = FcPtrToOffset (ent_leaves, + FcCharSetLeaf (fcs, i)); + memcpy (FcCharSetNumbers (&ent->set), + FcCharSetNumbers (fcs), + fcs->num * sizeof (FcChar16)); } else { - ent->set.leaves = 0; - ent->set.numbers = 0; + ent->set.leaves_offset = 0; + ent->set.numbers_offset = 0; } ent->hash = hash; ent->next = *bucket; *bucket = ent; + return &ent->set; } -void -FcCharSetThawAll (void) +static const FcCharSet * +FcCharSetFindFrozen (FcCharSetFreezer *freezer, const FcCharSet *orig) { - int i; - FcCharSetEnt *ent, *next; - - for (i = 0; i < FC_CHAR_SET_HASH_SIZE; i++) - { - for (ent = FcCharSetHashTable[i]; ent; ent = next) - { - next = ent->next; - free (ent); - } - FcCharSetHashTable[i] = 0; - } - - FcCharSetTotal = 0; - FcCharSetTotalEnts = 0; - FcCharSetUsed = 0; - FcCharSetUsedEnts = 0; - - FcCharSetThawAllLeaf (); + FcCharSetOrigEnt **bucket = &freezer->orig_hash_table[((uintptr_t) orig) & FC_CHAR_SET_HASH_SIZE]; + FcCharSetOrigEnt *ent; + + for (ent = *bucket; ent; ent = ent->next) + if (ent->orig == orig) + return ent->frozen; + return NULL; } -FcCharSet * -FcCharSetFreeze (FcCharSet *fcs) +const FcCharSet * +FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs) { - FcCharSet *b; - FcCharSet *n = 0; - FcCharLeaf *l; - int i; + FcCharSet *b; + const FcCharSet *n = 0; + FcCharLeaf *l; + int i; b = FcCharSetCreate (); if (!b) goto bail0; for (i = 0; i < fcs->num; i++) { - l = FcCharSetFreezeLeaf (fcs->leaves[i]); + l = FcCharSetFreezeLeaf (freezer, FcCharSetLeaf(fcs, i)); if (!l) goto bail1; - if (!FcCharSetInsertLeaf (b, fcs->numbers[i] << 8, l)) + if (!FcCharSetInsertLeaf (b, FcCharSetNumbers(fcs)[i] << 8, l)) goto bail1; } - n = FcCharSetFreezeBase (b); + n = FcCharSetFreezeBase (freezer, b, fcs); + if (!FcCharSetFreezeOrig (freezer, fcs, n)) + { + n = NULL; + goto bail1; + } + freezer->charsets_seen++; + freezer->leaves_seen += fcs->num; bail1: - if (b->leaves) + if (b->num) { FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcCharLeaf *)); - free (b->leaves); + free (FcCharSetLeaves (b)); } - if (b->numbers) + if (b->num) { FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcChar16)); - free (b->numbers); + free (FcCharSetNumbers (b)); } FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); free (b); @@ -1083,149 +1213,148 @@ bail0: return n; } -FcCharSet * -FcNameParseCharSet (FcChar8 *string) +FcCharSetFreezer * +FcCharSetFreezerCreate (void) { - FcCharSet *c, *n = 0; - FcChar32 ucs4; - FcCharLeaf *leaf; - FcCharLeaf temp; - FcChar32 bits; - int i; + FcCharSetFreezer *freezer; - c = FcCharSetCreate (); - if (!c) - goto bail0; - while (*string) + freezer = calloc (1, sizeof (FcCharSetFreezer)); + return freezer; +} + +void +FcCharSetFreezerDestroy (FcCharSetFreezer *freezer) +{ + int i; + + if (FcDebug() & FC_DBG_CACHE) { - string = FcCharSetParseValue (string, &ucs4); - if (!string) - goto bail1; - bits = 0; - for (i = 0; i < 256/32; i++) - { - string = FcCharSetParseValue (string, &temp.map[i]); - if (!string) - goto bail1; - bits |= temp.map[i]; - } - if (bits) - { - leaf = FcCharSetFreezeLeaf (&temp); - if (!leaf) - goto bail1; - if (!FcCharSetInsertLeaf (c, ucs4, leaf)) - goto bail1; - } + printf ("\ncharsets %d -> %d leaves %d -> %d\n", + freezer->charsets_seen, freezer->charsets_allocated, + freezer->leaves_seen, freezer->leaves_allocated); } -#ifdef CHATTY - printf (" %8s %8s %8s %8s\n", "total", "totalmem", "new", "newmem"); - printf ("Leaves: %8d %8d %8d %8d\n", - FcCharLeafTotal, sizeof (FcCharLeaf) * FcCharLeafTotal, - FcCharLeafUsed, sizeof (FcCharLeaf) * FcCharLeafUsed); - printf ("Charsets: %8d %8d %8d %8d\n", - FcCharSetTotal, sizeof (FcCharSet) * FcCharSetTotal, - FcCharSetUsed, sizeof (FcCharSet) * FcCharSetUsed); - printf ("Tables: %8d %8d %8d %8d\n", - FcCharSetTotalEnts, FcCharSetTotalEnts * (sizeof (FcCharLeaf *) + sizeof (FcChar16)), - FcCharSetUsedEnts, FcCharSetUsedEnts * (sizeof (FcCharLeaf *) + sizeof (FcChar16))); - printf ("Total: %8s %8d %8s %8d\n", - "", - sizeof (FcCharLeaf) * FcCharLeafTotal + - sizeof (FcCharSet) * FcCharSetTotal + - FcCharSetTotalEnts * (sizeof (FcCharLeaf *) + sizeof (FcChar16)), - "", - sizeof (FcCharLeaf) * FcCharLeafUsed + - sizeof (FcCharSet) * FcCharSetUsed + - FcCharSetUsedEnts * (sizeof (FcCharLeaf *) + sizeof (FcChar16))); -#endif - n = FcCharSetFreezeBase (c); -bail1: - if (c->leaves) + for (i = 0; i < FC_CHAR_SET_HASH_SIZE; i++) { - FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcCharLeaf *)); - free (c->leaves); + FcCharSetEnt *ent, *next; + for (ent = freezer->set_hash_table[i]; ent; ent = next) + { + next = ent->next; + free (ent); + } } - if (c->numbers) + + for (i = 0; i < FC_CHAR_SET_HASH_SIZE; i++) { - FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcChar16)); - free (c->numbers); + FcCharSetOrigEnt *ent, *next; + for (ent = freezer->orig_hash_table[i]; ent; ent = next) + { + next = ent->next; + free (ent); + } } - FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); - free (c); -bail0: - return n; + + for (i = 0; i < freezer->leaf_block_count; i++) + free (freezer->leaf_blocks[i]); + + free (freezer->leaf_blocks); + free (freezer); } FcBool -FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c) +FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs) { - FcCharSetIter ci; + intptr_t *leaves; + FcChar16 *numbers; int i; -#ifdef CHECK - int len = buf->len; -#endif - - for (FcCharSetIterStart (c, &ci); - ci.leaf; - FcCharSetIterNext (c, &ci)) + + if (cs->ref != FC_REF_CONSTANT) { - if (!FcCharSetUnparseValue (buf, ci.ucs4)) - return FcFalse; - for (i = 0; i < 256/32; i++) - if (!FcCharSetUnparseValue (buf, ci.leaf->map[i])) + if (!serialize->cs_freezer) + { + serialize->cs_freezer = FcCharSetFreezerCreate (); + if (!serialize->cs_freezer) return FcFalse; + } + if (FcCharSetFindFrozen (serialize->cs_freezer, cs)) + return FcTrue; + + cs = FcCharSetFreeze (serialize->cs_freezer, cs); } -#ifdef CHECK + + leaves = FcCharSetLeaves (cs); + numbers = FcCharSetNumbers (cs); + + if (!FcSerializeAlloc (serialize, cs, sizeof (FcCharSet))) + return FcFalse; + if (!FcSerializeAlloc (serialize, leaves, cs->num * sizeof (intptr_t))) + return FcFalse; + if (!FcSerializeAlloc (serialize, numbers, cs->num * sizeof (FcChar16))) + return FcFalse; + for (i = 0; i < cs->num; i++) + if (!FcSerializeAlloc (serialize, FcCharSetLeaf(cs, i), + sizeof (FcCharLeaf))) + return FcFalse; + return FcTrue; +} + +FcCharSet * +FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) +{ + FcCharSet *cs_serialized; + intptr_t *leaves, *leaves_serialized; + FcChar16 *numbers, *numbers_serialized; + FcCharLeaf *leaf, *leaf_serialized; + int i; + + if (cs->ref != FC_REF_CONSTANT && serialize->cs_freezer) { - FcCharSet *check; - FcChar32 missing; - FcCharSetIter ci, checki; + cs = FcCharSetFindFrozen (serialize->cs_freezer, cs); + if (!cs) + return NULL; + } + + cs_serialized = FcSerializePtr (serialize, cs); + if (!cs_serialized) + return NULL; + + cs_serialized->ref = FC_REF_CONSTANT; + cs_serialized->num = cs->num; + + if (cs->num) + { + leaves = FcCharSetLeaves (cs); + leaves_serialized = FcSerializePtr (serialize, leaves); + if (!leaves_serialized) + return NULL; + + cs_serialized->leaves_offset = FcPtrToOffset (cs_serialized, + leaves_serialized); - /* null terminate for parser */ - FcStrBufChar (buf, '\0'); - /* step back over null for life after test */ - buf->len--; - check = FcNameParseCharSet (buf->buf + len); - FcCharSetIterStart (c, &ci); - FcCharSetIterStart (check, &checki); - while (ci.leaf || checki.leaf) + numbers = FcCharSetNumbers (cs); + numbers_serialized = FcSerializePtr (serialize, numbers); + if (!numbers) + return NULL; + + cs_serialized->numbers_offset = FcPtrToOffset (cs_serialized, + numbers_serialized); + + for (i = 0; i < cs->num; i++) { - if (ci.ucs4 < checki.ucs4) - { - printf ("Missing leaf node at 0x%x\n", ci.ucs4); - FcCharSetIterNext (c, &ci); - } - else if (checki.ucs4 < ci.ucs4) - { - printf ("Extra leaf node at 0x%x\n", checki.ucs4); - FcCharSetIterNext (check, &checki); - } - else - { - int i = 256/32; - FcChar32 *cm = ci.leaf->map; - FcChar32 *checkm = checki.leaf->map; - - for (i = 0; i < 256; i += 32) - { - if (*cm != *checkm) - printf ("Mismatching sets at 0x%08x: 0x%08x != 0x%08x\n", - ci.ucs4 + i, *cm, *checkm); - cm++; - checkm++; - } - FcCharSetIterNext (c, &ci); - FcCharSetIterNext (check, &checki); - } + leaf = FcCharSetLeaf (cs, i); + leaf_serialized = FcSerializePtr (serialize, leaf); + if (!leaf_serialized) + return NULL; + *leaf_serialized = *leaf; + leaves_serialized[i] = FcPtrToOffset (leaves_serialized, + leaf_serialized); + numbers_serialized[i] = numbers[i]; } - if ((missing = FcCharSetSubtractCount (c, check))) - printf ("%d missing in reparsed result\n", missing); - if ((missing = FcCharSetSubtractCount (check, c))) - printf ("%d extra in reparsed result\n", missing); - FcCharSetDestroy (check); } -#endif + else + { + cs_serialized->leaves_offset = 0; + cs_serialized->numbers_offset = 0; + } - return FcTrue; + return cs_serialized; } diff --git a/src/fcdbg.c b/src/fcdbg.c index cd72eda..98b57e6 100644 --- a/src/fcdbg.c +++ b/src/fcdbg.c @@ -22,9 +22,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include -#include "fcint.h" void FcValuePrint (const FcValue v) @@ -49,7 +49,8 @@ FcValuePrint (const FcValue v) printf (" (%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy); break; case FcTypeCharSet: /* XXX */ - printf (" set"); + printf (" "); + FcCharSetPrint (v.u.c); break; case FcTypeLangSet: printf (" "); @@ -62,11 +63,11 @@ FcValuePrint (const FcValue v) } void -FcValueListPrint (const FcValueList *l) +FcValueListPrint (FcValueListPtr l) { - for (; l; l = l->next) + for (; l != NULL; l = FcValueListNext(l)) { - FcValuePrint (l->value); + FcValuePrint (FcValueCanonicalize(&l->value)); switch (l->binding) { case FcValueBindingWeak: printf ("(w)"); @@ -89,12 +90,46 @@ FcLangSetPrint (const FcLangSet *ls) FcStrBufInit (&buf, init_buf, sizeof (init_buf)); if (FcNameUnparseLangSet (&buf, ls) && FcStrBufChar (&buf,'\0')) - printf ("%s", buf.buf); + printf ("%s", buf.buf); else - printf ("langset (alloc error)"); + printf ("langset (alloc error)"); FcStrBufDestroy (&buf); } +void +FcCharSetPrint (const FcCharSet *c) +{ + int i, j; + intptr_t *leaves = FcCharSetLeaves (c); + FcChar16 *numbers = FcCharSetNumbers (c); + +#if 0 + printf ("CharSet 0x%x\n", (intptr_t) c); + printf ("Leaves: +%d = 0x%x\n", c->leaves_offset, (intptr_t) leaves); + printf ("Numbers: +%d = 0x%x\n", c->numbers_offset, (intptr_t) numbers); + + for (i = 0; i < c->num; i++) + { + printf ("Page %d: %04x +%d = 0x%x\n", + i, numbers[i], leaves[i], + (intptr_t) FcOffsetToPtr (leaves, leaves[i], FcCharLeaf)); + } +#endif + + for (i = 0; i < c->num; i++) + { + intptr_t leaf_offset = leaves[i]; + FcCharLeaf *leaf = FcOffsetToPtr (leaves, leaf_offset, FcCharLeaf); + + if (i) + printf ("\t"); + printf ("%04x:", numbers[i]); + for (j = 0; j < 256/32; j++) + printf (" %08x", leaf->map[j]); + printf ("\n"); + } +} + void FcPatternPrint (const FcPattern *p) { @@ -106,12 +141,31 @@ FcPatternPrint (const FcPattern *p) printf ("Null pattern\n"); return; } - printf ("Pattern %d of %d\n", p->num, p->size); + printf ("Pattern has %d elts (size %d)\n", p->num, p->size); for (i = 0; i < p->num; i++) { - e = &p->elts[i]; - printf ("\t%s:", e->object); - FcValueListPrint (e->values); + e = &FcPatternElts(p)[i]; + printf ("\t%s:", FcObjectName(e->object)); + /* so that fc-match properly displays file: foo... */ + if (e->object == FC_FILE_OBJECT) + { + FcChar8 * s; + FcPatternObjectGetString (p, FC_FILE_OBJECT, 0, &s); + printf (" \"%s\"", s); + switch (FcPatternEltValues(e)->binding) { + case FcValueBindingWeak: + printf ("(w)"); + break; + case FcValueBindingStrong: + printf ("(s)"); + break; + case FcValueBindingSame: + printf ("(=)"); + break; + } + } + else + FcValueListPrint (FcPatternEltValues(e)); printf ("\n"); } printf ("\n"); @@ -178,7 +232,7 @@ FcExprPrint (const FcExpr *expr) case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break; case FcOpCharSet: printf ("charset\n"); break; case FcOpNil: printf ("nil\n"); break; - case FcOpField: printf ("%s", expr->u.field); break; + case FcOpField: printf ("%s", FcObjectName(expr->u.object)); break; case FcOpConst: printf ("%s", expr->u.constant); break; case FcOpQuest: FcExprPrint (expr->u.tree.left); @@ -273,6 +327,9 @@ FcTestPrint (const FcTest *test) case FcMatchFont: printf ("font "); break; + case FcMatchScan: + printf ("scan "); + break; } switch (test->qual) { case FcQualAny: @@ -288,7 +345,7 @@ FcTestPrint (const FcTest *test) printf ("not_first "); break; } - printf ("%s ", test->field); + printf ("%s ", FcObjectName (test->object)); FcOpPrint (test->op); printf (" "); FcExprPrint (test->expr); @@ -298,7 +355,7 @@ FcTestPrint (const FcTest *test) void FcEditPrint (const FcEdit *edit) { - printf ("Edit %s ", edit->field); + printf ("Edit %s ", FcObjectName (edit->object)); FcOpPrint (edit->op); printf (" "); FcExprPrint (edit->expr); @@ -339,25 +396,19 @@ FcFontSetPrint (const FcFontSet *s) } } -int -FcDebug (void) +int FcDebugVal; + +void +FcInitDebug (void) { - static int initialized; - static int debug; + char *e; - if (!initialized) + e = getenv ("FC_DEBUG"); + if (e) { - char *e; - - initialized = 1; - e = getenv ("FC_DEBUG"); - if (e) - { - printf ("FC_DEBUG=%s\n", e); - debug = atoi (e); - if (debug < 0) - debug = 0; - } + printf ("FC_DEBUG=%s\n", e); + FcDebugVal = atoi (e); + if (FcDebugVal < 0) + FcDebugVal = 0; } - return debug; } diff --git a/src/fcdefault.c b/src/fcdefault.c index 0e84311..b69de30 100644 --- a/src/fcdefault.c +++ b/src/fcdefault.c @@ -25,17 +25,80 @@ #include "fcint.h" #include -static struct { - char *field; +static const struct { + FcObject field; FcBool value; } FcBoolDefaults[] = { - { FC_HINTING, FcTrue }, /* !FT_LOAD_NO_HINTING */ - { FC_VERTICAL_LAYOUT, FcFalse }, /* FC_LOAD_VERTICAL_LAYOUT */ - { FC_AUTOHINT, FcFalse }, /* FC_LOAD_FORCE_AUTOHINT */ - { FC_GLOBAL_ADVANCE, FcTrue }, /* !FC_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ + { FC_HINTING_OBJECT, FcTrue }, /* !FT_LOAD_NO_HINTING */ + { FC_VERTICAL_LAYOUT_OBJECT, FcFalse }, /* FC_LOAD_VERTICAL_LAYOUT */ + { FC_AUTOHINT_OBJECT, FcFalse }, /* FC_LOAD_FORCE_AUTOHINT */ + { FC_GLOBAL_ADVANCE_OBJECT, FcTrue }, /* !FC_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ + { FC_EMBEDDED_BITMAP_OBJECT, FcTrue }, /* !FC_LOAD_NO_BITMAP */ + { FC_DECORATIVE_OBJECT, FcFalse }, }; -#define NUM_FC_BOOL_DEFAULTS (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0]) +#define NUM_FC_BOOL_DEFAULTS (int) (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0]) + +FcChar8 * +FcGetDefaultLang (void) +{ + static char lang_local [128] = {0}; + char *ctype; + char *territory; + char *after; + int lang_len, territory_len; + + if (lang_local [0]) + return (FcChar8 *) lang_local; + + ctype = setlocale (LC_CTYPE, NULL); + + /* + * Check if setlocale (LC_ALL, "") has been called + */ + if (!ctype || !strcmp (ctype, "C")) + { + ctype = getenv ("LC_ALL"); + if (!ctype) + { + ctype = getenv ("LC_CTYPE"); + if (!ctype) + ctype = getenv ("LANG"); + } + } + + /* ignore missing or empty ctype */ + if (ctype && *ctype != '\0') + { + territory = strchr (ctype, '_'); + if (territory) + { + lang_len = territory - ctype; + territory = territory + 1; + after = strchr (territory, '.'); + if (!after) + { + after = strchr (territory, '@'); + if (!after) + after = territory + strlen (territory); + } + territory_len = after - territory; + if (lang_len + 1 + territory_len + 1 <= (int) sizeof (lang_local)) + { + strncpy (lang_local, ctype, lang_len); + lang_local[lang_len] = '-'; + strncpy (lang_local + lang_len + 1, territory, territory_len); + lang_local[lang_len + 1 + territory_len] = '\0'; + } + } + } + + /* set default lang to en */ + if (!lang_local [0]) + strcpy (lang_local, "en"); + + return (FcChar8 *) lang_local; +} void FcDefaultSubstitute (FcPattern *pattern) @@ -43,110 +106,63 @@ FcDefaultSubstitute (FcPattern *pattern) FcValue v; int i; - if (FcPatternGet (pattern, FC_STYLE, 0, &v) == FcResultNoMatch) + if (FcPatternObjectGet (pattern, FC_STYLE_OBJECT, 0, &v) == FcResultNoMatch) { - if (FcPatternGet (pattern, FC_WEIGHT, 0, &v) == FcResultNoMatch ) + if (FcPatternObjectGet (pattern, FC_WEIGHT_OBJECT, 0, &v) == FcResultNoMatch ) { - FcPatternAddInteger (pattern, FC_WEIGHT, FC_WEIGHT_MEDIUM); + FcPatternObjectAddInteger (pattern, FC_WEIGHT_OBJECT, FC_WEIGHT_MEDIUM); } - if (FcPatternGet (pattern, FC_SLANT, 0, &v) == FcResultNoMatch) + if (FcPatternObjectGet (pattern, FC_SLANT_OBJECT, 0, &v) == FcResultNoMatch) { - FcPatternAddInteger (pattern, FC_SLANT, FC_SLANT_ROMAN); + FcPatternObjectAddInteger (pattern, FC_SLANT_OBJECT, FC_SLANT_ROMAN); } } - if (FcPatternGet (pattern, FC_WIDTH, 0, &v) == FcResultNoMatch) - FcPatternAddInteger (pattern, FC_WIDTH, FC_WIDTH_NORMAL); + if (FcPatternObjectGet (pattern, FC_WIDTH_OBJECT, 0, &v) == FcResultNoMatch) + FcPatternObjectAddInteger (pattern, FC_WIDTH_OBJECT, FC_WIDTH_NORMAL); for (i = 0; i < NUM_FC_BOOL_DEFAULTS; i++) - if (FcPatternGet (pattern, FcBoolDefaults[i].field, 0, &v) == FcResultNoMatch) - FcPatternAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value); + if (FcPatternObjectGet (pattern, FcBoolDefaults[i].field, 0, &v) == FcResultNoMatch) + FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value); - if (FcPatternGet (pattern, FC_PIXEL_SIZE, 0, &v) == FcResultNoMatch) + if (FcPatternObjectGet (pattern, FC_PIXEL_SIZE_OBJECT, 0, &v) == FcResultNoMatch) { double dpi, size, scale; - if (FcPatternGetDouble (pattern, FC_SIZE, 0, &size) != FcResultMatch) + if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch) { size = 12.0; - (void) FcPatternDel (pattern, FC_SIZE); - FcPatternAddDouble (pattern, FC_SIZE, size); + (void) FcPatternObjectDel (pattern, FC_SIZE_OBJECT); + FcPatternObjectAddDouble (pattern, FC_SIZE_OBJECT, size); } - if (FcPatternGetDouble (pattern, FC_SCALE, 0, &scale) != FcResultMatch) + if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch) { scale = 1.0; - (void) FcPatternDel (pattern, FC_SCALE); - FcPatternAddDouble (pattern, FC_SCALE, scale); + (void) FcPatternObjectDel (pattern, FC_SCALE_OBJECT); + FcPatternObjectAddDouble (pattern, FC_SCALE_OBJECT, scale); } size *= scale; - if (FcPatternGetDouble (pattern, FC_DPI, 0, &dpi) != FcResultMatch) + if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch) { dpi = 75.0; - (void) FcPatternDel (pattern, FC_DPI); - FcPatternAddDouble (pattern, FC_DPI, dpi); + (void) FcPatternObjectDel (pattern, FC_DPI_OBJECT); + FcPatternObjectAddDouble (pattern, FC_DPI_OBJECT, dpi); } size *= dpi / 72.0; - FcPatternAddDouble (pattern, FC_PIXEL_SIZE, size); + FcPatternObjectAddDouble (pattern, FC_PIXEL_SIZE_OBJECT, size); } - if (FcPatternGet (pattern, FC_LANG, 0, &v) == FcResultNoMatch) + if (FcPatternObjectGet (pattern, FC_LANG_OBJECT, 0, &v) == FcResultNoMatch) { - char *lang; - char *territory; - char *after; - int lang_len, territory_len; - char lang_local[128]; - char *ctype = setlocale (LC_CTYPE, NULL); - - /* - * Check if setlocale (LC_ALL, "") has been called - */ - if (!ctype || !strcmp (ctype, "C")) - { - ctype = getenv ("LC_ALL"); - if (!ctype) - { - ctype = getenv ("LC_CTYPE"); - if (!ctype) - ctype = getenv ("LANG"); - } - } - if (ctype) - { - lang = ctype; - territory = strchr (ctype, '_'); - if (territory) - { - lang_len = territory - lang; - territory = territory + 1; - after = strchr (territory, '.'); - if (!after) - { - after = strchr (territory, '@'); - if (!after) - after = territory + strlen (territory); - } - territory_len = after - territory; - if (lang_len + 1 + territory_len + 1 <= sizeof (lang_local)) - { - strncpy (lang_local, lang, lang_len); - lang_local[lang_len] = '-'; - strncpy (lang_local + lang_len + 1, territory, territory_len); - lang_local[lang_len + 1 + territory_len] = '\0'; - FcPatternAddString (pattern, FC_LANG, (FcChar8 *) lang_local); - } - } - else - FcPatternAddString (pattern, FC_LANG, (FcChar8 *) lang); - } + FcPatternObjectAddString (pattern, FC_LANG_OBJECT, FcGetDefaultLang ()); } - if (FcPatternGet (pattern, FC_FONTVERSION, 0, &v) == FcResultNoMatch) + if (FcPatternObjectGet (pattern, FC_FONTVERSION_OBJECT, 0, &v) == FcResultNoMatch) { - FcPatternAddInteger (pattern, FC_FONTVERSION, 0x7fffffff); + FcPatternObjectAddInteger (pattern, FC_FONTVERSION_OBJECT, 0x7fffffff); } - if (FcPatternGet (pattern, FC_HINT_STYLE, 0, &v) == FcResultNoMatch) + if (FcPatternObjectGet (pattern, FC_HINT_STYLE_OBJECT, 0, &v) == FcResultNoMatch) { - FcPatternAddInteger (pattern, FC_HINT_STYLE, FC_HINT_FULL); + FcPatternObjectAddInteger (pattern, FC_HINT_STYLE_OBJECT, FC_HINT_FULL); } } diff --git a/src/fcdir.c b/src/fcdir.c index ad64ca8..a55c5fd 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -35,118 +35,57 @@ FcFileIsDir (const FcChar8 *file) return S_ISDIR(statb.st_mode); } -FcBool -FcFileScanConfig (FcFontSet *set, - FcStrSet *dirs, - FcGlobalCache *cache, - FcBlanks *blanks, - const FcChar8 *file, - FcBool force, - FcConfig *config) +static FcBool +FcFileScanFontConfig (FcFontSet *set, + FcBlanks *blanks, + const FcChar8 *file, + FcConfig *config) { - int id; - FcChar8 *name; - FcPattern *font; - FcBool ret = FcTrue; - FcBool isDir; - int count = 0; - FcGlobalCacheFile *cache_file; - FcGlobalCacheDir *cache_dir; - FcBool need_scan; + FcPattern *font; + FcBool ret = FcTrue; + int id; + int count = 0; - if (config && !FcConfigAcceptFilename (config, file)) - return FcTrue; - - if (force) - cache = 0; id = 0; do { - need_scan = FcTrue; font = 0; /* - * Check the cache + * Nothing in the cache, scan the file */ - if (cache) + if (FcDebug () & FC_DBG_SCAN) { - if ((cache_file = FcGlobalCacheFileGet (cache, file, id, &count))) - { - /* - * Found a cache entry for the file - */ - if (FcGlobalCacheCheckTime (file, &cache_file->info)) - { - name = cache_file->name; - need_scan = FcFalse; - FcGlobalCacheReferenced (cache, &cache_file->info); - /* "." means the file doesn't contain a font */ - if (FcStrCmp (name, FC_FONT_FILE_INVALID) != 0) - { - font = FcNameParse (name); - if (font) - if (!FcPatternAddString (font, FC_FILE, file)) - ret = FcFalse; - } - } - } - else if ((cache_dir = FcGlobalCacheDirGet (cache, file, - strlen ((const char *) file), - FcFalse))) - { - if (FcGlobalCacheCheckTime (cache_dir->info.file, - &cache_dir->info)) - { - font = 0; - need_scan = FcFalse; - FcGlobalCacheReferenced (cache, &cache_dir->info); - if (!FcStrSetAdd (dirs, file)) - ret = FcFalse; - } - } + printf ("\tScanning file %s...", file); + fflush (stdout); } + font = FcFreeTypeQuery (file, id, blanks, &count); + if (FcDebug () & FC_DBG_SCAN) + printf ("done\n"); + /* - * Nothing in the cache, scan the file + * Edit pattern with user-defined rules */ - if (need_scan) + if (config && !FcConfigSubstituteWithPat (config, font, NULL, FcMatchScan)) { - if (FcDebug () & FC_DBG_SCAN) - { - printf ("\tScanning file %s...", file); - fflush (stdout); - } - font = FcFreeTypeQuery (file, id, blanks, &count); - if (FcDebug () & FC_DBG_SCAN) - printf ("done\n"); - isDir = FcFalse; - if (!font && FcFileIsDir (file)) - { - isDir = FcTrue; - ret = FcStrSetAdd (dirs, file); - } - /* - * Update the cache - */ - if (cache && font) - { - FcChar8 *unparse; - - unparse = FcNameUnparse (font); - if (unparse) - { - (void) FcGlobalCacheUpdate (cache, file, id, unparse); - FcStrFree (unparse); - } - } + FcPatternDestroy (font); + font = NULL; + ret = FcFalse; } + /* * Add the font */ if (font && (!config || FcConfigAcceptFont (config, font))) { + if (FcDebug() & FC_DBG_SCANV) + { + printf ("Final font pattern:\n"); + FcPatternPrint (font); + } if (!FcFontSetAdd (set, font)) { FcPatternDestroy (font); - font = 0; + font = NULL; ret = FcFalse; } } @@ -157,21 +96,33 @@ FcFileScanConfig (FcFontSet *set, return ret; } +FcBool +FcFileScanConfig (FcFontSet *set, + FcStrSet *dirs, + FcBlanks *blanks, + const FcChar8 *file, + FcConfig *config) +{ + if (FcFileIsDir (file)) + return FcStrSetAdd (dirs, file); + else + return FcFileScanFontConfig (set, blanks, file, config); +} + FcBool FcFileScan (FcFontSet *set, FcStrSet *dirs, - FcGlobalCache *cache, + FcFileCache *cache, /* XXX unused */ FcBlanks *blanks, const FcChar8 *file, FcBool force) { - return FcFileScanConfig (set, dirs, cache, blanks, file, force, 0); + return FcFileScanConfig (set, dirs, blanks, file, NULL); } /* * Strcmp helper that takes pointers to pointers, copied from qsort(3) manpage */ - static int cmpstringp(const void *p1, const void *p2) { @@ -179,54 +130,32 @@ cmpstringp(const void *p1, const void *p2) } /* - * Scan 'dir', adding font files to 'set' and - * subdirectories to 'dirs' + * Scan the specified directory and construct a cache of its contents */ - -FcBool -FcDirScanConfig (FcFontSet *set, - FcStrSet *dirs, - FcGlobalCache *cache, - FcBlanks *blanks, - const FcChar8 *dir, - FcBool force, - FcConfig *config) +FcCache * +FcDirCacheScan (const FcChar8 *dir, FcConfig *config) { DIR *d; struct dirent *e; - FcChar8 **dirlist; - int dirlistlen, dirlistalloc; + FcStrSet *files; + FcStrSet *dirs; FcChar8 *file; FcChar8 *base; FcBool ret = FcTrue; + FcFontSet *set; int i; + FcBlanks *blanks = FcConfigGetBlanks (config); + FcCache *cache = NULL; - if (config && !FcConfigAcceptFilename (config, dir)) - return FcTrue; + if (FcDebug () & FC_DBG_FONTSET) + printf ("cache scan dir %s\n", dir); - if (!force) - { - /* - * Check fonts.cache- file - */ - if (FcDirCacheReadDir (set, dirs, dir, config)) - { - if (cache) - FcGlobalCacheReferenceSubdir (cache, dir); - return FcTrue; - } - - /* - * Check ~/.fonts.cache- file - */ - if (cache && FcGlobalCacheScanDir (set, dirs, cache, dir, config)) - return FcTrue; - } - /* freed below */ file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1); - if (!file) - return FcFalse; + if (!file) { + ret = FcFalse; + goto bail; + } strcpy ((char *) file, (char *) dir); strcat ((char *) file, "/"); @@ -236,74 +165,130 @@ FcDirScanConfig (FcFontSet *set, printf ("\tScanning dir %s\n", dir); d = opendir ((char *) dir); - if (!d) { - free (file); /* Don't complain about missing directories */ if (errno == ENOENT) - return FcTrue; - return FcFalse; + ret = FcTrue; + else + ret = FcFalse; + goto bail_1; + } + + set = FcFontSetCreate(); + if (!set) + { + ret = FcFalse; + goto bail0; + } + + files = FcStrSetCreate (); + if (!files) + { + ret = FcFalse; + goto bail1; } - dirlistlen = 0; - dirlistalloc = 8; - dirlist = malloc(dirlistalloc * sizeof(FcChar8 *)); - if (!dirlist) - return FcFalse; while ((e = readdir (d))) { if (e->d_name[0] != '.' && strlen (e->d_name) < FC_MAX_FILE_LEN) { - if (dirlistlen == dirlistalloc) - { - dirlistalloc *= 2; - dirlist = realloc(dirlist, dirlistalloc * sizeof(FcChar8 *)); - if (!dirlist) - return FcFalse; + strcpy ((char *) base, (char *) e->d_name); + if (!FcStrSetAdd (files, file)) { + ret = FcFalse; + goto bail2; } - dirlist[dirlistlen] = malloc(strlen (e->d_name) + 1); - if (!dirlist[dirlistlen]) - return FcFalse; - strcpy(dirlist[dirlistlen], e->d_name); - dirlistlen++; } } - qsort(dirlist, dirlistlen, sizeof(FcChar8 *), cmpstringp); - i = 0; - while (ret && i < dirlistlen) - { - strcpy ((char *) base, (char *) dirlist[i]); - ret = FcFileScanConfig (set, dirs, cache, blanks, file, force, config); - i++; - } - for (i = 0; i < dirlistlen; i++) - free(dirlist[i]); - free (dirlist); - free (file); - closedir (d); + /* - * Now that the directory has been scanned, - * add the cache entry + * Sort files to make things prettier */ - if (ret && cache) - FcGlobalCacheUpdate (cache, dir, 0, 0); - - return ret; + qsort(files->strs, files->num, sizeof(FcChar8 *), cmpstringp); + + dirs = FcStrSetCreate (); + if (!dirs) + goto bail2; + + /* + * Scan file files to build font patterns + */ + for (i = 0; i < files->num; i++) + FcFileScanConfig (set, dirs, blanks, files->strs[i], config); + + /* + * Build the cache object + */ + cache = FcDirCacheBuild (set, dir, dirs); + if (!cache) + goto bail3; + + /* + * Write out the cache file, ignoring any troubles + */ + FcDirCacheWrite (cache, config); + + bail3: + FcStrSetDestroy (dirs); + bail2: + FcStrSetDestroy (files); + bail1: + FcFontSetDestroy (set); + + bail0: + closedir (d); + + bail_1: + free (file); + bail: + return cache; +} + +/* + * Read (or construct) the cache for a directory + */ +FcCache * +FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config) +{ + FcCache *cache = NULL; + + if (config && !FcConfigAcceptFilename (config, dir)) + return NULL; + + /* Try to use existing cache file */ + if (!force) + cache = FcDirCacheLoad (dir, config, NULL); + + /* Not using existing cache file, construct new cache */ + if (!cache) + cache = FcDirCacheScan (dir, config); + + return cache; +} + +FcBool +FcDirScanConfig (FcFontSet *set, + FcStrSet *dirs, + FcBlanks *blanks, + const FcChar8 *dir, + FcBool force, + FcConfig *config) +{ + return FcFalse; /* XXX fixme */ } FcBool FcDirScan (FcFontSet *set, FcStrSet *dirs, - FcGlobalCache *cache, + FcFileCache *cache, /* XXX unused */ FcBlanks *blanks, const FcChar8 *dir, FcBool force) { - return FcDirScanConfig (set, dirs, cache, blanks, dir, force, 0); + return FcDirScanConfig (set, dirs, blanks, dir, force, NULL); } FcBool -FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) +FcDirSave (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir) { - return FcDirCacheWriteDir (set, dirs, dir); + return FcFalse; /* XXX deprecated */ } diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 979a173..3cf1686 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -44,34 +44,27 @@ THE SOFTWARE. */ +#include "fcint.h" #include #include #include -#include "fcint.h" #include #include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H #include FT_TRUETYPE_TABLES_H #include FT_SFNT_NAMES_H #include FT_TRUETYPE_IDS_H #include FT_TYPE1_TABLES_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_TRUETYPE_TYPES_H #if HAVE_FT_GET_X11_FONT_FORMAT #include FT_XFREE86_H #endif - #if HAVE_FT_GET_BDF_PROPERTY #include FT_BDF_H #include FT_MODULE_H -#define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \ - (f)->driver->root.clazz->get_interface) -#define MY_Get_BDF_Property(f,n,p) (HAS_BDF_PROPERTY(f) ? \ - FT_Get_BDF_Property(f,n,p) : \ - FT_Err_Invalid_Argument) #endif +#include "ftglue.h" + +#if HAVE_WARNING_CPP_DIRECTIVE #if !HAVE_FT_GET_BDF_PROPERTY #warning "No FT_Get_BDF_Property: Please install freetype 2.1.4 or later" #endif @@ -79,6 +72,7 @@ #if !HAVE_FT_GET_PS_FONT_INFO #warning "No FT_Get_PS_Font_Info: Please install freetype 2.1.1 or later" #endif +#endif /* * Keep Han languages separated by eliminating languages @@ -95,7 +89,7 @@ static const struct { { 20, (const FcChar8 *) "zh-tw" }, }; -#define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0]) +#define NUM_CODE_PAGE_RANGE (int) (sizeof FcCodePageRange / sizeof FcCodePageRange[0]) FcBool FcFreeTypeIsExclusiveLang (const FcChar8 *lang) @@ -104,16 +98,16 @@ FcFreeTypeIsExclusiveLang (const FcChar8 *lang) for (i = 0; i < NUM_CODE_PAGE_RANGE; i++) { - if (FcLangCompare (lang, FcCodePageRange[i].lang) != FcLangDifferentLang) + if (FcLangCompare (lang, FcCodePageRange[i].lang) == FcLangEqual) return FcTrue; } return FcFalse; } typedef struct { - FT_UShort platform_id; - FT_UShort encoding_id; - char *fromcode; + const FT_UShort platform_id; + const FT_UShort encoding_id; + const char fromcode[12]; } FcFtEncoding; #define TT_ENCODING_DONT_CARE 0xffff @@ -135,18 +129,18 @@ static const FcFtEncoding fcFtEncoding[] = { { TT_PLATFORM_ISO, TT_ISO_ID_8859_1, "ISO-8859-1" }, }; -#define NUM_FC_FT_ENCODING (sizeof (fcFtEncoding) / sizeof (fcFtEncoding[0])) +#define NUM_FC_FT_ENCODING (int) (sizeof (fcFtEncoding) / sizeof (fcFtEncoding[0])) typedef struct { - FT_UShort platform_id; - FT_UShort language_id; - char *lang; + const FT_UShort platform_id; + const FT_UShort language_id; + const char lang[8]; } FcFtLanguage; #define TT_LANGUAGE_DONT_CARE 0xffff static const FcFtLanguage fcFtLanguage[] = { - { TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE, 0 }, + { TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE, "" }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ENGLISH, "en" }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FRENCH, "fr" }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GERMAN, "de" }, @@ -545,11 +539,11 @@ static const FcFtLanguage fcFtLanguage[] = { { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES,"pap" }, }; -#define NUM_FC_FT_LANGUAGE (sizeof (fcFtLanguage) / sizeof (fcFtLanguage[0])) +#define NUM_FC_FT_LANGUAGE (int) (sizeof (fcFtLanguage) / sizeof (fcFtLanguage[0])) typedef struct { FT_UShort language_id; - char *fromcode; + char fromcode[12]; } FcMacRomanFake; static const FcMacRomanFake fcMacRomanFake[] = { @@ -560,18 +554,39 @@ static const FcMacRomanFake fcMacRomanFake[] = { static FcChar8 * FcFontCapabilities(FT_Face face); -#define NUM_FC_MAC_ROMAN_FAKE (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0])) +#define NUM_FC_MAC_ROMAN_FAKE (int) (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0])) -#if HAVE_ICONV && HAVE_ICONV_H -#define USE_ICONV 1 +#if USE_ICONV #include #endif +/* + * A shift-JIS will have many high bits turned on + */ +static FcBool +FcLooksLikeSJIS (FcChar8 *string, int len) +{ + int nhigh = 0, nlow = 0; + + while (len-- > 0) + { + if (*string++ & 0x80) nhigh++; + else nlow++; + } + /* + * Heuristic -- if more than 1/3 of the bytes have the high-bit set, + * this is likely to be SJIS and not ROMAN + */ + if (nhigh * 2 > nlow) + return FcTrue; + return FcFalse; +} + static FcChar8 * FcSfntNameTranscode (FT_SfntName *sname) { - int i; - char *fromcode; + int i; + const char *fromcode; #if USE_ICONV iconv_t cd; #endif @@ -587,24 +602,35 @@ FcSfntNameTranscode (FT_SfntName *sname) fromcode = fcFtEncoding[i].fromcode; /* - * "real" Mac language IDs are all less than 150. - * Names using one of the MS language IDs are assumed - * to use an associated encoding (Yes, this is a kludge) + * Many names encoded for TT_PLATFORM_MACINTOSH are broken + * in various ways. Kludge around them. */ - if (!strcmp (fromcode, FC_ENCODING_MAC_ROMAN) && - sname->language_id >= 0x100) + if (!strcmp (fromcode, FC_ENCODING_MAC_ROMAN)) { - int f; + if (sname->language_id == TT_MAC_LANGID_ENGLISH && + FcLooksLikeSJIS (sname->string, sname->string_len)) + { + fromcode = "SJIS"; + } + else if (sname->language_id >= 0x100) + { + /* + * "real" Mac language IDs are all less than 150. + * Names using one of the MS language IDs are assumed + * to use an associated encoding (Yes, this is a kludge) + */ + int f; - fromcode = 0; - for (f = 0; f < NUM_FC_MAC_ROMAN_FAKE; f++) - if (fcMacRomanFake[f].language_id == sname->language_id) - { - fromcode = fcMacRomanFake[f].fromcode; - break; - } - if (!fromcode) - return 0; + fromcode = NULL; + for (f = 0; f < NUM_FC_MAC_ROMAN_FAKE; f++) + if (fcMacRomanFake[f].language_id == sname->language_id) + { + fromcode = fcMacRomanFake[f].fromcode; + break; + } + if (!fromcode) + return 0; + } } if (!strcmp (fromcode, "UCS-2BE") || !strcmp (fromcode, "UTF-16BE")) { @@ -741,15 +767,34 @@ done: return utf8; } -static FcChar8 * +static const FcChar8 * FcSfntNameLanguage (FT_SfntName *sname) { int i; + FT_UShort platform_id = sname->platform_id; + FT_UShort language_id = sname->language_id; + + /* + * Many names encoded for TT_PLATFORM_MACINTOSH are broken + * in various ways. Kludge around them. + */ + if (platform_id == TT_PLATFORM_MACINTOSH && + sname->encoding_id == TT_MAC_ID_ROMAN && + FcLooksLikeSJIS (sname->string, sname->string_len)) + { + language_id = TT_MAC_LANGID_JAPANESE; + } + for (i = 0; i < NUM_FC_FT_LANGUAGE; i++) - if (fcFtLanguage[i].platform_id == sname->platform_id && + if (fcFtLanguage[i].platform_id == platform_id && (fcFtLanguage[i].language_id == TT_LANGUAGE_DONT_CARE || - fcFtLanguage[i].language_id == sname->language_id)) - return (FcChar8 *) fcFtLanguage[i].lang; + fcFtLanguage[i].language_id == language_id)) + { + if (fcFtLanguage[i].lang[0] == '\0') + return NULL; + else + return (FcChar8 *) fcFtLanguage[i].lang; + } return 0; } @@ -781,7 +826,7 @@ static const struct { (const FcChar8 *) "hanyang" } }; -#define NUM_NOTICE_FOUNDRIES (sizeof (FcNoticeFoundries) / sizeof (FcNoticeFoundries[0])) +#define NUM_NOTICE_FOUNDRIES (int) (sizeof (FcNoticeFoundries) / sizeof (FcNoticeFoundries[0])) static const FcChar8 * FcNoticeFoundry(const FT_String *notice) @@ -850,7 +895,7 @@ static const struct { { (const FT_Char *) "Y&Y", (const FcChar8 *) "y&y"} }; -#define NUM_VENDOR_FOUNDRIES (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0])) +#define NUM_VENDOR_FOUNDRIES (int) (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0])) static const FcChar8 * FcVendorFoundry(const FT_Char vendor[4]) @@ -909,14 +954,15 @@ static const FcStringConst weightConsts[] = { { (FC8) "demibold", FC_WEIGHT_DEMIBOLD }, { (FC8) "demi", FC_WEIGHT_DEMIBOLD }, { (FC8) "semibold", FC_WEIGHT_SEMIBOLD }, - { (FC8) "bold", FC_WEIGHT_BOLD }, { (FC8) "extrabold", FC_WEIGHT_EXTRABOLD }, + { (FC8) "superbold", FC_WEIGHT_EXTRABOLD }, { (FC8) "ultrabold", FC_WEIGHT_ULTRABOLD }, + { (FC8) "bold", FC_WEIGHT_BOLD }, { (FC8) "black", FC_WEIGHT_BLACK }, { (FC8) "heavy", FC_WEIGHT_HEAVY }, }; -#define NUM_WEIGHT_CONSTS (sizeof (weightConsts) / sizeof (weightConsts[0])) +#define NUM_WEIGHT_CONSTS (int) (sizeof (weightConsts) / sizeof (weightConsts[0])) #define FcIsWeight(s) FcStringIsConst(s,weightConsts,NUM_WEIGHT_CONSTS) #define FcContainsWeight(s) FcStringContainsConst (s,weightConsts,NUM_WEIGHT_CONSTS) @@ -933,21 +979,36 @@ static const FcStringConst widthConsts[] = { { (FC8) "expanded", FC_WIDTH_EXPANDED }, /* must be after *expanded */ }; -#define NUM_WIDTH_CONSTS (sizeof (widthConsts) / sizeof (widthConsts[0])) +#define NUM_WIDTH_CONSTS (int) (sizeof (widthConsts) / sizeof (widthConsts[0])) #define FcIsWidth(s) FcStringIsConst(s,widthConsts,NUM_WIDTH_CONSTS) #define FcContainsWidth(s) FcStringContainsConst (s,widthConsts,NUM_WIDTH_CONSTS) static const FcStringConst slantConsts[] = { { (FC8) "italic", FC_SLANT_ITALIC }, + { (FC8) "kursiv", FC_SLANT_ITALIC }, { (FC8) "oblique", FC_SLANT_OBLIQUE }, }; -#define NUM_SLANT_CONSTS (sizeof (slantConsts) / sizeof (slantConsts[0])) +#define NUM_SLANT_CONSTS (int) (sizeof (slantConsts) / sizeof (slantConsts[0])) #define FcIsSlant(s) FcStringIsConst(s,slantConsts,NUM_SLANT_CONSTS) #define FcContainsSlant(s) FcStringContainsConst (s,slantConsts,NUM_SLANT_CONSTS) +static const FcStringConst decorativeConsts[] = { + { (FC8) "shadow", FcTrue }, + { (FC8) "smallcaps", FcTrue }, + { (FC8) "antiqua", FcTrue }, + { (FC8) "romansc", FcTrue }, + { (FC8) "embosed", FcTrue }, + { (FC8) "romansmallcaps", FcTrue }, +}; + +#define NUM_DECORATIVE_CONSTS (int) (sizeof (decorativeConsts) / sizeof (decorativeConsts[0])) + +#define FcIsDecorative(s) FcStringIsConst(s,decorativeConsts,NUM_DECORATIVE_CONSTS) +#define FcContainsDecorative(s) FcStringContainsConst (s,decorativeConsts,NUM_DECORATIVE_CONSTS) + static double FcGetPixelSize (FT_Face face, int i) { @@ -957,7 +1018,7 @@ FcGetPixelSize (FT_Face face, int i) BDF_PropertyRec prop; int rc; - rc = MY_Get_BDF_Property (face, "PIXEL_SIZE", &prop); + rc = FT_Get_BDF_Property (face, "PIXEL_SIZE", &prop); if (rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) return (double) prop.u.integer; } @@ -970,7 +1031,7 @@ FcGetPixelSize (FT_Face face, int i) } static FcBool -FcStringInPatternElement (FcPattern *pat, char *elt, FcChar8 *string) +FcStringInPatternElement (FcPattern *pat, const char *elt, FcChar8 *string) { int e; FcChar8 *old; @@ -978,7 +1039,6 @@ FcStringInPatternElement (FcPattern *pat, char *elt, FcChar8 *string) if (!FcStrCmpIgnoreBlanksAndCase (old, string)) { return FcTrue; - break; } return FcFalse; } @@ -994,6 +1054,7 @@ FcFreeTypeQuery (const FcChar8 *file, int slant = -1; int weight = -1; int width = -1; + FcBool decorative = FcFalse; int i; FcCharSet *cs; FcLangSet *ls; @@ -1074,8 +1135,8 @@ FcFreeTypeQuery (const FcChar8 *file, for (snamei = 0; snamei < snamec; snamei++) { FcChar8 *utf8; - FcChar8 *lang; - char *elt = 0, *eltlang = 0; + const FcChar8 *lang; + const char *elt = 0, *eltlang = 0; int *np = 0, *nlangp = 0; if (FT_Get_Sfnt_Name (face, snamei, &sname) != 0) @@ -1223,7 +1284,7 @@ FcFreeTypeQuery (const FcChar8 *file, * or which are simply a FC_FAMILY and FC_STYLE glued together */ { - int fn, fa, st; + int fn, fa; FcChar8 *full; FcChar8 *fam; FcChar8 *style; @@ -1369,6 +1430,9 @@ FcFreeTypeQuery (const FcChar8 *file, weight = FC_WEIGHT_EXTRABOLD; else if (os2->usWeightClass < 950) weight = FC_WEIGHT_BLACK; + if ((FcDebug() & FC_DBG_SCANV) && weight != -1) + printf ("\tos2 weight class %d maps to weight %d\n", + os2->usWeightClass, weight); switch (os2->usWidthClass) { case 1: width = FC_WIDTH_ULTRACONDENSED; break; @@ -1381,6 +1445,9 @@ FcFreeTypeQuery (const FcChar8 *file, case 8: width = FC_WIDTH_EXTRAEXPANDED; break; case 9: width = FC_WIDTH_ULTRAEXPANDED; break; } + if ((FcDebug() & FC_DBG_SCANV) && width != -1) + printf ("\tos2 width class %d maps to width %d\n", + os2->usWidthClass, width); } if (os2 && (complex = FcFontCapabilities(face))) { @@ -1433,15 +1500,14 @@ FcFreeTypeQuery (const FcChar8 *file, if (!foundry) { int rc; - BDF_PropertyRec prop; - rc = MY_Get_BDF_Property(face, "FOUNDRY", &prop); + rc = FT_Get_BDF_Property(face, "FOUNDRY", &prop); if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) foundry = (FcChar8 *) prop.u.atom; } if (width == -1) { - if (MY_Get_BDF_Property(face, "RELATIVE_SETWIDTH", &prop) == 0 && + if (FT_Get_BDF_Property(face, "RELATIVE_SETWIDTH", &prop) == 0 && (prop.type == BDF_PROPERTY_TYPE_INTEGER || prop.type == BDF_PROPERTY_TYPE_CARDINAL)) { @@ -1464,7 +1530,7 @@ FcFreeTypeQuery (const FcChar8 *file, } } if (width == -1 && - MY_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 && + FT_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { width = FcIsWidth ((FcChar8 *) prop.u.atom); @@ -1497,6 +1563,12 @@ FcFreeTypeQuery (const FcChar8 *file, if (FcDebug() & FC_DBG_SCANV) printf ("\tStyle %s maps to slant %d\n", style, slant); } + if (decorative == FcFalse) + { + decorative = FcContainsDecorative (style) > 0; + if (FcDebug() & FC_DBG_SCANV) + printf ("\tStyle %s maps to decorative %d\n", style, decorative); + } } /* * Pull default values from the FreeType flags if more @@ -1534,6 +1606,9 @@ FcFreeTypeQuery (const FcChar8 *file, if (!FcPatternAddString (pat, FC_FOUNDRY, foundry)) goto bail1; + if (!FcPatternAddBool (pat, FC_DECORATIVE, decorative)) + goto bail1; + /* * Compute the unicode coverage for the font */ @@ -1544,7 +1619,7 @@ FcFreeTypeQuery (const FcChar8 *file, #if HAVE_FT_GET_BDF_PROPERTY /* For PCF fonts, override the computed spacing with the one from the property */ - if(MY_Get_BDF_Property(face, "SPACING", &prop) == 0 && + if(FT_Get_BDF_Property(face, "SPACING", &prop) == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { if(!strcmp(prop.u.atom, "c") || !strcmp(prop.u.atom, "C")) spacing = FC_CHARCELL; @@ -1558,11 +1633,16 @@ FcFreeTypeQuery (const FcChar8 *file, /* * Skip over PCF fonts that have no encoded characters; they're * usually just Unicode fonts transcoded to some legacy encoding + * ftglue.c forces us to approximate whether a font is a PCF font + * or not by whether it has any BDF properties. Try PIXEL_SIZE; + * I don't know how to get a list of BDF properties on the font. -PL */ if (FcCharSetCount (cs) == 0) { - if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf")) +#if HAVE_FT_GET_BDF_PROPERTY + if(FT_Get_BDF_Property(face, "PIXEL_SIZE", &prop) == 0) goto bail2; +#endif } if (!FcPatternAddCharSet (pat, FC_CHARSET, cs)) @@ -1589,16 +1669,20 @@ FcFreeTypeQuery (const FcChar8 *file, for (i = 0; i < face->num_fixed_sizes; i++) if (!FcPatternAddDouble (pat, FC_PIXEL_SIZE, FcGetPixelSize (face, i))) - goto bail1; + goto bail2; if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse)) - goto bail1; + goto bail2; #if HAVE_FT_GET_BDF_PROPERTY if(face->num_fixed_sizes == 1) { int rc; int value; - BDF_PropertyRec prop; - rc = MY_Get_BDF_Property(face, "POINT_SIZE", &prop); + /* skip bitmap fonts which do not even have a family name */ + rc = FT_Get_BDF_Property(face, "FAMILY_NAME", &prop); + if (rc != 0 || prop.type != BDF_PROPERTY_TYPE_ATOM) + goto bail2; + + rc = FT_Get_BDF_Property(face, "POINT_SIZE", &prop); if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) value = prop.u.integer; else if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_CARDINAL) @@ -1608,7 +1692,7 @@ FcFreeTypeQuery (const FcChar8 *file, if(!FcPatternAddDouble(pat, FC_SIZE, value / 10.0)) goto nevermind; - rc = MY_Get_BDF_Property(face, "RESOLUTION_Y", &prop); + rc = FT_Get_BDF_Property(face, "RESOLUTION_Y", &prop); if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) value = prop.u.integer; else if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_CARDINAL) @@ -2125,13 +2209,13 @@ static const FcFontDecode fcFontDecoders[] = { { ft_encoding_apple_roman, &AppleRoman, (1 << 16) - 1 }, }; -#define NUM_DECODE (sizeof (fcFontDecoders) / sizeof (fcFontDecoders[0])) +#define NUM_DECODE (int) (sizeof (fcFontDecoders) / sizeof (fcFontDecoders[0])) static const FcChar32 prefer_unicode[] = { 0x20ac, /* EURO SIGN */ }; -#define NUM_PREFER_UNICODE (sizeof (prefer_unicode) / sizeof (prefer_unicode[0])) +#define NUM_PREFER_UNICODE (int) (sizeof (prefer_unicode) / sizeof (prefer_unicode[0])) FcChar32 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map) @@ -2212,12 +2296,12 @@ FcFreeTypeUseNames (FT_Face face) return FcFalse; } -static FcChar8 * +static const FcChar8 * FcUcs4ToGlyphName (FcChar32 ucs4) { int i = (int) (ucs4 % FC_GLYPHNAME_HASH); int r = 0; - FcGlyphName *gn; + const FcGlyphName *gn; while ((gn = ucs_to_name[i])) { @@ -2242,7 +2326,7 @@ FcGlyphNameToUcs4 (FcChar8 *name) FcChar32 h = FcHashGlyphName (name); int i = (int) (h % FC_GLYPHNAME_HASH); int r = 0; - FcGlyphName *gn; + const FcGlyphName *gn; while ((gn = name_to_ucs[i])) { @@ -2267,12 +2351,12 @@ FcGlyphNameToUcs4 (FcChar8 *name) * any defined order within the font */ static FT_UInt -FcFreeTypeGlyphNameIndex (FT_Face face, FcChar8 *name) +FcFreeTypeGlyphNameIndex (FT_Face face, const FcChar8 *name) { FT_UInt gindex; FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2]; - for (gindex = 0; gindex < face->num_glyphs; gindex++) + for (gindex = 0; gindex < (FT_UInt) face->num_glyphs; gindex++) { if (FT_Get_Glyph_Name (face, gindex, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0) if (!strcmp ((char *) name, (char *) name_buf)) @@ -2297,6 +2381,10 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4) int p; initial = 0; + + if (!face) + return 0; + /* * Find the current encoding */ @@ -2326,7 +2414,7 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4) if (fcFontDecoders[decode].map) { charcode = FcFreeTypeUcs4ToPrivate (ucs4, fcFontDecoders[decode].map); - if (charcode == ~0) + if (charcode == ~0U) continue; } else @@ -2341,7 +2429,7 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4) */ if (FcFreeTypeUseNames (face)) { - FcChar8 *name = FcUcs4ToGlyphName (ucs4); + const FcChar8 *name = FcUcs4ToGlyphName (ucs4); if (name) { glyphindex = FcFreeTypeGlyphNameIndex (face, name); @@ -2417,7 +2505,7 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4, FcCharSet * FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) { - FcChar32 page, off, max, ucs4; + FcChar32 page, off, ucs4; #ifdef CHECK FcChar32 font_max = 0; #endif @@ -2498,7 +2586,6 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) { FT_UInt gindex; - max = fcFontDecoders[o].max; /* * Find the first encoded character in the font */ @@ -2586,7 +2673,7 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) { FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2]; - for (glyph = 0; glyph < face->num_glyphs; glyph++) + for (glyph = 0; glyph < (FT_UInt) face->num_glyphs; glyph++) { if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0) { @@ -2726,68 +2813,68 @@ static FT_Error GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *script_count) { FT_ULong cur_offset, new_offset, base_offset; - TT_Face tt_face = (TT_Face)face; FT_Stream stream = face->stream; FT_Error error; FT_UShort n, p; - FT_Memory memory = stream->memory; + FT_Memory memory; if ( !stream ) return TT_Err_Invalid_Face_Handle; - if (( error = tt_face->goto_table( tt_face, tabletag, stream, 0 ) )) + memory = stream->memory; + + if (( error = ftglue_face_goto_table( face, tabletag, stream ) )) return error; - base_offset = FT_STREAM_POS(); + base_offset = ftglue_stream_pos ( stream ); /* skip version */ - if ( FT_STREAM_SEEK( base_offset + 4L ) || FT_FRAME_ENTER( 2L ) ) + if ( ftglue_stream_seek ( stream, base_offset + 4L ) || ftglue_stream_frame_enter( stream, 2L ) ) return error; - new_offset = FT_GET_USHORT() + base_offset; + new_offset = GET_UShort() + base_offset; - FT_FRAME_EXIT(); + ftglue_stream_frame_exit( stream ); - cur_offset = FT_STREAM_POS(); + cur_offset = ftglue_stream_pos( stream ); - if ( FT_STREAM_SEEK( new_offset ) != TT_Err_Ok ) + if ( ftglue_stream_seek( stream, new_offset ) != TT_Err_Ok ) return error; - base_offset = FT_STREAM_POS(); + base_offset = ftglue_stream_pos( stream ); - if ( FT_FRAME_ENTER( 2L ) ) + if ( ftglue_stream_frame_enter( stream, 2L ) ) return error; - *script_count = FT_GET_USHORT(); + *script_count = GET_UShort (); + + ftglue_stream_frame_exit( stream ); - FT_FRAME_EXIT(); + *stags = ftglue_alloc(memory, *script_count * sizeof( FT_ULong ), &error); - if ( FT_SET_ERROR (FT_MEM_ALLOC_ARRAY( *stags, *script_count, FT_ULong )) ) + if (error) return error; p = 0; for ( n = 0; n < *script_count; n++ ) { - if ( FT_FRAME_ENTER( 6L ) ) + if ( ftglue_stream_frame_enter( stream, 6L ) ) goto Fail; - (*stags)[p] = FT_GET_ULONG(); - new_offset = FT_GET_USHORT() + base_offset; + (*stags)[p] = GET_ULong (); + new_offset = GET_UShort () + base_offset; - FT_FRAME_EXIT(); + ftglue_stream_frame_exit( stream ); - cur_offset = FT_STREAM_POS(); + cur_offset = ftglue_stream_pos( stream ); - if ( FT_STREAM_SEEK( new_offset ) ) - goto Fail; + error = ftglue_stream_seek( stream, new_offset ); if ( error == TT_Err_Ok ) p++; - else if ( error != TTO_Err_Empty_Script ) - goto Fail; - (void)FT_STREAM_SEEK( cur_offset ); + (void)ftglue_stream_seek( stream, cur_offset ); } if (!p) @@ -2796,14 +2883,15 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *scri goto Fail; } - // sort the tag list before returning it + /* sort the tag list before returning it */ qsort(*stags, *script_count, sizeof(FT_ULong), compareulong); return TT_Err_Ok; Fail: *script_count = 0; - FT_FREE( *stags ); + ftglue_free( memory, *stags ); + *stags = NULL; return error; } @@ -2860,7 +2948,7 @@ FcFontCapabilities(FT_Face face) if (FcDebug () & FC_DBG_SCANV) printf("complex features in this font: %s\n", complex); bail: - FT_FREE(gsubtags); - FT_FREE(gpostags); + ftglue_free(memory, gsubtags); + ftglue_free(memory, gpostags); return complex; } diff --git a/src/fcfs.c b/src/fcfs.c index b05688d..e9b2d07 100644 --- a/src/fcfs.c +++ b/src/fcfs.c @@ -22,8 +22,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include #include "fcint.h" +#include FcFontSet * FcFontSetCreate (void) @@ -80,3 +80,53 @@ FcFontSetAdd (FcFontSet *s, FcPattern *font) s->fonts[s->nfont++] = font; return FcTrue; } + +FcBool +FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s) +{ + int i; + + if (!FcSerializeAlloc (serialize, s, sizeof (FcFontSet))) + return FcFalse; + if (!FcSerializeAlloc (serialize, s->fonts, s->nfont * sizeof (FcPattern *))) + return FcFalse; + for (i = 0; i < s->nfont; i++) + { + if (!FcPatternSerializeAlloc (serialize, s->fonts[i])) + return FcFalse; + } + return FcTrue; +} + +FcFontSet * +FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s) +{ + int i; + FcFontSet *s_serialize; + FcPattern **fonts_serialize; + FcPattern *p_serialize; + + s_serialize = FcSerializePtr (serialize, s); + if (!s_serialize) + return NULL; + *s_serialize = *s; + s_serialize->sfont = s_serialize->nfont; + + fonts_serialize = FcSerializePtr (serialize, s->fonts); + if (!fonts_serialize) + return NULL; + s_serialize->fonts = FcPtrToEncodedOffset (s_serialize, + fonts_serialize, FcPattern *); + + for (i = 0; i < s->nfont; i++) + { + p_serialize = FcPatternSerialize (serialize, s->fonts[i]); + if (!p_serialize) + return NULL; + fonts_serialize[i] = FcPtrToEncodedOffset (s_serialize, + p_serialize, + FcPattern); + } + + return s_serialize; +} diff --git a/src/fcinit.c b/src/fcinit.c index 8a9bdbd..65702b4 100644 --- a/src/fcinit.c +++ b/src/fcinit.c @@ -22,8 +22,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include #include "fcint.h" +#include static FcConfig * FcInitFallbackConfig (void) @@ -35,6 +35,8 @@ FcInitFallbackConfig (void) goto bail0; if (!FcConfigAddDir (config, (FcChar8 *) FC_DEFAULT_FONTS)) goto bail1; + if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR)) + goto bail1; return config; bail1: @@ -57,6 +59,7 @@ FcInitLoadConfig (void) { FcConfig *config; + FcInitDebug (); config = FcConfigCreate (); if (!config) return FcFalse; @@ -78,6 +81,7 @@ FcInitLoadConfigAndFonts (void) { FcConfig *config = FcInitLoadConfig (); + FcInitDebug (); if (!config) return 0; if (!FcConfigBuildFonts (config)) @@ -117,7 +121,6 @@ FcFini (void) FcConfigDestroy (_fcConfig); FcPatternFini (); - FcCharSetThawAll (); } /* @@ -161,7 +164,7 @@ FcInitBringUptoDate (void) } static struct { - char *name; + char name[16]; int alloc_count; int alloc_mem; int free_count; @@ -206,9 +209,6 @@ static int FcMemNotice = 1*1024*1024; static int FcAllocNotify, FcFreeNotify; -void -FcValueListReport (void); - void FcMemReport (void) { @@ -231,7 +231,6 @@ FcMemReport (void) FcAllocMem - FcFreeMem); FcAllocNotify = 0; FcFreeNotify = 0; - FcValueListReport (); } void diff --git a/src/fcint.h b/src/fcint.h index 3611df9..3b9f3c8 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -25,8 +25,19 @@ #ifndef _FCINT_H_ #define _FCINT_H_ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include +#ifdef HAVE_INTTYPES_H +#include +#elif defined(HAVE_STDINT_H) +#include +#else +#error missing C99 integer data types +#endif #include #include #include @@ -37,14 +48,6 @@ #include #include #include -#ifdef HAVE_CONFIG_H -#include -#endif - -typedef struct _FcSymbolic { - const char *name; - int value; -} FcSymbolic; #ifndef FC_CONFIG_PATH #define FC_CONFIG_PATH "fonts.conf" @@ -70,6 +73,8 @@ typedef struct _FcSymbolic { #define FC_DBG_SCANV 256 #define FC_DBG_MEMORY 512 #define FC_DBG_CONFIG 1024 +#define FC_DBG_LANGSET 2048 +#define FC_DBG_OBJTYPES 4096 #define FC_MEM_CHARSET 0 #define FC_MEM_CHARLEAF 1 @@ -104,29 +109,103 @@ typedef struct _FcSymbolic { #define FC_MEM_NUM 30 +#define FC_BANK_DYNAMIC 0 +#define FC_BANK_FIRST 1 +#define FC_BANK_LANGS 0xfcfcfcfc + typedef enum _FcValueBinding { FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame } FcValueBinding; +/* + * Serialized data structures use only offsets instead of pointers + * A low bit of 1 indicates an offset. + */ + +/* Is the provided pointer actually an offset? */ +#define FcIsEncodedOffset(p) ((((intptr_t) (p)) & 1) != 0) + +/* Encode offset in a pointer of type t */ +#define FcOffsetEncode(o,t) ((t *) ((o) | 1)) + +/* Decode a pointer into an offset */ +#define FcOffsetDecode(p) (((intptr_t) (p)) & ~1) + +/* Compute pointer offset */ +#define FcPtrToOffset(b,p) ((intptr_t) (p) - (intptr_t) (b)) + +/* Given base address, offset and type, return a pointer */ +#define FcOffsetToPtr(b,o,t) ((t *) ((intptr_t) (b) + (o))) + +/* Given base address, encoded offset and type, return a pointer */ +#define FcEncodedOffsetToPtr(b,p,t) FcOffsetToPtr(b,FcOffsetDecode(p),t) + +/* Given base address, pointer and type, return an encoded offset */ +#define FcPtrToEncodedOffset(b,p,t) FcOffsetEncode(FcPtrToOffset(b,p),t) + +/* Given a structure, offset member and type, return pointer */ +#define FcOffsetMember(s,m,t) FcOffsetToPtr(s,(s)->m,t) + +/* Given a structure, encoded offset member and type, return pointer to member */ +#define FcEncodedOffsetMember(s,m,t) FcOffsetToPtr(s,FcOffsetDecode((s)->m), t) + +/* Given a structure, member and type, convert the member to a pointer */ +#define FcPointerMember(s,m,t) (FcIsEncodedOffset((s)->m) ? \ + FcEncodedOffsetMember (s,m,t) : \ + (s)->m) + +/* + * Serialized values may hold strings, charsets and langsets as pointers, + * unfortunately FcValue is an exposed type so we can't just always use + * offsets + */ +#define FcValueString(v) FcPointerMember(v,u.s,FcChar8) +#define FcValueCharSet(v) FcPointerMember(v,u.c,const FcCharSet) +#define FcValueLangSet(v) FcPointerMember(v,u.l,const FcLangSet) + +typedef struct _FcValueList *FcValueListPtr; + typedef struct _FcValueList { - struct _FcValueList *next; - FcValue value; - FcValueBinding binding; + struct _FcValueList *next; + FcValue value; + FcValueBinding binding; } FcValueList; +#define FcValueListNext(vl) FcPointerMember(vl,next,FcValueList) + +typedef int FcObject; + +typedef struct _FcPatternElt *FcPatternEltPtr; + +/* + * Pattern elts are stuck in a structure connected to the pattern, + * so they get moved around when the pattern is resized. Hence, the + * values field must be a pointer/offset instead of just an offset + */ typedef struct _FcPatternElt { - const char *object; - FcValueList *values; + FcObject object; + FcValueList *values; } FcPatternElt; +#define FcPatternEltValues(pe) FcPointerMember(pe,values,FcValueList) struct _FcPattern { int num; int size; - FcPatternElt *elts; + intptr_t elts_offset; int ref; }; +#define FcPatternElts(p) FcOffsetMember(p,elts_offset,FcPatternElt) + +#define FcFontSetFonts(fs) FcPointerMember(fs,fonts,FcPattern *) + +#define FcFontSetFont(fs,i) (FcIsEncodedOffset((fs)->fonts) ? \ + FcEncodedOffsetToPtr(fs, \ + FcFontSetFonts(fs)[i], \ + FcPattern) : \ + fs->fonts[i]) + typedef enum _FcOp { FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet, FcOpNil, @@ -151,7 +230,7 @@ typedef struct _FcExpr { FcMatrix *mval; FcBool bval; FcCharSet *cval; - char *field; + FcObject object; FcChar8 *constant; struct { struct _FcExpr *left, *right; @@ -169,14 +248,14 @@ typedef struct _FcTest { struct _FcTest *next; FcMatchKind kind; FcQual qual; - const char *field; + FcObject object; FcOp op; FcExpr *expr; } FcTest; typedef struct _FcEdit { struct _FcEdit *next; - const char *field; + FcObject object; FcOp op; FcExpr *expr; FcValueBinding binding; @@ -197,10 +276,16 @@ typedef struct _FcCharLeaf { struct _FcCharSet { int ref; /* reference count */ int num; /* size of leaves and numbers arrays */ - FcCharLeaf **leaves; - FcChar16 *numbers; + intptr_t leaves_offset; + intptr_t numbers_offset; }; +#define FcCharSetLeaves(c) FcOffsetMember(c,leaves_offset,intptr_t) +#define FcCharSetLeaf(c,i) (FcOffsetToPtr(FcCharSetLeaves(c), \ + FcCharSetLeaves(c)[i], \ + FcCharLeaf)) +#define FcCharSetNumbers(c) FcOffsetMember(c,numbers_offset,FcChar16) + struct _FcStrSet { int ref; /* reference count */ int num; @@ -221,6 +306,44 @@ typedef struct _FcStrBuf { int size; } FcStrBuf; +typedef struct _FcCache { + int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */ + int version; /* FC_CACHE_CONTENT_VERSION */ + intptr_t size; /* size of file */ + intptr_t dir; /* offset to dir name */ + intptr_t dirs; /* offset to subdirs */ + int dirs_count; /* number of subdir strings */ + intptr_t set; /* offset to font set */ +} FcCache; + +#define FcCacheDir(c) FcOffsetMember(c,dir,FcChar8) +#define FcCacheDirs(c) FcOffsetMember(c,dirs,intptr_t) +#define FcCacheSet(c) FcOffsetMember(c,set,FcFontSet) +#define FcCacheSubdir(c,i) FcOffsetToPtr (FcCacheDirs(cache),\ + FcCacheDirs(cache)[i], \ + FcChar8) + +/* + * Used while constructing a directory cache object + */ + +#define FC_SERIALIZE_HASH_SIZE 8191 + +typedef struct _FcSerializeBucket { + struct _FcSerializeBucket *next; + const void *object; + intptr_t offset; +} FcSerializeBucket; + +typedef struct _FcCharSetFreezer FcCharSetFreezer; + +typedef struct _FcSerialize { + intptr_t size; + FcCharSetFreezer *cs_freezer; + void *linear; + FcSerializeBucket *buckets[FC_SERIALIZE_HASH_SIZE]; +} FcSerialize; + /* * To map adobe glyph names to unicode values, a precomputed hash * table is used @@ -264,55 +387,18 @@ typedef struct _FcCaseFold { #define FC_MAX_FILE_LEN 4096 -/* - * The per-user ~/.fonts.cache- file is loaded into - * this data structure. Each directory gets a substructure - * which is validated by comparing the directory timestamp with - * that saved in the cache. When valid, the entire directory cache - * can be immediately loaded without reading the directory. Otherwise, - * the files are checked individually; updated files are loaded into the - * cache which is then rewritten to the users home directory - */ +/* XXX remove these when we're ready */ -#define FC_GLOBAL_CACHE_DIR_HASH_SIZE 37 -#define FC_GLOBAL_CACHE_FILE_HASH_SIZE 67 - -typedef struct _FcGlobalCacheInfo { - unsigned int hash; - FcChar8 *file; - time_t time; - FcBool referenced; -} FcGlobalCacheInfo; - -typedef struct _FcGlobalCacheFile { - struct _FcGlobalCacheFile *next; - FcGlobalCacheInfo info; - int id; - FcChar8 *name; -} FcGlobalCacheFile; - -typedef struct _FcGlobalCacheDir FcGlobalCacheDir; - -typedef struct _FcGlobalCacheSubdir { - struct _FcGlobalCacheSubdir *next; - FcGlobalCacheDir *ent; -} FcGlobalCacheSubdir; - -struct _FcGlobalCacheDir { - struct _FcGlobalCacheDir *next; - FcGlobalCacheInfo info; - int len; - FcGlobalCacheFile *ents[FC_GLOBAL_CACHE_FILE_HASH_SIZE]; - FcGlobalCacheSubdir *subdirs; -}; +#define fc_value_string(v) FcValueString(v) +#define fc_value_charset(v) FcValueCharSet(v) +#define fc_value_langset(v) FcValueLangSet(v) +#define fc_storage_type(v) ((v)->type) -typedef struct _FcGlobalCache { - FcGlobalCacheDir *ents[FC_GLOBAL_CACHE_DIR_HASH_SIZE]; - FcBool updated; - FcBool broken; - int entries; - int referenced; -} FcGlobalCache; +#define fc_alignof(type) offsetof (struct { char c; type member; }, member) + +#define FC_CACHE_MAGIC_MMAP 0xFC02FC04 +#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 +#define FC_CACHE_CONTENT_VERSION 1 struct _FcAtomic { FcChar8 *file; /* original file name */ @@ -327,6 +413,11 @@ struct _FcBlanks { FcChar32 *blanks; }; +typedef struct _FcCacheList { + struct _FcCacheList *next; + FcCache *cache; +} FcCacheList; + struct _FcConfig { /* * File names loaded from the configuration -- saved here as the @@ -334,7 +425,6 @@ struct _FcConfig { * and those directives may occur in any order */ FcStrSet *configDirs; /* directories to scan for fonts */ - FcChar8 *cache; /* name of per-user cache file */ /* * Set of allowed blank chars -- used to * trim fonts of bogus glyphs @@ -346,6 +436,10 @@ struct _FcConfig { * of configured directories */ FcStrSet *fontDirs; + /* + * List of directories containing cache files. + */ + FcStrSet *cacheDirs; /* * Names of all of the configuration files used * to create this configuration @@ -358,6 +452,7 @@ struct _FcConfig { */ FcSubst *substPattern; /* substitutions for patterns */ FcSubst *substFont; /* substitutions for fonts */ + FcSubst *substScan; /* substitutions for scanned fonts */ int maxObjects; /* maximum number of tests in all substs */ /* * List of patterns used to control font file selection @@ -373,6 +468,11 @@ struct _FcConfig { * match preferrentially */ FcFontSet *fonts[FcSetApplication + 1]; + /* + * Font cache information is mapped from cache files + * the configuration is destroyed, the files need to be unmapped + */ + FcCacheList *caches; /* * Fontconfig can periodically rescan the system configuration * and font directories. This rescanning occurs when font @@ -385,71 +485,43 @@ struct _FcConfig { extern FcConfig *_fcConfig; +typedef struct _FcFileTime { + time_t time; + FcBool set; +} FcFileTime; + typedef struct _FcCharMap FcCharMap; +/* watch out; assumes that v is void * -PL */ +#define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1))) + /* fcblanks.c */ /* fccache.c */ -FcGlobalCache * -FcGlobalCacheCreate (void); - -void -FcGlobalCacheDestroy (FcGlobalCache *cache); - FcBool -FcGlobalCacheCheckTime (const FcChar8*file, FcGlobalCacheInfo *info); +FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config); void -FcGlobalCacheReferenced (FcGlobalCache *cache, - FcGlobalCacheInfo *info); +FcDirCacheUnload (FcCache *cache); -void -FcGlobalCacheReferenceSubdir (FcGlobalCache *cache, - const FcChar8 *dir); +FcCache * +FcDirCacheScan (const FcChar8 *dir, FcConfig *config); -FcGlobalCacheDir * -FcGlobalCacheDirGet (FcGlobalCache *cache, - const FcChar8 *dir, - int len, - FcBool create_missing); - -FcBool -FcGlobalCacheScanDir (FcFontSet *set, - FcStrSet *dirs, - FcGlobalCache *cache, - const FcChar8 *dir, - FcConfig *config); - -FcGlobalCacheFile * -FcGlobalCacheFileGet (FcGlobalCache *cache, - const FcChar8 *file, - int id, - int *count); - - -void -FcGlobalCacheLoad (FcGlobalCache *cache, - const FcChar8 *cache_file); +FcCache * +FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file); + +FcCache * +FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat); FcBool -FcGlobalCacheUpdate (FcGlobalCache *cache, - const FcChar8 *file, - int id, - const FcChar8 *name); +FcDirCacheValid (const FcChar8 *dir); -FcBool -FcGlobalCacheSave (FcGlobalCache *cache, - const FcChar8 *cache_file); +FcCache * +FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, FcStrSet *dirs); FcBool -FcDirCacheReadDir (FcFontSet *set, - FcStrSet *dirs, - const FcChar8 *dir, - FcConfig *config); - -FcBool -FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir); +FcDirCacheWrite (FcCache *cache, FcConfig *config); /* fccfg.c */ @@ -466,12 +538,15 @@ FcConfigAddDir (FcConfig *config, const FcChar8 *d); FcBool -FcConfigAddConfigFile (FcConfig *config, - const FcChar8 *f); +FcConfigAddCacheDir (FcConfig *config, + const FcChar8 *d); + +FcStrList * +FcConfigGetCacheDirs (FcConfig *config); FcBool -FcConfigSetCache (FcConfig *config, - const FcChar8 *c); +FcConfigAddConfigFile (FcConfig *config, + const FcChar8 *f); FcBool FcConfigAddBlank (FcConfig *config, @@ -489,9 +564,9 @@ FcConfigSetFonts (FcConfig *config, FcSetName set); FcBool -FcConfigCompareValue (const FcValue m, +FcConfigCompareValue (const FcValue *m, FcOp op, - const FcValue v); + const FcValue *v); FcBool FcConfigGlobAdd (FcConfig *config, @@ -511,12 +586,52 @@ FcBool FcConfigAcceptFont (FcConfig *config, const FcPattern *font); +FcFileTime +FcConfigModifiedTime (FcConfig *config); + +FcBool +FcConfigAddCache (FcConfig *config, FcCache *cache); + +/* fcserialize.c */ +intptr_t +FcAlignSize (intptr_t size); + +FcSerialize * +FcSerializeCreate (void); + +void +FcSerializeDestroy (FcSerialize *serialize); + +FcBool +FcSerializeAlloc (FcSerialize *serialize, const void *object, int size); + +intptr_t +FcSerializeReserve (FcSerialize *serialize, int size); + +intptr_t +FcSerializeOffset (FcSerialize *serialize, const void *object); + +void * +FcSerializePtr (FcSerialize *serialize, const void *object); + +FcBool +FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l); + +FcLangSet * +FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l); + /* fccharset.c */ -FcCharSet * -FcCharSetFreeze (FcCharSet *cs); +void +FcLangCharSetPopulate (void); + +FcCharSetFreezer * +FcCharSetFreezerCreate (void); + +const FcCharSet * +FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs); void -FcCharSetThawAll (void); +FcCharSetFreezerDestroy (FcCharSetFreezer *freezer); FcBool FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c); @@ -527,9 +642,18 @@ FcNameParseCharSet (FcChar8 *string); FcCharLeaf * FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4); +FcBool +FcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs); + +FcCharSet * +FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs); + +FcChar16 * +FcCharSetGetNumbers(const FcCharSet *c); + /* fcdbg.c */ void -FcValueListPrint (const FcValueList *l); +FcValueListPrint (const FcValueListPtr l); void FcLangSetPrint (const FcLangSet *ls); @@ -549,8 +673,20 @@ FcEditPrint (const FcEdit *edit); void FcSubstPrint (const FcSubst *subst); -int -FcDebug (void); +void +FcCharSetPrint (const FcCharSet *c); + +extern int FcDebugVal; + +static inline int +FcDebug (void) { return FcDebugVal; } + +void +FcInitDebug (void); + +/* fcdefault.c */ +FcChar8 * +FcGetDefaultLang (void); /* fcdir.c */ @@ -560,21 +696,21 @@ FcFileIsDir (const FcChar8 *file); FcBool FcFileScanConfig (FcFontSet *set, FcStrSet *dirs, - FcFileCache *cache, FcBlanks *blanks, const FcChar8 *file, - FcBool force, FcConfig *config); FcBool FcDirScanConfig (FcFontSet *set, FcStrSet *dirs, - FcFileCache *cache, FcBlanks *blanks, - const FcChar8 *dir, + const FcChar8 *dir, FcBool force, FcConfig *config); +FcCache * +FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config); + /* fcfont.c */ int FcFontDebug (void); @@ -596,6 +732,13 @@ const FcCharMap * FcFreeTypeGetPrivateMap (FT_Encoding encoding); /* fcfs.c */ + +FcBool +FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s); + +FcFontSet * +FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s); + /* fcgram.y */ int FcConfigparse (void); @@ -676,6 +819,9 @@ FcNameParseLangSet (const FcChar8 *string); FcBool FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls); +FcChar8 * +FcNameUnparseEscaped (FcPattern *pat, FcBool escape); + /* fclist.c */ FcBool @@ -686,28 +832,149 @@ FcListPatternMatchAny (const FcPattern *p, /* fcname.c */ +/* + * NOTE -- this ordering is part of the cache file format. + * It must also match the ordering in fcname.c + */ + +#define FC_FAMILY_OBJECT 1 +#define FC_FAMILYLANG_OBJECT 2 +#define FC_STYLE_OBJECT 3 +#define FC_STYLELANG_OBJECT 4 +#define FC_FULLNAME_OBJECT 5 +#define FC_FULLNAMELANG_OBJECT 6 +#define FC_SLANT_OBJECT 7 +#define FC_WEIGHT_OBJECT 8 +#define FC_WIDTH_OBJECT 9 +#define FC_SIZE_OBJECT 10 +#define FC_ASPECT_OBJECT 11 +#define FC_PIXEL_SIZE_OBJECT 12 +#define FC_SPACING_OBJECT 13 +#define FC_FOUNDRY_OBJECT 14 +#define FC_ANTIALIAS_OBJECT 15 +#define FC_HINT_STYLE_OBJECT 16 +#define FC_HINTING_OBJECT 17 +#define FC_VERTICAL_LAYOUT_OBJECT 18 +#define FC_AUTOHINT_OBJECT 19 +#define FC_GLOBAL_ADVANCE_OBJECT 20 +#define FC_FILE_OBJECT 21 +#define FC_INDEX_OBJECT 22 +#define FC_RASTERIZER_OBJECT 23 +#define FC_OUTLINE_OBJECT 24 +#define FC_SCALABLE_OBJECT 25 +#define FC_DPI_OBJECT 26 +#define FC_RGBA_OBJECT 27 +#define FC_SCALE_OBJECT 28 +#define FC_MINSPACE_OBJECT 29 +#define FC_CHAR_WIDTH_OBJECT 30 +#define FC_CHAR_HEIGHT_OBJECT 31 +#define FC_MATRIX_OBJECT 32 +#define FC_CHARSET_OBJECT 33 +#define FC_LANG_OBJECT 34 +#define FC_FONTVERSION_OBJECT 35 +#define FC_CAPABILITY_OBJECT 36 +#define FC_FONTFORMAT_OBJECT 37 +#define FC_EMBOLDEN_OBJECT 38 +#define FC_EMBEDDED_BITMAP_OBJECT 39 +#define FC_DECORATIVE_OBJECT 40 + FcBool FcNameBool (const FcChar8 *v, FcBool *result); +FcBool +FcObjectValidType (FcObject object, FcType type); + +FcObject +FcObjectFromName (const char * name); + +const char * +FcObjectName (FcObject object); + +FcBool +FcObjectInit (void); + +void +FcObjectFini (void); + +#define FcObjectCompare(a, b) ((int) a - (int) b) + /* fcpat.c */ + +FcValue +FcValueCanonicalize (const FcValue *v); + void -FcValueListDestroy (FcValueList *l); - +FcValueListDestroy (FcValueListPtr l); + FcPatternElt * -FcPatternFindElt (const FcPattern *p, const char *object); +FcPatternObjectFindElt (const FcPattern *p, FcObject object); FcPatternElt * -FcPatternInsertElt (FcPattern *p, const char *object); +FcPatternObjectInsertElt (FcPattern *p, FcObject object); FcBool -FcPatternAddWithBinding (FcPattern *p, - const char *object, - FcValue value, - FcValueBinding binding, - FcBool append); +FcPatternObjectAddWithBinding (FcPattern *p, + FcObject object, + FcValue value, + FcValueBinding binding, + FcBool append); -FcPattern * -FcPatternFreeze (FcPattern *p); +FcBool +FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append); + +FcBool +FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append); + +FcResult +FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v); + +FcBool +FcPatternObjectDel (FcPattern *p, FcObject object); + +FcBool +FcPatternObjectRemove (FcPattern *p, FcObject object, int id); + +FcBool +FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i); + +FcBool +FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d); + +FcBool +FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s); + +FcBool +FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s); + +FcBool +FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c); + +FcBool +FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b); + +FcBool +FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls); + +FcResult +FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i); + +FcResult +FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d); + +FcResult +FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s); + +FcResult +FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s); + +FcResult +FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c); + +FcResult +FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b); + +FcResult +FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls); void FcPatternFini (void); @@ -715,8 +982,23 @@ FcPatternFini (void); FcBool FcPatternAppend (FcPattern *p, FcPattern *s); -const char * -FcObjectStaticName (const char *name); +const FcChar8 * +FcStrStaticName (const FcChar8 *name); + +FcChar32 +FcStringHash (const FcChar8 *s); + +FcBool +FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat); + +FcPattern * +FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat); + +FcBool +FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat); + +FcValueList * +FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat); /* fcrender.c */ @@ -728,6 +1010,9 @@ void FcMatrixFree (FcMatrix *mat); /* fcstr.c */ +void +FcStrSetSort (FcStrSet * set); + FcChar8 * FcStrPlus (const FcChar8 *s1, const FcChar8 *s2); @@ -770,4 +1055,13 @@ FcStrLastSlash (const FcChar8 *path); FcChar32 FcStrHashIgnoreCase (const FcChar8 *s); +FcChar8 * +FcStrCanonFilename (const FcChar8 *s); + +FcBool +FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str); + +FcChar8 * +FcStrSerialize (FcSerialize *serialize, const FcChar8 *str); + #endif /* _FC_INT_H_ */ diff --git a/src/fclang.c b/src/fclang.c index fabf36a..f8f6f0b 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -25,8 +25,8 @@ #include "fcint.h" typedef struct { - FcChar8 *lang; - FcCharSet charset; + const FcChar8 *lang; + const FcCharSet charset; } FcLangCharSet; typedef struct { @@ -48,29 +48,46 @@ FcLangSet * FcFreeTypeLangSet (const FcCharSet *charset, const FcChar8 *exclusiveLang) { - int i; + int i, j; FcChar32 missing; const FcCharSet *exclusiveCharset = 0; FcLangSet *ls; - if (exclusiveLang) exclusiveCharset = FcCharSetForLang (exclusiveLang); ls = FcLangSetCreate (); if (!ls) return 0; + if (FcDebug() & FC_DBG_LANGSET) + { + printf ("font charset\n"); + FcCharSetPrint (charset); + printf ("\n"); + } for (i = 0; i < NUM_LANG_CHAR_SET; i++) { + if (FcDebug() & FC_DBG_LANGSET) + { + printf ("%s charset\n", fcLangCharSets[i].lang); + FcCharSetPrint (&fcLangCharSets[i].charset); + printf ("\n"); + } + /* * Check for Han charsets to make fonts * which advertise support for a single language * not support other Han languages */ if (exclusiveCharset && - FcFreeTypeIsExclusiveLang (fcLangCharSets[i].lang) && - fcLangCharSets[i].charset.leaves != exclusiveCharset->leaves) + FcFreeTypeIsExclusiveLang (fcLangCharSets[i].lang)) { - continue; + if (fcLangCharSets[i].charset.num != exclusiveCharset->num) + continue; + + for (j = 0; j < fcLangCharSets[i].charset.num; j++) + if (FcCharSetLeaf(&fcLangCharSets[i].charset, j) != + FcCharSetLeaf(exclusiveCharset, j)) + continue; } missing = FcCharSetSubtractCount (&fcLangCharSets[i].charset, charset); if (FcDebug() & FC_DBG_SCANV) @@ -83,7 +100,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, FcChar32 map[FC_CHARSET_MAP_SIZE]; FcChar32 next; - printf ("\n%s(%d) ", fcLangCharSets[i].lang, missing); + printf ("\n%s(%u) ", fcLangCharSets[i].lang, missing); printf ("{"); for (ucs4 = FcCharSetFirstPage (missed, map, &next); ucs4 != FC_CHARSET_DONE; @@ -102,7 +119,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, FcCharSetDestroy (missed); } else - printf ("%s(%d) ", fcLangCharSets[i].lang, missing); + printf ("%s(%u) ", fcLangCharSets[i].lang, missing); } if (!missing) FcLangSetBitSet (ls, i); @@ -183,6 +200,7 @@ FcCharSetForLang (const FcChar8 *lang) { int i; int country = -1; + for (i = 0; i < NUM_LANG_CHAR_SET; i++) { switch (FcLangCompare (lang, fcLangCharSets[i].lang)) { @@ -197,7 +215,7 @@ FcCharSetForLang (const FcChar8 *lang) } if (country == -1) return 0; - return &fcLangCharSets[i].charset; + return &fcLangCharSets[country].charset; } FcLangSet * @@ -369,7 +387,6 @@ FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang) { FcStrList *list = FcStrListCreate (ls->extra); FcChar8 *extra; - FcLangResult r; if (list) { @@ -549,11 +566,18 @@ FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls) { if (!first) if (!FcStrBufChar (buf, '|')) + { + FcStrListDone (list); return FcFalse; + } if (!FcStrBufString (buf, extra)) - return FcFalse; + { + FcStrListDone (list); + return FcFalse; + } first = FcFalse; } + FcStrListDone (list); } return FcTrue; } @@ -684,3 +708,22 @@ FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb) } return FcTrue; } + +FcBool +FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l) +{ + if (!FcSerializeAlloc (serialize, l, sizeof (FcLangSet))) + return FcFalse; + return FcTrue; +} + +FcLangSet * +FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l) +{ + FcLangSet *l_serialize = FcSerializePtr (serialize, l); + + if (!l_serialize) + return NULL; + *l_serialize = *l; + return l_serialize; +} diff --git a/src/fclist.c b/src/fclist.c index ec47ddc..c0b7fb0 100644 --- a/src/fclist.c +++ b/src/fclist.c @@ -22,8 +22,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include #include "fcint.h" +#include FcObjectSet * FcObjectSetCreate (void) @@ -67,7 +67,7 @@ FcObjectSetAdd (FcObjectSet *os, const char *object) low = 0; mid = 0; c = 1; - object = FcObjectStaticName (object); + object = (char *)FcStrStaticName ((FcChar8 *)object); while (low <= high) { mid = (low + high) >> 1; @@ -125,51 +125,53 @@ FcObjectSetBuild (const char *first, ...) * Font must have a containing value for every value in the pattern */ static FcBool -FcListValueListMatchAny (FcValueList *patOrig, /* pattern */ - FcValueList *fntOrig) /* font */ +FcListValueListMatchAny (FcValueListPtr patOrig, /* pattern */ + FcValueListPtr fntOrig) /* font */ { - FcValueList *pat, *fnt; + FcValueListPtr pat, fnt; - for (pat = patOrig; pat; pat = pat->next) + for (pat = patOrig; pat != NULL; pat = FcValueListNext(pat)) { - for (fnt = fntOrig; fnt; fnt = fnt->next) + for (fnt = fntOrig; fnt != NULL; fnt = FcValueListNext(fnt)) { /* * make sure the font 'contains' the pattern. * (OpListing is OpContains except for strings * where it requires an exact match) */ - if (FcConfigCompareValue (fnt->value, + if (FcConfigCompareValue (&fnt->value, FcOpListing, - pat->value)) + &pat->value)) break; } - if (!fnt) + if (fnt == NULL) return FcFalse; } return FcTrue; } static FcBool -FcListValueListEqual (FcValueList *v1orig, - FcValueList *v2orig) +FcListValueListEqual (FcValueListPtr v1orig, + FcValueListPtr v2orig) { - FcValueList *v1, *v2; + FcValueListPtr v1, v2; - for (v1 = v1orig; v1; v1 = v1->next) + for (v1 = v1orig; v1 != NULL; v1 = FcValueListNext(v1)) { - for (v2 = v2orig; v2; v2 = v2->next) - if (FcValueEqual (v1->value, v2->value)) + for (v2 = v2orig; v2 != NULL; v2 = FcValueListNext(v2)) + if (FcValueEqual (FcValueCanonicalize(&(v1)->value), + FcValueCanonicalize(&(v2)->value))) break; - if (!v2) + if (v2 == NULL) return FcFalse; } - for (v2 = v2orig; v2; v2 = v2->next) + for (v2 = v2orig; v2 != NULL; v2 = FcValueListNext(v2)) { - for (v1 = v1orig; v1; v1 = v1->next) - if (FcValueEqual (v1->value, v2->value)) + for (v1 = v1orig; v1 != NULL; v1 = FcValueListNext(v1)) + if (FcValueEqual (FcValueCanonicalize(&v1->value), + FcValueCanonicalize(&v2->value))) break; - if (!v1) + if (v1 == NULL) return FcFalse; } return FcTrue; @@ -185,13 +187,14 @@ FcListPatternEqual (FcPattern *p1, for (i = 0; i < os->nobject; i++) { - e1 = FcPatternFindElt (p1, os->objects[i]); - e2 = FcPatternFindElt (p2, os->objects[i]); + e1 = FcPatternObjectFindElt (p1, FcObjectFromName (os->objects[i])); + e2 = FcPatternObjectFindElt (p2, FcObjectFromName (os->objects[i])); if (!e1 && !e2) continue; if (!e1 || !e2) return FcFalse; - if (!FcListValueListEqual (e1->values, e2->values)) + if (!FcListValueListEqual (FcPatternEltValues(e1), + FcPatternEltValues(e2))) return FcFalse; } return FcTrue; @@ -206,15 +209,15 @@ FcListPatternMatchAny (const FcPattern *p, const FcPattern *font) { int i; - FcPatternElt *e; for (i = 0; i < p->num; i++) { - e = FcPatternFindElt (font, p->elts[i].object); - if (!e) + FcPatternElt *pe = &FcPatternElts(p)[i]; + FcPatternElt *fe = FcPatternObjectFindElt (font, pe->object); + if (!fe) return FcFalse; - if (!FcListValueListMatchAny (p->elts[i].values, /* pat elts */ - e->values)) /* font elts */ + if (!FcListValueListMatchAny (FcPatternEltValues(pe), /* pat elts */ + FcPatternEltValues(fe))) /* font elts */ return FcFalse; } return FcTrue; @@ -232,8 +235,9 @@ FcListMatrixHash (const FcMatrix *m) } static FcChar32 -FcListValueHash (FcValue v) +FcListValueHash (FcValue *value) { + FcValue v = FcValueCanonicalize(value); switch (v.type) { case FcTypeVoid: return 0; @@ -258,14 +262,14 @@ FcListValueHash (FcValue v) } static FcChar32 -FcListValueListHash (FcValueList *list) +FcListValueListHash (FcValueListPtr list) { FcChar32 h = 0; - while (list) + while (list != NULL) { - h = h ^ FcListValueHash (list->value); - list = list->next; + h = h ^ FcListValueHash (&list->value); + list = FcValueListNext(list); } return h; } @@ -280,9 +284,9 @@ FcListPatternHash (FcPattern *font, for (n = 0; n < os->nobject; n++) { - e = FcPatternFindElt (font, os->objects[n]); + e = FcPatternObjectFindElt (font, FcObjectFromName (os->objects[n])); if (e) - h = h ^ FcListValueListHash (e->values); + h = h ^ FcListValueListHash (FcPatternEltValues(e)); } return h; } @@ -327,6 +331,34 @@ FcListHashTableCleanup (FcListHashTable *table) table->entries = 0; } +static int +FcGetDefaultObjectLangIndex (FcPattern *font, FcObject object) +{ + FcChar8 *lang = FcGetDefaultLang (); + FcPatternElt *e = FcPatternObjectFindElt (font, object); + FcValueListPtr v; + FcValue value; + int idx = -1; + int i; + + if (e) + { + for (v = FcPatternEltValues(e), i = 0; v; v = FcValueListNext(v), ++i) + { + value = FcValueCanonicalize (&v->value); + + if (value.type == FcTypeString) + { + FcLangResult res = FcLangCompare (value.u.s, lang); + if (res == FcLangEqual || (res == FcLangDifferentCountry && idx < 0)) + idx = i; + } + } + } + + return (idx > 0) ? idx : 0; +} + static FcBool FcListAppend (FcListHashTable *table, FcPattern *font, @@ -334,9 +366,14 @@ FcListAppend (FcListHashTable *table, { int o; FcPatternElt *e; - FcValueList *v; + FcValueListPtr v; FcChar32 hash; FcListBucket **prev, *bucket; + int familyidx = -1; + int fullnameidx = -1; + int styleidx = -1; + int defidx = 0; + int idx; hash = FcListPatternHash (font, os); for (prev = &table->buckets[hash % FC_LIST_HASH_SIZE]; @@ -358,14 +395,36 @@ FcListAppend (FcListHashTable *table, for (o = 0; o < os->nobject; o++) { - e = FcPatternFindElt (font, os->objects[o]); + if (!strcmp (os->objects[o], FC_FAMILY) || !strcmp (os->objects[o], FC_FAMILYLANG)) + { + if (familyidx < 0) + familyidx = FcGetDefaultObjectLangIndex (font, FC_FAMILYLANG_OBJECT); + defidx = familyidx; + } + else if (!strcmp (os->objects[o], FC_FULLNAME) || !strcmp (os->objects[o], FC_FULLNAMELANG)) + { + if (fullnameidx < 0) + fullnameidx = FcGetDefaultObjectLangIndex (font, FC_FULLNAMELANG_OBJECT); + defidx = fullnameidx; + } + else if (!strcmp (os->objects[o], FC_STYLE) || !strcmp (os->objects[o], FC_STYLELANG)) + { + if (styleidx < 0) + styleidx = FcGetDefaultObjectLangIndex (font, FC_STYLELANG_OBJECT); + defidx = styleidx; + } + else + defidx = 0; + + e = FcPatternObjectFindElt (font, FcObjectFromName (os->objects[o])); if (e) { - for (v = e->values; v; v = v->next) + for (v = FcPatternEltValues(e), idx = 0; v; + v = FcValueListNext(v), ++idx) { if (!FcPatternAdd (bucket->pattern, os->objects[o], - v->value, FcTrue)) + FcValueCanonicalize(&v->value), defidx != idx)) goto bail2; } } diff --git a/src/fcmatch.c b/src/fcmatch.c index 9a6b35f..96587cb 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -22,32 +22,32 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include -#include "fcint.h" #include static double -FcCompareNumber (char *object, FcValue value1, FcValue value2) +FcCompareNumber (FcValue *value1, FcValue *value2) { double v1, v2, v; - switch (value1.type) { + switch (value1->type) { case FcTypeInteger: - v1 = (double) value1.u.i; + v1 = (double) value1->u.i; break; case FcTypeDouble: - v1 = value1.u.d; + v1 = value1->u.d; break; default: return -1.0; } - switch (value2.type) { + switch (value2->type) { case FcTypeInteger: - v2 = (double) value2.u.i; + v2 = (double) value2->u.i; break; case FcTypeDouble: - v2 = value2.u.d; + v2 = value2->u.d; break; default: return -1.0; @@ -55,29 +55,34 @@ FcCompareNumber (char *object, FcValue value1, FcValue value2) v = v2 - v1; if (v < 0) v = -v; - return (double) v; + return v; } static double -FcCompareString (char *object, FcValue value1, FcValue value2) +FcCompareString (FcValue *v1, FcValue *v2) { - if (value2.type != FcTypeString || value1.type != FcTypeString) - return -1.0; - return (double) FcStrCmpIgnoreCase (value1.u.s, value2.u.s) != 0; + return (double) FcStrCmpIgnoreCase (fc_value_string(v1), fc_value_string(v2)) != 0; } static double -FcCompareFamily (char *object, FcValue value1, FcValue value2) +FcCompareFamily (FcValue *v1, FcValue *v2) { - if (value2.type != FcTypeString || value1.type != FcTypeString) - return -1.0; - return (double) FcStrCmpIgnoreBlanksAndCase (value1.u.s, value2.u.s) != 0; + /* rely on the guarantee in FcPatternAddWithBinding that + * families are always FcTypeString. */ + const FcChar8* v1_string = fc_value_string(v1); + const FcChar8* v2_string = fc_value_string(v2); + + if (FcToLower(*v1_string) != FcToLower(*v2_string)) + return 1.0; + + return (double) FcStrCmpIgnoreBlanksAndCase (v1_string, v2_string) != 0; } static double -FcCompareLang (char *object, FcValue value1, FcValue value2) +FcCompareLang (FcValue *v1, FcValue *v2) { FcLangResult result; + FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2); switch (value1.type) { case FcTypeLangSet: @@ -86,7 +91,8 @@ FcCompareLang (char *object, FcValue value1, FcValue value2) result = FcLangSetCompare (value1.u.l, value2.u.l); break; case FcTypeString: - result = FcLangSetHasLang (value1.u.l, value2.u.s); + result = FcLangSetHasLang (value1.u.l, + value2.u.s); break; default: return -1.0; @@ -98,7 +104,8 @@ FcCompareLang (char *object, FcValue value1, FcValue value2) result = FcLangSetHasLang (value2.u.l, value1.u.s); break; case FcTypeString: - result = FcLangCompare (value1.u.s, value2.u.s); + result = FcLangCompare (value1.u.s, + value2.u.s); break; default: return -1.0; @@ -119,42 +126,40 @@ FcCompareLang (char *object, FcValue value1, FcValue value2) } static double -FcCompareBool (char *object, FcValue value1, FcValue value2) +FcCompareBool (FcValue *v1, FcValue *v2) { - if (value2.type != FcTypeBool || value1.type != FcTypeBool) + if (fc_storage_type(v2) != FcTypeBool || fc_storage_type(v1) != FcTypeBool) return -1.0; - return (double) value2.u.b != value1.u.b; + return (double) v2->u.b != v1->u.b; } static double -FcCompareCharSet (char *object, FcValue value1, FcValue value2) +FcCompareCharSet (FcValue *v1, FcValue *v2) { - if (value2.type != FcTypeCharSet || value1.type != FcTypeCharSet) - return -1.0; - return (double) FcCharSetSubtractCount (value1.u.c, value2.u.c); + return (double) FcCharSetSubtractCount (fc_value_charset(v1), fc_value_charset(v2)); } static double -FcCompareSize (char *object, FcValue value1, FcValue value2) +FcCompareSize (FcValue *value1, FcValue *value2) { double v1, v2, v; - switch (value1.type) { + switch (value1->type) { case FcTypeInteger: - v1 = value1.u.i; + v1 = value1->u.i; break; case FcTypeDouble: - v1 = value1.u.d; + v1 = value1->u.d; break; default: return -1; } - switch (value2.type) { + switch (value2->type) { case FcTypeInteger: - v2 = value2.u.i; + v2 = value2->u.i; break; case FcTypeDouble: - v2 = value2.u.d; + v2 = value2->u.d; break; default: return -1; @@ -168,8 +173,8 @@ FcCompareSize (char *object, FcValue value1, FcValue value2) } typedef struct _FcMatcher { - char *object; - double (*compare) (char *object, FcValue value1, FcValue value2); + FcObject object; + double (*compare) (FcValue *value1, FcValue *value2); int strong, weak; } FcMatcher; @@ -179,175 +184,155 @@ typedef struct _FcMatcher { * later values */ static FcMatcher _FcMatchers [] = { - { FC_FOUNDRY, FcCompareString, 0, 0 }, + { FC_FOUNDRY_OBJECT, FcCompareString, 0, 0 }, #define MATCH_FOUNDRY 0 #define MATCH_FOUNDRY_INDEX 0 - { FC_CHARSET, FcCompareCharSet, 1, 1 }, + { FC_CHARSET_OBJECT, FcCompareCharSet, 1, 1 }, #define MATCH_CHARSET 1 #define MATCH_CHARSET_INDEX 1 - { FC_FAMILY, FcCompareFamily, 2, 4 }, + { FC_FAMILY_OBJECT, FcCompareFamily, 2, 4 }, #define MATCH_FAMILY 2 #define MATCH_FAMILY_STRONG_INDEX 2 #define MATCH_FAMILY_WEAK_INDEX 4 - { FC_LANG, FcCompareLang, 3, 3 }, + { FC_LANG_OBJECT, FcCompareLang, 3, 3 }, #define MATCH_LANG 3 #define MATCH_LANG_INDEX 3 - { FC_SPACING, FcCompareNumber, 5, 5 }, + { FC_SPACING_OBJECT, FcCompareNumber, 5, 5 }, #define MATCH_SPACING 4 #define MATCH_SPACING_INDEX 5 - { FC_PIXEL_SIZE, FcCompareSize, 6, 6 }, + { FC_PIXEL_SIZE_OBJECT, FcCompareSize, 6, 6 }, #define MATCH_PIXEL_SIZE 5 #define MATCH_PIXEL_SIZE_INDEX 6 - { FC_STYLE, FcCompareString, 7, 7 }, + { FC_STYLE_OBJECT, FcCompareString, 7, 7 }, #define MATCH_STYLE 6 #define MATCH_STYLE_INDEX 7 - { FC_SLANT, FcCompareNumber, 8, 8 }, + { FC_SLANT_OBJECT, FcCompareNumber, 8, 8 }, #define MATCH_SLANT 7 #define MATCH_SLANT_INDEX 8 - { FC_WEIGHT, FcCompareNumber, 9, 9 }, + { FC_WEIGHT_OBJECT, FcCompareNumber, 9, 9 }, #define MATCH_WEIGHT 8 #define MATCH_WEIGHT_INDEX 9 - { FC_WIDTH, FcCompareNumber, 10, 10 }, + { FC_WIDTH_OBJECT, FcCompareNumber, 10, 10 }, #define MATCH_WIDTH 9 #define MATCH_WIDTH_INDEX 10 - { FC_ANTIALIAS, FcCompareBool, 11, 11 }, -#define MATCH_ANTIALIAS 10 -#define MATCH_ANTIALIAS_INDEX 11 + { FC_DECORATIVE_OBJECT, FcCompareBool, 11, 11 }, +#define MATCH_DECORATIVE 11 +#define MATCH_DECORATIVE_INDEX 12 + + { FC_ANTIALIAS_OBJECT, FcCompareBool, 12, 12 }, + +#define MATCH_ANTIALIAS 11 +#define MATCH_ANTIALIAS_INDEX 12 - { FC_RASTERIZER, FcCompareString, 12, 12 }, -#define MATCH_RASTERIZER 11 -#define MATCH_RASTERIZER_INDEX 12 + { FC_RASTERIZER_OBJECT, FcCompareString, 13, 13 }, +#define MATCH_RASTERIZER 12 +#define MATCH_RASTERIZER_INDEX 12 - { FC_OUTLINE, FcCompareBool, 13, 13 }, -#define MATCH_OUTLINE 12 -#define MATCH_OUTLINE_INDEX 13 + { FC_OUTLINE_OBJECT, FcCompareBool, 14, 14 }, +#define MATCH_OUTLINE 13 +#define MATCH_OUTLINE_INDEX 14 - { FC_FONTVERSION, FcCompareNumber, 14, 14 }, -#define MATCH_FONTVERSION 13 -#define MATCH_FONTVERSION_INDEX 14 + { FC_FONTVERSION_OBJECT, FcCompareNumber, 15, 15 }, +#define MATCH_FONTVERSION 14 +#define MATCH_FONTVERSION_INDEX 15 }; -#define NUM_MATCH_VALUES 15 +#define NUM_MATCH_VALUES 16 -static FcBool -FcCompareValueList (const char *object, - FcValueList *v1orig, /* pattern */ - FcValueList *v2orig, /* target */ - FcValue *bestValue, - double *value, - FcResult *result) +static FcMatcher* +FcObjectToMatcher (FcObject object) { - FcValueList *v1, *v2; - double v, best, bestStrong, bestWeak; - int i; - int j; - - /* - * Locate the possible matching entry by examining the - * first few characters in object - */ + int i; + i = -1; - switch (FcToLower (object[0])) { - case 'f': - switch (FcToLower (object[1])) { - case 'o': - switch (FcToLower (object[2])) { - case 'u': - i = MATCH_FOUNDRY; break; - case 'n': - i = MATCH_FONTVERSION; break; - } - break; - case 'a': - i = MATCH_FAMILY; break; - } - break; - case 'c': + switch (object) { + case FC_FOUNDRY_OBJECT: + i = MATCH_FOUNDRY; break; + case FC_FONTVERSION_OBJECT: + i = MATCH_FONTVERSION; break; + case FC_FAMILY_OBJECT: + i = MATCH_FAMILY; break; + case FC_CHARSET_OBJECT: i = MATCH_CHARSET; break; - case 'a': + case FC_ANTIALIAS_OBJECT: i = MATCH_ANTIALIAS; break; - case 'l': + case FC_LANG_OBJECT: i = MATCH_LANG; break; - case 's': - switch (FcToLower (object[1])) { - case 'p': - i = MATCH_SPACING; break; - case 't': - i = MATCH_STYLE; break; - case 'l': - i = MATCH_SLANT; break; - } - break; - case 'p': + case FC_SPACING_OBJECT: + i = MATCH_SPACING; break; + case FC_STYLE_OBJECT: + i = MATCH_STYLE; break; + case FC_SLANT_OBJECT: + i = MATCH_SLANT; break; + case FC_PIXEL_SIZE_OBJECT: i = MATCH_PIXEL_SIZE; break; - case 'w': - switch (FcToLower (object[1])) { - case 'i': - i = MATCH_WIDTH; break; - case 'e': - i = MATCH_WEIGHT; break; - } - break; - case 'r': + case FC_WIDTH_OBJECT: + i = MATCH_WIDTH; break; + case FC_WEIGHT_OBJECT: + i = MATCH_WEIGHT; break; + case FC_RASTERIZER_OBJECT: i = MATCH_RASTERIZER; break; - case 'o': + case FC_OUTLINE_OBJECT: i = MATCH_OUTLINE; break; + case FC_DECORATIVE_OBJECT: + i = MATCH_DECORATIVE; break; } - if (i == -1 || - FcStrCmpIgnoreCase ((FcChar8 *) _FcMatchers[i].object, - (FcChar8 *) object) != 0) - { - if (bestValue) - *bestValue = v2orig->value; - return FcTrue; - } -#if 0 - for (i = 0; i < NUM_MATCHER; i++) - { - if (!FcStrCmpIgnoreCase ((FcChar8 *) _FcMatchers[i].object, - (FcChar8 *) object)) - break; - } - if (i == NUM_MATCHER) + + if (i < 0) + return NULL; + + return _FcMatchers+i; +} + +static FcBool +FcCompareValueList (FcObject object, + FcValueListPtr v1orig, /* pattern */ + FcValueListPtr v2orig, /* target */ + FcValue *bestValue, + double *value, + FcResult *result) +{ + FcValueListPtr v1, v2; + double v, best, bestStrong, bestWeak; + int j; + FcMatcher *match = FcObjectToMatcher(object); + + if (!match) { if (bestValue) - *bestValue = v2orig->value; + *bestValue = FcValueCanonicalize(&v2orig->value); return FcTrue; } -#endif + best = 1e99; bestStrong = 1e99; bestWeak = 1e99; j = 0; - for (v1 = v1orig; v1; v1 = v1->next) + for (v1 = v1orig; v1; v1 = FcValueListNext(v1)) { - for (v2 = v2orig; v2; v2 = v2->next) + for (v2 = v2orig; v2; v2 = FcValueListNext(v2)) { - v = (*_FcMatchers[i].compare) (_FcMatchers[i].object, - v1->value, - v2->value); + v = (match->compare) (&v1->value, &v2->value); if (v < 0) { *result = FcResultTypeMismatch; return FcFalse; } - if (FcDebug () & FC_DBG_MATCHV) - printf (" v %g j %d ", v, j); v = v * 100 + j; if (v < best) { if (bestValue) - *bestValue = v2->value; + *bestValue = FcValueCanonicalize(&v2->value); best = v; } if (v1->binding == FcValueBindingStrong) @@ -365,7 +350,7 @@ FcCompareValueList (const char *object, } if (FcDebug () & FC_DBG_MATCHV) { - printf (" %s: %g ", object, best); + printf (" %s: %g ", FcObjectName (object), best); FcValueListPrint (v1orig); printf (", "); FcValueListPrint (v2orig); @@ -373,8 +358,8 @@ FcCompareValueList (const char *object, } if (value) { - int weak = _FcMatchers[i].weak; - int strong = _FcMatchers[i].strong; + int weak = match->weak; + int strong = match->strong; if (weak == strong) value[strong] += best; else @@ -406,38 +391,26 @@ FcCompare (FcPattern *pat, i2 = 0; while (i1 < pat->num && i2 < fnt->num) { - i = pat->elts[i1].object - fnt->elts[i2].object; + FcPatternElt *elt_i1 = &FcPatternElts(pat)[i1]; + FcPatternElt *elt_i2 = &FcPatternElts(fnt)[i2]; + + i = FcObjectCompare(elt_i1->object, elt_i2->object); if (i > 0) i2++; else if (i < 0) i1++; else { - if (!FcCompareValueList (pat->elts[i1].object, - pat->elts[i1].values, - fnt->elts[i2].values, - 0, - value, - result)) + if (!FcCompareValueList (elt_i1->object, + FcPatternEltValues(elt_i1), + FcPatternEltValues(elt_i2), + 0, value, result)) return FcFalse; i1++; i2++; } } return FcTrue; -#if 0 - for (i1 = 0; i1 < pat->num; i1++) - { - for (i2 = 0; i2 < fnt->num; i2++) - { - if (!strcmp (pat->elts[i1].object, fnt->elts[i2].object)) - { - break; - } - } - } - return FcTrue; -#endif } FcPattern * @@ -456,28 +429,32 @@ FcFontRenderPrepare (FcConfig *config, return 0; for (i = 0; i < font->num; i++) { - fe = &font->elts[i]; - pe = FcPatternFindElt (pat, fe->object); + fe = &FcPatternElts(font)[i]; + pe = FcPatternObjectFindElt (pat, fe->object); if (pe) { - if (!FcCompareValueList (pe->object, pe->values, - fe->values, &v, 0, &result)) + if (!FcCompareValueList (pe->object, FcPatternEltValues(pe), + FcPatternEltValues(fe), &v, 0, &result)) { FcPatternDestroy (new); return 0; } } else - v = fe->values->value; - FcPatternAdd (new, fe->object, v, FcFalse); + v = FcValueCanonicalize(&FcPatternEltValues (fe)->value); + FcPatternObjectAdd (new, fe->object, v, FcFalse); } for (i = 0; i < pat->num; i++) { - pe = &pat->elts[i]; - fe = FcPatternFindElt (font, pe->object); + pe = &FcPatternElts(pat)[i]; + fe = FcPatternObjectFindElt (font, pe->object); if (!fe) - FcPatternAdd (new, pe->object, pe->values->value, FcTrue); + { + v = FcValueCanonicalize(&FcPatternEltValues(pe)->value); + FcPatternObjectAdd (new, pe->object, v, FcTrue); + } } + FcConfigSubstituteWithPat (config, new, pat, FcMatchFont); return new; } @@ -508,10 +485,7 @@ FcFontSetMatch (FcConfig *config, { config = FcConfigGetCurrent (); if (!config) - { - *result = FcResultOutOfMemory; return 0; - } } for (set = 0; set < nsets; set++) { @@ -609,7 +583,7 @@ FcSortCompare (const void *aa, const void *ab) } static FcBool -FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool trim) +FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool trim, FcBool build_cs) { FcCharSet *ncs; FcSortNode *node; @@ -626,18 +600,22 @@ FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool tri */ if (!trim || !*cs || !FcCharSetIsSubset (ncs, *cs)) { - if (*cs) - { - ncs = FcCharSetUnion (ncs, *cs); - if (!ncs) - return FcFalse; - FcCharSetDestroy (*cs); - } - else - ncs = FcCharSetCopy (ncs); - *cs = ncs; + if (trim || build_cs) + { + if (*cs) + { + ncs = FcCharSetUnion (ncs, *cs); + if (!ncs) + return FcFalse; + FcCharSetDestroy (*cs); + } + else + ncs = FcCharSetCopy (ncs); + *cs = ncs; + } + FcPatternReference (node->pattern); - if (FcDebug () & FC_DBG_MATCH) + if (FcDebug () & FC_DBG_MATCHV) { printf ("Add "); FcPatternPrint (node->pattern); @@ -759,7 +737,7 @@ FcFontSetSort (FcConfig *config, * If this node matches any language, go check * which ones and satisfy those entries */ - if (nodeps[f]->score[MATCH_LANG_INDEX] < nPatternLang) + if (nodeps[f]->score[MATCH_LANG_INDEX] < 200) { for (i = 0; i < nPatternLang; i++) { @@ -769,8 +747,7 @@ FcFontSetSort (FcConfig *config, FcPatternGet (p, FC_LANG, i, &patternLang) == FcResultMatch && FcPatternGet (nodeps[f]->pattern, FC_LANG, 0, &nodeLang) == FcResultMatch) { - double compare = FcCompareLang (FC_LANG, patternLang, - nodeLang); + double compare = FcCompareLang (&patternLang, &nodeLang); if (compare >= 0 && compare < 2) { if (FcDebug () & FC_DBG_MATCHV) @@ -805,16 +782,24 @@ FcFontSetSort (FcConfig *config, cs = 0; - if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim)) + if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim, (csp!=0))) goto bail2; if (csp) *csp = cs; else - FcCharSetDestroy (cs); + { + if (cs) + FcCharSetDestroy (cs); + } free (nodes); + if (FcDebug() & FC_DBG_MATCH) + { + printf ("First font "); + FcPatternPrint (ret->fonts[0]); + } return ret; bail2: diff --git a/src/fcmatrix.c b/src/fcmatrix.c index 863fe69..3c4d9fb 100644 --- a/src/fcmatrix.c +++ b/src/fcmatrix.c @@ -22,10 +22,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include #include -#include "fcint.h" const FcMatrix FcIdentityMatrix = { 1, 0, 0, 1 }; diff --git a/src/fcname.c b/src/fcname.c index 3b9454d..cfc6b31 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -22,14 +22,20 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include #include #include -#include "fcint.h" + +/* + * Please do not change this list, it is used to initialize the object + * list in this order to match the FC_foo_OBJECT constants. Those + * constants are written into cache files. + */ static const FcObjectType _FcBaseObjectTypes[] = { - { FC_FAMILY, FcTypeString, }, + { FC_FAMILY, FcTypeString, }, /* 1 */ { FC_FAMILYLANG, FcTypeString, }, { FC_STYLE, FcTypeString, }, { FC_STYLELANG, FcTypeString, }, @@ -43,14 +49,12 @@ static const FcObjectType _FcBaseObjectTypes[] = { { FC_PIXEL_SIZE, FcTypeDouble, }, { FC_SPACING, FcTypeInteger, }, { FC_FOUNDRY, FcTypeString, }, -/* { FC_CORE, FcTypeBool, }, */ { FC_ANTIALIAS, FcTypeBool, }, { FC_HINT_STYLE, FcTypeInteger, }, { FC_HINTING, FcTypeBool, }, { FC_VERTICAL_LAYOUT, FcTypeBool, }, { FC_AUTOHINT, FcTypeBool, }, { FC_GLOBAL_ADVANCE, FcTypeBool, }, -/* { FC_XLFD, FcTypeString, }, */ { FC_FILE, FcTypeString, }, { FC_INDEX, FcTypeInteger, }, { FC_RASTERIZER, FcTypeString, }, @@ -59,7 +63,6 @@ static const FcObjectType _FcBaseObjectTypes[] = { { FC_DPI, FcTypeDouble }, { FC_RGBA, FcTypeInteger, }, { FC_SCALE, FcTypeDouble, }, -/* { FC_RENDER, FcTypeBool, },*/ { FC_MINSPACE, FcTypeBool, }, { FC_CHAR_WIDTH, FcTypeInteger }, { FC_CHAR_HEIGHT, FcTypeInteger }, @@ -70,6 +73,8 @@ static const FcObjectType _FcBaseObjectTypes[] = { { FC_CAPABILITY, FcTypeString }, { FC_FONTFORMAT, FcTypeString }, { FC_EMBOLDEN, FcTypeBool }, + { FC_EMBEDDED_BITMAP, FcTypeBool }, + { FC_DECORATIVE, FcTypeBool }, /* 40 */ }; #define NUM_OBJECT_TYPES (sizeof _FcBaseObjectTypes / sizeof _FcBaseObjectTypes[0]) @@ -85,64 +90,291 @@ struct _FcObjectTypeList { static const FcObjectTypeList _FcBaseObjectTypesList = { 0, _FcBaseObjectTypes, - NUM_OBJECT_TYPES + NUM_OBJECT_TYPES, }; static const FcObjectTypeList *_FcObjectTypes = &_FcBaseObjectTypesList; +#define OBJECT_HASH_SIZE 31 + +typedef struct _FcObjectBucket { + struct _FcObjectBucket *next; + FcChar32 hash; + FcObject id; +} FcObjectBucket; + +static FcObjectBucket *FcObjectBuckets[OBJECT_HASH_SIZE]; + +static FcObjectType *FcObjects = (FcObjectType *) _FcBaseObjectTypes; +static int FcObjectsNumber = NUM_OBJECT_TYPES; +static int FcObjectsSize = 0; +static FcBool FcObjectsInited; + +static FcObjectType * +FcObjectInsert (const char *name, FcType type) +{ + FcObjectType *o; + if (FcObjectsNumber >= FcObjectsSize) + { + int newsize = FcObjectsNumber * 2; + FcObjectType *newobjects; + + if (FcObjectsSize) + newobjects = realloc (FcObjects, newsize * sizeof (FcObjectType)); + else + { + newobjects = malloc (newsize * sizeof (FcObjectType)); + if (newobjects) + memcpy (newobjects, FcObjects, + FcObjectsNumber * sizeof (FcObjectType)); + } + if (!newobjects) + return NULL; + FcObjects = newobjects; + FcObjectsSize = newsize; + } + o = &FcObjects[FcObjectsNumber]; + o->object = name; + o->type = type; + ++FcObjectsNumber; + return o; +} + +static FcObject +FcObjectId (FcObjectType *o) +{ + return o - FcObjects + 1; +} + +static FcObjectType * +FcObjectFindByName (const char *object, FcBool insert) +{ + FcChar32 hash = FcStringHash ((const FcChar8 *) object); + FcObjectBucket **p; + FcObjectBucket *b; + FcObjectType *o; + + if (!FcObjectsInited) + FcObjectInit (); + for (p = &FcObjectBuckets[hash%OBJECT_HASH_SIZE]; (b = *p); p = &(b->next)) + { + o = FcObjects + b->id - 1; + if (b->hash == hash && !strcmp (object, (o->object))) + return o; + } + if (!insert) + return NULL; + /* + * Hook it into the hash chain + */ + b = malloc (sizeof(FcObjectBucket)); + if (!b) + return NULL; + object = (const char *) FcStrCopy ((FcChar8 *) object); + if (!object) { + free (b); + return NULL; + } + o = FcObjectInsert (object, -1); + b->next = NULL; + b->hash = hash; + b->id = FcObjectId (o); + *p = b; + return o; +} + +static FcObjectType * +FcObjectFindById (FcObject object) +{ + if (1 <= object && object <= FcObjectsNumber) + return FcObjects + object - 1; + return NULL; +} + +static FcBool +FcObjectHashInsert (const FcObjectType *object, FcBool copy) +{ + FcChar32 hash = FcStringHash ((const FcChar8 *) object->object); + FcObjectBucket **p; + FcObjectBucket *b; + FcObjectType *o; + + if (!FcObjectsInited) + FcObjectInit (); + for (p = &FcObjectBuckets[hash%OBJECT_HASH_SIZE]; (b = *p); p = &(b->next)) + { + o = FcObjects + b->id - 1; + if (b->hash == hash && !strcmp (object->object, o->object)) + return FcFalse; + } + /* + * Hook it into the hash chain + */ + b = malloc (sizeof(FcObjectBucket)); + if (!b) + return FcFalse; + if (copy) + { + o = FcObjectInsert (object->object, object->type); + if (!o) + { + free (b); + return FcFalse; + } + } + else + o = (FcObjectType *) object; + b->next = NULL; + b->hash = hash; + b->id = FcObjectId (o); + *p = b; + return FcTrue; +} + +static void +FcObjectHashRemove (const FcObjectType *object, FcBool cleanobj) +{ + FcChar32 hash = FcStringHash ((const FcChar8 *) object->object); + FcObjectBucket **p; + FcObjectBucket *b; + FcObjectType *o; + + if (!FcObjectsInited) + FcObjectInit (); + for (p = &FcObjectBuckets[hash%OBJECT_HASH_SIZE]; (b = *p); p = &(b->next)) + { + o = FcObjects + b->id - 1; + if (b->hash == hash && !strcmp (object->object, o->object)) + { + *p = b->next; + free (b); + if (cleanobj) + { + /* Clean up object array */ + o->object = NULL; + o->type = -1; + while (FcObjects[FcObjectsNumber-1].object == NULL) + --FcObjectsNumber; + } + break; + } + } +} + FcBool FcNameRegisterObjectTypes (const FcObjectType *types, int ntypes) { - FcObjectTypeList *l; + int i; - l = (FcObjectTypeList *) malloc (sizeof (FcObjectTypeList)); - if (!l) - return FcFalse; - FcMemAlloc (FC_MEM_OBJECTTYPE, sizeof (FcObjectTypeList)); - l->types = types; - l->ntypes = ntypes; - l->next = _FcObjectTypes; - _FcObjectTypes = l; + for (i = 0; i < ntypes; i++) + if (!FcObjectHashInsert (&types[i], FcTrue)) + return FcFalse; return FcTrue; } FcBool FcNameUnregisterObjectTypes (const FcObjectType *types, int ntypes) { - const FcObjectTypeList *l, **prev; + int i; - for (prev = &_FcObjectTypes; - (l = *prev); - prev = (const FcObjectTypeList **) &(l->next)) - { - if (l->types == types && l->ntypes == ntypes) - { - *prev = l->next; - FcMemFree (FC_MEM_OBJECTTYPE, sizeof (FcObjectTypeList)); - free ((void *) l); + for (i = 0; i < ntypes; i++) + FcObjectHashRemove (&types[i], FcTrue); + return FcTrue; +} + +const FcObjectType * +FcNameGetObjectType (const char *object) +{ + return FcObjectFindByName (object, FcFalse); +} + +FcBool +FcObjectValidType (FcObject object, FcType type) +{ + FcObjectType *t = FcObjectFindById (object); + + if (t) { + switch (t->type) { + case -1: return FcTrue; + case FcTypeDouble: + case FcTypeInteger: + if (type == FcTypeDouble || type == FcTypeInteger) + return FcTrue; + break; + case FcTypeLangSet: + if (type == FcTypeLangSet || type == FcTypeString) + return FcTrue; + break; + default: + if (type == t->type) + return FcTrue; + break; } + return FcFalse; } - return FcFalse; + return FcTrue; } -const FcObjectType * -FcNameGetObjectType (const char *object) +FcObject +FcObjectFromName (const char * name) { - int i; - const FcObjectTypeList *l; - const FcObjectType *t; - - for (l = _FcObjectTypes; l; l = l->next) + FcObjectType *o = FcObjectFindByName (name, FcTrue); + + if (o) + return FcObjectId (o); + return 0; +} + +FcBool +FcObjectInit (void) +{ + int i; + + if (FcObjectsInited) + return FcTrue; + + FcObjectsInited = FcTrue; + for (i = 0; i < NUM_OBJECT_TYPES; i++) + if (!FcObjectHashInsert (&_FcBaseObjectTypes[i], FcFalse)) + return FcFalse; + return FcTrue; +} + +void +FcObjectFini (void) +{ + int i; + FcObjectBucket *b, *next; + + for (i = 0; i < OBJECT_HASH_SIZE; i++) { - for (i = 0; i < l->ntypes; i++) + for (b = FcObjectBuckets[i]; b; b = next) { - t = &l->types[i]; - if (!strcmp (object, t->object)) - return t; + next = b->next; + free (b); } + FcObjectBuckets[i] = 0; } - return 0; + for (i = 0; i < FcObjectsNumber; i++) + if (FcObjects[i].type == -1) + free ((void*) FcObjects[i].object); + if (FcObjects != _FcBaseObjectTypes) + free (FcObjects); + FcObjects = (FcObjectType *) _FcBaseObjectTypes; + FcObjectsNumber = NUM_OBJECT_TYPES; + FcObjectsSize = 0; + FcObjectsInited = FcFalse; +} + +const char * +FcObjectName (FcObject object) +{ + FcObjectType *o = FcObjectFindById (object); + + if (o) + return o->object; + return NULL; } static const FcConstant _FcBaseConstants[] = { @@ -159,6 +391,7 @@ static const FcConstant _FcBaseConstants[] = { { (FcChar8 *) "extrabold", "weight", FC_WEIGHT_EXTRABOLD, }, { (FcChar8 *) "ultrabold", "weight", FC_WEIGHT_EXTRABOLD, }, { (FcChar8 *) "black", "weight", FC_WEIGHT_BLACK, }, + { (FcChar8 *) "heavy", "weight", FC_WEIGHT_HEAVY, }, { (FcChar8 *) "roman", "slant", FC_SLANT_ROMAN, }, { (FcChar8 *) "italic", "slant", FC_SLANT_ITALIC, }, @@ -190,6 +423,18 @@ static const FcConstant _FcBaseConstants[] = { { (FcChar8 *) "hintslight", "hintstyle", FC_HINT_SLIGHT }, { (FcChar8 *) "hintmedium", "hintstyle", FC_HINT_MEDIUM }, { (FcChar8 *) "hintfull", "hintstyle", FC_HINT_FULL }, + + { (FcChar8 *) "antialias", "antialias", FcTrue }, + { (FcChar8 *) "hinting", "hinting", FcTrue }, + { (FcChar8 *) "verticallayout", "verticallayout", FcTrue }, + { (FcChar8 *) "autohint", "autohint", FcTrue }, + { (FcChar8 *) "globaladvance", "globaladvance", FcTrue }, + { (FcChar8 *) "outline", "outline", FcTrue }, + { (FcChar8 *) "scalable", "scalable", FcTrue }, + { (FcChar8 *) "minspace", "minspace", FcTrue }, + { (FcChar8 *) "embolden", "embolden", FcTrue }, + { (FcChar8 *) "embeddedbitmap", "embeddedbitmap", FcTrue }, + { (FcChar8 *) "decorative", "decorative", FcTrue }, }; #define NUM_FC_CONSTANTS (sizeof _FcBaseConstants/sizeof _FcBaseConstants[0]) @@ -321,7 +566,9 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m) v.u.i = atoi ((char *) string); break; case FcTypeString: - v.u.s = string; + v.u.s = FcStrStaticName(string); + if (!v.u.s) + v.type = FcTypeVoid; break; case FcTypeBool: if (!FcNameBool (string, &v.u.b)) @@ -336,9 +583,13 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m) break; case FcTypeCharSet: v.u.c = FcNameParseCharSet (string); + if (!v.u.c) + v.type = FcTypeVoid; break; case FcTypeLangSet: v.u.l = FcNameParseLangSet (string); + if (!v.u.l) + v.type = FcTypeVoid; break; default: break; @@ -465,8 +716,20 @@ FcNameParse (const FcChar8 *name) { if ((c = FcNameGetConstant (save))) { - if (!FcPatternAddInteger (pat, c->object, c->value)) - goto bail2; + t = FcNameGetObjectType ((char *) c->object); + switch (t->type) { + case FcTypeInteger: + case FcTypeDouble: + if (!FcPatternAddInteger (pat, c->object, c->value)) + goto bail2; + break; + case FcTypeBool: + if (!FcPatternAddBool (pat, c->object, c->value)) + goto bail2; + break; + default: + break; + } } } } @@ -503,10 +766,11 @@ FcNameUnparseString (FcStrBuf *buf, static FcBool FcNameUnparseValue (FcStrBuf *buf, - FcValue v, + FcValue *v0, FcChar8 *escape) { FcChar8 temp[1024]; + FcValue v = FcValueCanonicalize(v0); switch (v.type) { case FcTypeVoid: @@ -537,14 +801,14 @@ FcNameUnparseValue (FcStrBuf *buf, static FcBool FcNameUnparseValueList (FcStrBuf *buf, - FcValueList *v, + FcValueListPtr v, FcChar8 *escape) { while (v) { - if (!FcNameUnparseValue (buf, v->value, escape)) + if (!FcNameUnparseValue (buf, &v->value, escape)) return FcFalse; - if ((v = v->next)) + if ((v = FcValueListNext(v)) != NULL) if (!FcNameUnparseString (buf, (FcChar8 *) ",", 0)) return FcFalse; } @@ -556,6 +820,12 @@ FcNameUnparseValueList (FcStrBuf *buf, FcChar8 * FcNameUnparse (FcPattern *pat) +{ + return FcNameUnparseEscaped (pat, FcTrue); +} + +FcChar8 * +FcNameUnparseEscaped (FcPattern *pat, FcBool escape) { FcStrBuf buf; FcChar8 buf_static[8192]; @@ -565,18 +835,18 @@ FcNameUnparse (FcPattern *pat) const FcObjectType *o; FcStrBufInit (&buf, buf_static, sizeof (buf_static)); - e = FcPatternFindElt (pat, FC_FAMILY); + e = FcPatternObjectFindElt (pat, FC_FAMILY_OBJECT); if (e) { - if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED)) + if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0)) goto bail0; } - e = FcPatternFindElt (pat, FC_SIZE); + e = FcPatternObjectFindElt (pat, FC_SIZE_OBJECT); if (e) { if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0)) goto bail0; - if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED)) + if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0)) goto bail0; } for (l = _FcObjectTypes; l; l = l->next) @@ -589,17 +859,17 @@ FcNameUnparse (FcPattern *pat) !strcmp (o->object, FC_FILE)) continue; - e = FcPatternFindElt (pat, o->object); + e = FcPatternObjectFindElt (pat, FcObjectFromName (o->object)); if (e) { if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0)) goto bail0; - if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, (FcChar8 *) FC_ESCAPE_VARIABLE)) + if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, escape ? (FcChar8 *) FC_ESCAPE_VARIABLE : 0)) goto bail0; if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0)) goto bail0; - if (!FcNameUnparseValueList (&buf, e->values, - (FcChar8 *) FC_ESCAPE_VARIABLE)) + if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? + (FcChar8 *) FC_ESCAPE_VARIABLE : 0)) goto bail0; } } diff --git a/src/fcpat.c b/src/fcpat.c index 2a21a13..9cd01a0 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -1,6 +1,4 @@ /* - * $RCSId: xc/lib/fontconfig/src/fcpat.c,v 1.18 2002/09/18 17:11:46 tsi Exp $ - * * Copyright © 2000 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -22,10 +20,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include #include -#include "fcint.h" + +static FcBool +FcStrHashed (const FcChar8 *name); FcPattern * FcPatternCreate (void) @@ -38,7 +39,7 @@ FcPatternCreate (void) FcMemAlloc (FC_MEM_PATTERN, sizeof (FcPattern)); p->num = 0; p->size = 0; - p->elts = 0; + p->elts_offset = FcPtrToOffset (p, NULL); p->ref = 1; return p; } @@ -48,7 +49,8 @@ FcValueDestroy (FcValue v) { switch (v.type) { case FcTypeString: - FcStrFree ((FcChar8 *) v.u.s); + if (!FcStrHashed (v.u.s)) + FcStrFree ((FcChar8 *) v.u.s); break; case FcTypeMatrix: FcMatrixFree ((FcMatrix *) v.u.m); @@ -64,6 +66,32 @@ FcValueDestroy (FcValue v) } } +FcValue +FcValueCanonicalize (const FcValue *v) +{ + FcValue new; + + switch (v->type) + { + case FcTypeString: + new.u.s = fc_value_string(v); + new.type = FcTypeString; + break; + case FcTypeCharSet: + new.u.c = fc_value_charset(v); + new.type = FcTypeCharSet; + break; + case FcTypeLangSet: + new.u.l = fc_value_langset(v); + new.type = FcTypeLangSet; + break; + default: + new = *v; + break; + } + return new; +} + FcValue FcValueSave (FcValue v) { @@ -95,30 +123,33 @@ FcValueSave (FcValue v) } void -FcValueListDestroy (FcValueList *l) +FcValueListDestroy (FcValueListPtr l) { - FcValueList *next; + FcValueListPtr next; for (; l; l = next) { switch (l->value.type) { case FcTypeString: - FcStrFree ((FcChar8 *) l->value.u.s); + if (!FcStrHashed ((FcChar8 *)l->value.u.s)) + FcStrFree ((FcChar8 *)l->value.u.s); break; case FcTypeMatrix: - FcMatrixFree ((FcMatrix *) l->value.u.m); + FcMatrixFree ((FcMatrix *)l->value.u.m); break; case FcTypeCharSet: - FcCharSetDestroy ((FcCharSet *) l->value.u.c); + FcCharSetDestroy + ((FcCharSet *) (l->value.u.c)); break; case FcTypeLangSet: - FcLangSetDestroy ((FcLangSet *) l->value.u.l); + FcLangSetDestroy + ((FcLangSet *) (l->value.u.l)); break; default: break; } - next = l->next; + next = FcValueListNext(l); FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList)); - free (l); + free(l); } } @@ -173,7 +204,7 @@ FcDoubleHash (double d) return (FcChar32) d; } -static FcChar32 +FcChar32 FcStringHash (const FcChar8 *s) { FcChar8 c; @@ -186,37 +217,37 @@ FcStringHash (const FcChar8 *s) } static FcChar32 -FcValueHash (FcValue v) +FcValueHash (const FcValue *v) { - switch (v.type) { + switch (fc_storage_type(v)) { case FcTypeVoid: return 0; case FcTypeInteger: - return (FcChar32) v.u.i; + return (FcChar32) v->u.i; case FcTypeDouble: - return FcDoubleHash (v.u.d); + return FcDoubleHash (v->u.d); case FcTypeString: - return FcStringHash (v.u.s); + return FcStringHash (fc_value_string(v)); case FcTypeBool: - return (FcChar32) v.u.b; + return (FcChar32) v->u.b; case FcTypeMatrix: - return (FcDoubleHash (v.u.m->xx) ^ - FcDoubleHash (v.u.m->xy) ^ - FcDoubleHash (v.u.m->yx) ^ - FcDoubleHash (v.u.m->yy)); + return (FcDoubleHash (v->u.m->xx) ^ + FcDoubleHash (v->u.m->xy) ^ + FcDoubleHash (v->u.m->yx) ^ + FcDoubleHash (v->u.m->yy)); case FcTypeCharSet: - return (FcChar32) v.u.c->num; + return (FcChar32) fc_value_charset(v)->num; case FcTypeFTFace: - return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^ - FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name); + return FcStringHash ((const FcChar8 *) ((FT_Face) v->u.f)->family_name) ^ + FcStringHash ((const FcChar8 *) ((FT_Face) v->u.f)->style_name); case FcTypeLangSet: - return FcLangSetHash (v.u.l); + return FcLangSetHash (fc_value_langset(v)); } return FcFalse; } static FcBool -FcValueListEqual (FcValueList *la, FcValueList *lb) +FcValueListEqual (FcValueListPtr la, FcValueListPtr lb) { if (la == lb) return FcTrue; @@ -225,8 +256,8 @@ FcValueListEqual (FcValueList *la, FcValueList *lb) { if (!FcValueEqual (la->value, lb->value)) return FcFalse; - la = la->next; - lb = lb->next; + la = FcValueListNext(la); + lb = FcValueListNext(lb); } if (la || lb) return FcFalse; @@ -234,14 +265,13 @@ FcValueListEqual (FcValueList *la, FcValueList *lb) } static FcChar32 -FcValueListHash (FcValueList *l) +FcValueListHash (FcValueListPtr l) { FcChar32 hash = 0; - while (l) + for (; l; l = FcValueListNext(l)) { - hash = ((hash << 1) | (hash >> 31)) ^ FcValueHash (l->value); - l = l->next; + hash = ((hash << 1) | (hash >> 31)) ^ FcValueHash (&l->value); } return hash; } @@ -250,341 +280,27 @@ void FcPatternDestroy (FcPattern *p) { int i; + FcPatternElt *elts; if (p->ref == FC_REF_CONSTANT || --p->ref > 0) return; + elts = FcPatternElts (p); for (i = 0; i < p->num; i++) - FcValueListDestroy (p->elts[i].values); + FcValueListDestroy (FcPatternEltValues(&elts[i])); - p->num = 0; - if (p->elts) - { - FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt)); - free (p->elts); - p->elts = 0; - } - p->size = 0; + FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt)); + free (elts); FcMemFree (FC_MEM_PATTERN, sizeof (FcPattern)); free (p); } -#define FC_VALUE_LIST_HASH_SIZE 257 -#define FC_PATTERN_HASH_SIZE 67 - -typedef struct _FcValueListEnt FcValueListEnt; - -struct _FcValueListEnt { - FcValueListEnt *next; - FcValueList *list; - FcChar32 hash, pad; -}; - -typedef union _FcValueListAlign { - FcValueListEnt ent; - FcValueList list; -} FcValueListAlign; - -static int FcValueListFrozenCount[FcTypeLangSet + 1]; -static int FcValueListFrozenBytes[FcTypeLangSet + 1]; -static char *FcValueListFrozenName[] = { - "Void", - "Integer", - "Double", - "String", - "Bool", - "Matrix", - "CharSet", - "FTFace", - "LangSet" -}; - -void -FcValueListReport (void); - -void -FcValueListReport (void) -{ - FcType t; - - printf ("Fc Frozen Values:\n"); - printf ("\t%8s %9s %9s\n", "Type", "Count", "Bytes"); - for (t = FcTypeVoid; t <= FcTypeLangSet; t++) - printf ("\t%8s %9d %9d\n", FcValueListFrozenName[t], - FcValueListFrozenCount[t], FcValueListFrozenBytes[t]); -} - -static FcValueListEnt * -FcValueListEntCreate (FcValueList *h) -{ - FcValueListAlign *ea; - FcValueListEnt *e; - FcValueList *l, *new; - int n; - int size; - - n = 0; - for (l = h; l; l = l->next) - n++; - size = sizeof (FcValueListAlign) + n * sizeof (FcValueList); - FcValueListFrozenCount[h->value.type]++; - FcValueListFrozenBytes[h->value.type] += size; - ea = malloc (size); - if (!ea) - return 0; - FcMemAlloc (FC_MEM_VALLIST, size); - e = &ea->ent; - e->list = (FcValueList *) (ea + 1); - new = e->list; - for (l = h; l; l = l->next, new++) - { - if (l->value.type == FcTypeString) - { - new->value.type = FcTypeString; - new->value.u.s = (FcChar8 *) FcObjectStaticName ((char *) l->value.u.s); - } - else - { - new->value = FcValueSave (l->value); - } - new->binding = l->binding; - if (l->next) - new->next = new + 1; - else - new->next = 0; - } - return e; -} - -static void -FcValueListEntDestroy (FcValueListEnt *e) -{ - FcValueList *l; - - FcValueListFrozenCount[e->list->value.type]--; - - /* XXX: We should perform these two operations with "size" as - computed in FcValueListEntCreate, but we don't have access to - that value here. Without this, the FcValueListFrozenBytes - values will be wrong as will the FcMemFree counts. - - FcValueListFrozenBytes[e->list->value.type] -= size; - FcMemFree (FC_MEM_VALLIST, size); - */ - - for (l = e->list; l; l = l->next) - { - if (l->value.type != FcTypeString) - FcValueDestroy (l->value); - } - /* XXX: Are we being too chummy with the implementation here to - free(e) when it was actually the enclosing FcValueListAlign - that was allocated? */ - free (e); -} - -static int FcValueListTotal; -static int FcValueListUsed; - -static FcValueListEnt *FcValueListHashTable[FC_VALUE_LIST_HASH_SIZE]; - -static FcValueList * -FcValueListFreeze (FcValueList *l) -{ - FcChar32 hash = FcValueListHash (l); - FcValueListEnt **bucket = &FcValueListHashTable[hash % FC_VALUE_LIST_HASH_SIZE]; - FcValueListEnt *ent; - - FcValueListTotal++; - for (ent = *bucket; ent; ent = ent->next) - { - if (ent->hash == hash && FcValueListEqual (ent->list, l)) - return ent->list; - } - - ent = FcValueListEntCreate (l); - if (!ent) - return 0; - - FcValueListUsed++; - ent->hash = hash; - ent->next = *bucket; - *bucket = ent; - return ent->list; -} - -static void -FcValueListThawAll (void) -{ - int i; - FcValueListEnt *ent, *next; - - for (i = 0; i < FC_VALUE_LIST_HASH_SIZE; i++) - { - for (ent = FcValueListHashTable[i]; ent; ent = next) - { - next = ent->next; - FcValueListEntDestroy (ent); - } - FcValueListHashTable[i] = 0; - } - - FcValueListTotal = 0; - FcValueListUsed = 0; -} - -static FcChar32 -FcPatternBaseHash (FcPattern *b) -{ - FcChar32 hash = b->num; - int i; - - for (i = 0; i < b->num; i++) - hash = ((hash << 1) | (hash >> 31)) ^ ((long) b->elts[i].values); - return hash; -} - -typedef struct _FcPatternEnt FcPatternEnt; - -struct _FcPatternEnt { - FcPatternEnt *next; - FcChar32 hash; - FcPattern pattern; -}; - -static int FcPatternTotal; -static int FcPatternUsed; - -static FcPatternEnt *FcPatternHashTable[FC_VALUE_LIST_HASH_SIZE]; - -static FcPattern * -FcPatternBaseFreeze (FcPattern *b) -{ - FcChar32 hash = FcPatternBaseHash (b); - FcPatternEnt **bucket = &FcPatternHashTable[hash % FC_VALUE_LIST_HASH_SIZE]; - FcPatternEnt *ent; - int i; - int size; - - FcPatternTotal++; - for (ent = *bucket; ent; ent = ent->next) - { - if (ent->hash == hash && b->num == ent->pattern.num) - { - for (i = 0; i < b->num; i++) - { - if (b->elts[i].object != ent->pattern.elts[i].object) - break; - if (b->elts[i].values != ent->pattern.elts[i].values) - break; - } - if (i == b->num) - return &ent->pattern; - } - } - - /* - * Compute size of pattern + elts - */ - size = sizeof (FcPatternEnt) + b->num*sizeof (FcPatternElt); - ent = malloc (size); - if (!ent) - return 0; - - FcMemAlloc (FC_MEM_PATTERN, size); - FcPatternUsed++; - - ent->pattern.elts = (FcPatternElt *) (ent + 1); - ent->pattern.num = b->num; - ent->pattern.size = b->num; - ent->pattern.ref = FC_REF_CONSTANT; - - for (i = 0; i < b->num; i++) - { - ent->pattern.elts[i].values = b->elts[i].values; - ent->pattern.elts[i].object = b->elts[i].object; - } - - ent->hash = hash; - ent->next = *bucket; - *bucket = ent; - return &ent->pattern; -} - -static void -FcPatternBaseThawAll (void) -{ - int i; - FcPatternEnt *ent, *next; - - for (i = 0; i < FC_VALUE_LIST_HASH_SIZE; i++) - { - for (ent = FcPatternHashTable[i]; ent; ent = next) - { - next = ent->next; - free (ent); - } - FcPatternHashTable[i] = 0; - } - - FcPatternTotal = 0; - FcPatternUsed = 0; -} - -FcPattern * -FcPatternFreeze (FcPattern *p) -{ - FcPattern *b, *n = 0; - int size; - int i; - - if (p->ref == FC_REF_CONSTANT) - return p; - - size = sizeof (FcPattern) + p->num * sizeof (FcPatternElt); - b = (FcPattern *) malloc (size); - if (!b) - return 0; - FcMemAlloc (FC_MEM_PATTERN, size); - b->num = p->num; - b->size = b->num; - b->ref = 1; - b->elts = (FcPatternElt *) (b + 1); - /* - * Freeze object lists - */ - for (i = 0; i < p->num; i++) - { - b->elts[i].object = p->elts[i].object; - b->elts[i].values = FcValueListFreeze (p->elts[i].values); - if (!b->elts[i].values) - goto bail; - } - /* - * Freeze base - */ - n = FcPatternBaseFreeze (b); -#ifdef CHATTY - if (FcDebug() & FC_DBG_MEMORY) - { - printf ("ValueLists: total %9d used %9d\n", FcValueListTotal, FcValueListUsed); - printf ("Patterns: total %9d used %9d\n", FcPatternTotal, FcPatternUsed); - } -#endif -bail: - free (b); -#ifdef DEBUG - assert (FcPatternEqual (n, p)); -#endif - return n; -} - static int -FcPatternPosition (const FcPattern *p, const char *object) +FcPatternObjectPosition (const FcPattern *p, FcObject object) { int low, high, mid, c; + FcPatternElt *elts = FcPatternElts(p); - object = FcObjectStaticName(object); low = 0; high = p->num - 1; c = 1; @@ -592,7 +308,7 @@ FcPatternPosition (const FcPattern *p, const char *object) while (low <= high) { mid = (low + high) >> 1; - c = p->elts[mid].object - object; + c = elts[mid].object - object; if (c == 0) return mid; if (c < 0) @@ -606,78 +322,92 @@ FcPatternPosition (const FcPattern *p, const char *object) } FcPatternElt * -FcPatternFindElt (const FcPattern *p, const char *object) +FcPatternObjectFindElt (const FcPattern *p, FcObject object) { - int i = FcPatternPosition (p, object); + int i = FcPatternObjectPosition (p, object); if (i < 0) return 0; - return &p->elts[i]; + return &FcPatternElts(p)[i]; } FcPatternElt * -FcPatternInsertElt (FcPattern *p, const char *object) +FcPatternObjectInsertElt (FcPattern *p, FcObject object) { int i; FcPatternElt *e; - i = FcPatternPosition (p, object); + i = FcPatternObjectPosition (p, object); if (i < 0) { i = -i - 1; - /* grow array */ + /* reallocate array */ if (p->num + 1 >= p->size) { int s = p->size + 16; - if (p->elts) - e = (FcPatternElt *) realloc (p->elts, s * sizeof (FcPatternElt)); + if (p->size) + { + FcPatternElt *e0 = FcPatternElts(p); + e = (FcPatternElt *) realloc (e0, s * sizeof (FcPatternElt)); + if (!e) /* maybe it was mmapped */ + { + e = malloc(s * sizeof (FcPatternElt)); + if (e) + memcpy(e, e0, p->num * sizeof (FcPatternElt)); + } + } else e = (FcPatternElt *) malloc (s * sizeof (FcPatternElt)); if (!e) return FcFalse; - p->elts = e; + p->elts_offset = FcPtrToOffset (p, e); if (p->size) FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt)); FcMemAlloc (FC_MEM_PATELT, s * sizeof (FcPatternElt)); while (p->size < s) { - p->elts[p->size].object = 0; - p->elts[p->size].values = 0; + e[p->size].object = 0; + e[p->size].values = NULL; p->size++; } } + e = FcPatternElts(p); /* move elts up */ - memmove (p->elts + i + 1, - p->elts + i, + memmove (e + i + 1, + e + i, sizeof (FcPatternElt) * (p->num - i)); /* bump count */ p->num++; - p->elts[i].object = FcObjectStaticName (object); - p->elts[i].values = 0; + e[i].object = object; + e[i].values = NULL; } - return &p->elts[i]; + return FcPatternElts(p) + i; } FcBool FcPatternEqual (const FcPattern *pa, const FcPattern *pb) { int i; + FcPatternElt *pae, *pbe; if (pa == pb) return FcTrue; if (pa->num != pb->num) return FcFalse; + pae = FcPatternElts(pa); + pbe = FcPatternElts(pb); for (i = 0; i < pa->num; i++) { - if (pa->elts[i].object != pb->elts[i].object) + if (pae[i].object != pbe[i].object) return FcFalse; - if (!FcValueListEqual (pa->elts[i].values, pb->elts[i].values)) + if (!FcValueListEqual (FcPatternEltValues(&pae[i]), + FcPatternEltValues(&pbe[i]))) return FcFalse; } return FcTrue; @@ -688,31 +418,33 @@ FcPatternHash (const FcPattern *p) { int i; FcChar32 h = 0; + FcPatternElt *pe = FcPatternElts(p); for (i = 0; i < p->num; i++) { h = (((h << 1) | (h >> 31)) ^ - FcStringHash ((const FcChar8 *) p->elts[i].object) ^ - FcValueListHash (p->elts[i].values)); + pe[i].object ^ + FcValueListHash (FcPatternEltValues(&pe[i]))); } return h; } FcBool -FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os) +FcPatternEqualSubset (const FcPattern *pai, const FcPattern *pbi, const FcObjectSet *os) { FcPatternElt *ea, *eb; int i; for (i = 0; i < os->nobject; i++) { - ea = FcPatternFindElt (pa, os->objects[i]); - eb = FcPatternFindElt (pb, os->objects[i]); + FcObject object = FcObjectFromName (os->objects[i]); + ea = FcPatternObjectFindElt (pai, object); + eb = FcPatternObjectFindElt (pbi, object); if (ea) { if (!eb) return FcFalse; - if (!FcValueListEqual (ea->values, eb->values)) + if (!FcValueListEqual (FcPatternEltValues(ea), FcPatternEltValues(eb))) return FcFalse; } else @@ -725,39 +457,62 @@ FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSe } FcBool -FcPatternAddWithBinding (FcPattern *p, - const char *object, - FcValue value, - FcValueBinding binding, - FcBool append) +FcPatternObjectAddWithBinding (FcPattern *p, + FcObject object, + FcValue value, + FcValueBinding binding, + FcBool append) { FcPatternElt *e; - FcValueList *new, **prev; + FcValueListPtr new, *prev; if (p->ref == FC_REF_CONSTANT) goto bail0; - new = (FcValueList *) malloc (sizeof (FcValueList)); + new = malloc (sizeof (FcValueList)); if (!new) goto bail0; + memset(new, 0, sizeof (FcValueList)); FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList)); /* dup string */ - value = FcValueSave (value); + if (value.type == FcTypeString) + { + value.u.s = FcStrStaticName (value.u.s); + if (!value.u.s) + value.type = FcTypeVoid; + } + else + value = FcValueSave (value); if (value.type == FcTypeVoid) goto bail1; + /* + * Make sure the stored type is valid for built-in objects + */ + if (!FcObjectValidType (object, value.type)) + { + if (FcDebug() & FC_DBG_OBJTYPES) + { + printf ("FcPattern object %s does not accept value ", + FcObjectName (object)); + FcValuePrint (value); + } + goto bail1; + } + new->value = value; new->binding = binding; - new->next = 0; + new->next = NULL; - e = FcPatternInsertElt (p, object); + e = FcPatternObjectInsertElt (p, object); if (!e) goto bail2; if (append) { - for (prev = &e->values; *prev; prev = &(*prev)->next); + for (prev = &e->values; *prev; prev = &(*prev)->next) + ; *prev = new; } else @@ -769,22 +524,7 @@ FcPatternAddWithBinding (FcPattern *p, return FcTrue; bail2: - switch (value.type) { - case FcTypeString: - FcStrFree ((FcChar8 *) value.u.s); - break; - case FcTypeMatrix: - FcMatrixFree ((FcMatrix *) value.u.m); - break; - case FcTypeCharSet: - FcCharSetDestroy ((FcCharSet *) value.u.c); - break; - case FcTypeLangSet: - FcLangSetDestroy ((FcLangSet *) value.u.l); - break; - default: - break; - } + FcValueDestroy (value); bail1: FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList)); free (new); @@ -792,48 +532,63 @@ bail0: return FcFalse; } +FcBool +FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append) +{ + return FcPatternObjectAddWithBinding (p, object, + value, FcValueBindingStrong, append); +} + FcBool FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append) { - return FcPatternAddWithBinding (p, object, value, FcValueBindingStrong, append); + return FcPatternObjectAddWithBinding (p, FcObjectFromName (object), + value, FcValueBindingStrong, append); } FcBool FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append) { - return FcPatternAddWithBinding (p, object, value, FcValueBindingWeak, append); + return FcPatternObjectAddWithBinding (p, FcObjectFromName (object), + value, FcValueBindingWeak, append); } FcBool -FcPatternDel (FcPattern *p, const char *object) +FcPatternObjectDel (FcPattern *p, FcObject object) { FcPatternElt *e; - int i; - e = FcPatternFindElt (p, object); + e = FcPatternObjectFindElt (p, object); if (!e) return FcFalse; - i = e - p->elts; - /* destroy value */ FcValueListDestroy (e->values); /* shuffle existing ones down */ - memmove (e, e+1, (p->elts + p->num - (e + 1)) * sizeof (FcPatternElt)); + memmove (e, e+1, + (FcPatternElts(p) + p->num - (e + 1)) * + sizeof (FcPatternElt)); p->num--; - p->elts[p->num].object = 0; - p->elts[p->num].values = 0; + e = FcPatternElts(p) + p->num; + e->object = 0; + e->values = NULL; return FcTrue; } +FcBool +FcPatternDel (FcPattern *p, const char *object) +{ + return FcPatternObjectDel (p, FcObjectFromName (object)); +} + FcBool FcPatternRemove (FcPattern *p, const char *object, int id) { - FcPatternElt *e; - FcValueList **prev, *l; + FcPatternElt *e; + FcValueListPtr *prev, l; - e = FcPatternFindElt (p, object); + e = FcPatternObjectFindElt (p, FcObjectFromName (object)); if (!e) return FcFalse; for (prev = &e->values; (l = *prev); prev = &l->next) @@ -841,7 +596,7 @@ FcPatternRemove (FcPattern *p, const char *object, int id) if (!id) { *prev = l->next; - l->next = 0; + l->next = NULL; FcValueListDestroy (l); if (!e->values) FcPatternDel (p, object); @@ -853,34 +608,59 @@ FcPatternRemove (FcPattern *p, const char *object, int id) } FcBool -FcPatternAddInteger (FcPattern *p, const char *object, int i) +FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i) { FcValue v; v.type = FcTypeInteger; v.u.i = i; - return FcPatternAdd (p, object, v, FcTrue); + return FcPatternObjectAdd (p, object, v, FcTrue); } FcBool -FcPatternAddDouble (FcPattern *p, const char *object, double d) +FcPatternAddInteger (FcPattern *p, const char *object, int i) +{ + return FcPatternObjectAddInteger (p, FcObjectFromName (object), i); +} + +FcBool +FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d) { FcValue v; v.type = FcTypeDouble; v.u.d = d; - return FcPatternAdd (p, object, v, FcTrue); + return FcPatternObjectAdd (p, object, v, FcTrue); } FcBool -FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s) +FcPatternAddDouble (FcPattern *p, const char *object, double d) +{ + return FcPatternObjectAddDouble (p, FcObjectFromName (object), d); +} + +FcBool +FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s) { FcValue v; + if (!s) + { + v.type = FcTypeVoid; + v.u.s = 0; + return FcPatternObjectAdd (p, object, v, FcTrue); + } + v.type = FcTypeString; - v.u.s = s; - return FcPatternAdd (p, object, v, FcTrue); + v.u.s = FcStrStaticName(s); + return FcPatternObjectAdd (p, object, v, FcTrue); +} + +FcBool +FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s) +{ + return FcPatternObjectAddString (p, FcObjectFromName (object), s); } FcBool @@ -889,19 +669,25 @@ FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s) FcValue v; v.type = FcTypeMatrix; - v.u.m = (FcMatrix *) s; + v.u.m = s; return FcPatternAdd (p, object, v, FcTrue); } FcBool -FcPatternAddBool (FcPattern *p, const char *object, FcBool b) +FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b) { FcValue v; v.type = FcTypeBool; v.u.b = b; - return FcPatternAdd (p, object, v, FcTrue); + return FcPatternObjectAdd (p, object, v, FcTrue); +} + +FcBool +FcPatternAddBool (FcPattern *p, const char *object, FcBool b) +{ + return FcPatternObjectAddBool (p, FcObjectFromName (object), b); } FcBool @@ -910,7 +696,7 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c) FcValue v; v.type = FcTypeCharSet; - v.u.c = (FcCharSet *) c; + v.u.c = (FcCharSet *)c; return FcPatternAdd (p, object, v, FcTrue); } @@ -930,24 +716,24 @@ FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls) FcValue v; v.type = FcTypeLangSet; - v.u.l = (FcLangSet *) ls; + v.u.l = (FcLangSet *)ls; return FcPatternAdd (p, object, v, FcTrue); } FcResult -FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v) +FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v) { FcPatternElt *e; - FcValueList *l; + FcValueListPtr l; - e = FcPatternFindElt (p, object); + e = FcPatternObjectFindElt (p, object); if (!e) return FcResultNoMatch; - for (l = e->values; l; l = l->next) + for (l = FcPatternEltValues(e); l; l = FcValueListNext(l)) { if (!id) { - *v = l->value; + *v = FcValueCanonicalize(&l->value); return FcResultMatch; } id--; @@ -956,12 +742,18 @@ FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v) } FcResult -FcPatternGetInteger (const FcPattern *p, const char *object, int id, int *i) +FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v) +{ + return FcPatternObjectGet (p, FcObjectFromName (object), id, v); +} + +FcResult +FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int id, int *i) { FcValue v; FcResult r; - r = FcPatternGet (p, object, id, &v); + r = FcPatternObjectGet (p, object, id, &v); if (r != FcResultMatch) return r; switch (v.type) { @@ -978,12 +770,19 @@ FcPatternGetInteger (const FcPattern *p, const char *object, int id, int *i) } FcResult -FcPatternGetDouble (const FcPattern *p, const char *object, int id, double *d) +FcPatternGetInteger (const FcPattern *p, const char *object, int id, int *i) +{ + return FcPatternObjectGetInteger (p, FcObjectFromName (object), id, i); +} + + +FcResult +FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int id, double *d) { FcValue v; FcResult r; - r = FcPatternGet (p, object, id, &v); + r = FcPatternObjectGet (p, object, id, &v); if (r != FcResultMatch) return r; switch (v.type) { @@ -1000,20 +799,33 @@ FcPatternGetDouble (const FcPattern *p, const char *object, int id, double *d) } FcResult -FcPatternGetString (const FcPattern *p, const char *object, int id, FcChar8 ** s) +FcPatternGetDouble (const FcPattern *p, const char *object, int id, double *d) +{ + return FcPatternObjectGetDouble (p, FcObjectFromName (object), id, d); +} + +FcResult +FcPatternObjectGetString (const FcPattern *p, FcObject object, int id, FcChar8 ** s) { FcValue v; FcResult r; - r = FcPatternGet (p, object, id, &v); + r = FcPatternObjectGet (p, object, id, &v); if (r != FcResultMatch) return r; if (v.type != FcTypeString) return FcResultTypeMismatch; + *s = (FcChar8 *) v.u.s; return FcResultMatch; } +FcResult +FcPatternGetString (const FcPattern *p, const char *object, int id, FcChar8 ** s) +{ + return FcPatternObjectGetString (p, FcObjectFromName (object), id, s); +} + FcResult FcPatternGetMatrix(const FcPattern *p, const char *object, int id, FcMatrix **m) { @@ -1025,7 +837,7 @@ FcPatternGetMatrix(const FcPattern *p, const char *object, int id, FcMatrix **m) return r; if (v.type != FcTypeMatrix) return FcResultTypeMismatch; - *m = (FcMatrix *) v.u.m; + *m = (FcMatrix *)v.u.m; return FcResultMatch; } @@ -1056,7 +868,7 @@ FcPatternGetCharSet(const FcPattern *p, const char *object, int id, FcCharSet ** return r; if (v.type != FcTypeCharSet) return FcResultTypeMismatch; - *c = (FcCharSet *) v.u.c; + *c = (FcCharSet *)v.u.c; return FcResultMatch; } @@ -1086,7 +898,7 @@ FcPatternGetLangSet(const FcPattern *p, const char *object, int id, FcLangSet ** return r; if (v.type != FcTypeLangSet) return FcResultTypeMismatch; - *ls = (FcLangSet *) v.u.l; + *ls = (FcLangSet *)v.u.l; return FcResultMatch; } @@ -1094,17 +906,22 @@ FcPattern * FcPatternDuplicate (const FcPattern *orig) { FcPattern *new; + FcPatternElt *e; int i; - FcValueList *l; + FcValueListPtr l; new = FcPatternCreate (); if (!new) goto bail0; + e = FcPatternElts(orig); + for (i = 0; i < orig->num; i++) { - for (l = orig->elts[i].values; l; l = l->next) - if (!FcPatternAdd (new, orig->elts[i].object, l->value, FcTrue)) + for (l = FcPatternEltValues(e + i); l; l = FcValueListNext(l)) + if (!FcPatternObjectAdd (new, e[i].object, + FcValueCanonicalize(&l->value), + FcTrue)) goto bail1; } @@ -1151,15 +968,16 @@ FcPatternAppend (FcPattern *p, FcPattern *s) { int i; FcPatternElt *e; - FcValueList *v; + FcValueListPtr v; for (i = 0; i < s->num; i++) { - e = &s->elts[i]; - for (v = e->values; v; v = v->next) + e = FcPatternElts(s)+i; + for (v = FcPatternEltValues(e); v; v = FcValueListNext(v)) { - if (!FcPatternAddWithBinding (p, e->object, - v->value, v->binding, FcTrue)) + if (!FcPatternObjectAddWithBinding (p, e->object, + FcValueCanonicalize(&v->value), + v->binding, FcTrue)) return FcFalse; } } @@ -1172,31 +990,45 @@ static struct objectBucket { FcChar32 hash; } *FcObjectBuckets[OBJECT_HASH_SIZE]; -const char * -FcObjectStaticName (const char *name) +static FcBool +FcStrHashed (const FcChar8 *name) +{ + FcChar32 hash = FcStringHash (name); + struct objectBucket **p; + struct objectBucket *b; + + for (p = &FcObjectBuckets[hash % OBJECT_HASH_SIZE]; (b = *p); p = &(b->next)) + if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1))) + return FcTrue; + return FcFalse; +} + +const FcChar8 * +FcStrStaticName (const FcChar8 *name) { - FcChar32 hash = FcStringHash ((const FcChar8 *) name); + FcChar32 hash = FcStringHash (name); struct objectBucket **p; struct objectBucket *b; int size; for (p = &FcObjectBuckets[hash % OBJECT_HASH_SIZE]; (b = *p); p = &(b->next)) - if (b->hash == hash && !strcmp (name, (char *) (b + 1))) - return (char *) (b + 1); - size = sizeof (struct objectBucket) + strlen (name) + 1; - b = malloc (size); - FcMemAlloc (FC_MEM_STATICSTR, size); + if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1))) + return (FcChar8 *) (b + 1); + size = sizeof (struct objectBucket) + strlen ((char *)name) + 1; + b = malloc (size + sizeof (int)); + /* workaround glibc bug which reads strlen in groups of 4 */ + FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int)); if (!b) - return NULL; + return NULL; b->next = 0; b->hash = hash; - strcpy ((char *) (b + 1), name); + strcpy ((char *) (b + 1), (char *)name); *p = b; - return (char *) (b + 1); + return (FcChar8 *) (b + 1); } static void -FcObjectStaticNameFini (void) +FcStrStaticNameFini (void) { int i, size; struct objectBucket *b, *next; @@ -1219,7 +1051,152 @@ FcObjectStaticNameFini (void) void FcPatternFini (void) { - FcPatternBaseThawAll (); - FcValueListThawAll (); - FcObjectStaticNameFini (); + FcStrStaticNameFini (); + FcObjectFini (); +} + +FcBool +FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat) +{ + int i; + FcPatternElt *elts = FcPatternElts(pat); + + if (!FcSerializeAlloc (serialize, pat, sizeof (FcPattern))) + return FcFalse; + if (!FcSerializeAlloc (serialize, elts, pat->num * sizeof (FcPatternElt))) + return FcFalse; + for (i = 0; i < pat->num; i++) + if (!FcValueListSerializeAlloc (serialize, FcPatternEltValues(elts+i))) + return FcFalse; + return FcTrue; +} + +FcPattern * +FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat) +{ + FcPattern *pat_serialized; + FcPatternElt *elts = FcPatternElts (pat); + FcPatternElt *elts_serialized; + FcValueList *values_serialized; + int i; + + pat_serialized = FcSerializePtr (serialize, pat); + if (!pat_serialized) + return NULL; + *pat_serialized = *pat; + pat_serialized->size = pat->num; + pat_serialized->ref = FC_REF_CONSTANT; + + elts_serialized = FcSerializePtr (serialize, elts); + if (!elts_serialized) + return NULL; + + pat_serialized->elts_offset = FcPtrToOffset (pat_serialized, + elts_serialized); + + for (i = 0; i < pat->num; i++) + { + values_serialized = FcValueListSerialize (serialize, FcPatternEltValues (elts+i)); + if (!values_serialized) + return NULL; + elts_serialized[i].object = elts[i].object; + elts_serialized[i].values = FcPtrToEncodedOffset (&elts_serialized[i], + values_serialized, + FcValueList); + } + if (FcDebug() & FC_DBG_CACHEV) { + printf ("Raw pattern:\n"); + FcPatternPrint (pat); + printf ("Serialized pattern:\n"); + FcPatternPrint (pat_serialized); + printf ("\n"); + } + return pat_serialized; +} + +FcBool +FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *vl) +{ + while (vl) + { + if (!FcSerializeAlloc (serialize, vl, sizeof (FcValueList))) + return FcFalse; + switch (vl->value.type) { + case FcTypeString: + if (!FcStrSerializeAlloc (serialize, vl->value.u.s)) + return FcFalse; + break; + case FcTypeCharSet: + if (!FcCharSetSerializeAlloc (serialize, vl->value.u.c)) + return FcFalse; + break; + case FcTypeLangSet: + if (!FcLangSetSerializeAlloc (serialize, vl->value.u.l)) + return FcFalse; + break; + default: + break; + } + vl = vl->next; + } + return FcTrue; +} + +FcValueList * +FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl) +{ + FcValueList *vl_serialized; + FcChar8 *s_serialized; + FcCharSet *c_serialized; + FcLangSet *l_serialized; + FcValueList *head_serialized = NULL; + FcValueList *prev_serialized = NULL; + + while (vl) + { + vl_serialized = FcSerializePtr (serialize, vl); + if (!vl_serialized) + return NULL; + + if (prev_serialized) + prev_serialized->next = FcPtrToEncodedOffset (prev_serialized, + vl_serialized, + FcValueList); + else + head_serialized = vl_serialized; + + vl_serialized->next = NULL; + vl_serialized->value = vl->value; + switch (vl->value.type) { + case FcTypeString: + s_serialized = FcStrSerialize (serialize, vl->value.u.s); + if (!s_serialized) + return NULL; + vl_serialized->value.u.s = FcPtrToEncodedOffset (&vl_serialized->value, + s_serialized, + FcChar8); + break; + case FcTypeCharSet: + c_serialized = FcCharSetSerialize (serialize, vl->value.u.c); + if (!c_serialized) + return NULL; + vl_serialized->value.u.c = FcPtrToEncodedOffset (&vl_serialized->value, + c_serialized, + FcCharSet); + break; + case FcTypeLangSet: + l_serialized = FcLangSetSerialize (serialize, vl->value.u.l); + if (!l_serialized) + return NULL; + vl_serialized->value.u.l = FcPtrToEncodedOffset (&vl_serialized->value, + l_serialized, + FcLangSet); + break; + default: + break; + } + prev_serialized = vl_serialized; + vl = vl->next; + } + return head_serialized; } diff --git a/src/fcserialize.c b/src/fcserialize.c new file mode 100644 index 0000000..d0d35e3 --- /dev/null +++ b/src/fcserialize.c @@ -0,0 +1,161 @@ +/* + * Copyright © 2006 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "fcint.h" + +typedef union _FcAlign { + double d; + int i; + intptr_t ip; + FcBool b; + void *p; +} FcAlign; + +intptr_t +FcAlignSize (intptr_t size) +{ + intptr_t rem = size % sizeof (FcAlign); + if (rem) + size += sizeof (FcAlign) - rem; + return size; +} + +/* + * Serialization helper object -- allocate space in the + * yet-to-be-created linear array for a serialized font set + */ + +FcSerialize * +FcSerializeCreate (void) +{ + FcSerialize *serialize; + + serialize = malloc (sizeof (FcSerialize)); + if (!serialize) + return NULL; + serialize->size = 0; + serialize->linear = NULL; + serialize->cs_freezer = NULL; + memset (serialize->buckets, '\0', sizeof (serialize->buckets)); + return serialize; +} + +void +FcSerializeDestroy (FcSerialize *serialize) +{ + uintptr_t bucket; + + for (bucket = 0; bucket < FC_SERIALIZE_HASH_SIZE; bucket++) + { + FcSerializeBucket *buck, *next; + + for (buck = serialize->buckets[bucket]; buck; buck = next) { + next = buck->next; + free (buck); + } + } + if (serialize->cs_freezer) + FcCharSetFreezerDestroy (serialize->cs_freezer); + free (serialize); +} + +/* + * Allocate space for an object in the serialized array. Keep track + * of where the object is placed and only allocate one copy of each object + */ + +FcBool +FcSerializeAlloc (FcSerialize *serialize, const void *object, int size) +{ + uintptr_t bucket = ((uintptr_t) object) % FC_SERIALIZE_HASH_SIZE; + FcSerializeBucket *buck; + + for (buck = serialize->buckets[bucket]; buck; buck = buck->next) + if (buck->object == object) + return FcTrue; + buck = malloc (sizeof (FcSerializeBucket)); + if (!buck) + return FcFalse; + buck->object = object; + buck->offset = serialize->size; + buck->next = serialize->buckets[bucket]; + serialize->buckets[bucket] = buck; + serialize->size += FcAlignSize (size); + return FcTrue; +} + +/* + * Reserve space in the serialization array + */ +intptr_t +FcSerializeReserve (FcSerialize *serialize, int size) +{ + intptr_t offset = serialize->size; + serialize->size += FcAlignSize (size); + return offset; +} + +/* + * Given an object, return the offset in the serialized array where + * the serialized copy of the object is stored + */ +intptr_t +FcSerializeOffset (FcSerialize *serialize, const void *object) +{ + uintptr_t bucket = ((uintptr_t) object) % FC_SERIALIZE_HASH_SIZE; + FcSerializeBucket *buck; + + for (buck = serialize->buckets[bucket]; buck; buck = buck->next) + if (buck->object == object) + return buck->offset; + return 0; +} + +/* + * Given a cache and an object, return a pointer to where + * the serialized copy of the object is stored + */ +void * +FcSerializePtr (FcSerialize *serialize, const void *object) +{ + intptr_t offset = FcSerializeOffset (serialize, object); + + if (!offset) + return NULL; + return (void *) ((char *) serialize->linear + offset); +} + +FcBool +FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str) +{ + return FcSerializeAlloc (serialize, str, strlen ((const char *) str) + 1); +} + +FcChar8 * +FcStrSerialize (FcSerialize *serialize, const FcChar8 *str) +{ + FcChar8 *str_serialize = FcSerializePtr (serialize, str); + if (!str_serialize) + return NULL; + strcpy ((char *) str_serialize, (const char *) str); + return str_serialize; +} diff --git a/src/fcstr.c b/src/fcstr.c index fb715a4..5faf579 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -22,23 +22,25 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "fcint.h" #include #include #include -#include "fcint.h" FcChar8 * FcStrCopy (const FcChar8 *s) { - FcChar8 *r; + int len; + FcChar8 *r; if (!s) return 0; - r = (FcChar8 *) malloc (strlen ((char *) s) + 1); + len = strlen ((char *) s) + 1; + r = (FcChar8 *) malloc (len); if (!r) return 0; - FcMemAlloc (FC_MEM_STRING, strlen ((char *) s) + 1); - strcpy ((char *) r, (char *) s); + FcMemAlloc (FC_MEM_STRING, len); + memcpy (r, s, len); return r; } @@ -74,7 +76,6 @@ FcStrFree (FcChar8 *s) typedef struct _FcCaseWalker { const FcChar8 *read; const FcChar8 *src; - int len; FcChar8 utf8[FC_MAX_CASE_FOLD_CHARS + 1]; } FcCaseWalker; @@ -83,7 +84,6 @@ FcStrCaseWalkerInit (const FcChar8 *src, FcCaseWalker *w) { w->src = src; w->read = 0; - w->len = strlen ((char *) src); } static FcChar8 @@ -91,8 +91,9 @@ FcStrCaseWalkerLong (FcCaseWalker *w, FcChar8 r) { FcChar32 ucs4; int slen; + int len = strlen((char*)w->src); - slen = FcUtf8ToUcs4 (w->src - 1, &ucs4, w->len + 1); + slen = FcUtf8ToUcs4 (w->src - 1, &ucs4, len + 1); if (slen <= 0) return r; if (FC_MIN_FOLD_CHAR <= ucs4 && ucs4 <= FC_MAX_FOLD_CHAR) @@ -131,7 +132,6 @@ FcStrCaseWalkerLong (FcCaseWalker *w, FcChar8 r) /* consume rest of src utf-8 bytes */ w->src += slen - 1; - w->len -= slen - 1; /* read from temp buffer */ w->utf8[dlen] = '\0'; @@ -155,7 +155,6 @@ FcStrCaseWalkerNext (FcCaseWalker *w) w->read = 0; } r = *w->src++; - --w->len; if ((r & 0xc0) == 0xc0) return FcStrCaseWalkerLong (w, r); @@ -178,7 +177,6 @@ FcStrCaseWalkerNextIgnoreBlanks (FcCaseWalker *w) do { r = *w->src++; - --w->len; } while (r == ' '); if ((r & 0xc0) == 0xc0) @@ -453,8 +451,7 @@ again: ++ s1; ++ s2; } - - return 0; + /* never reached. */ } int @@ -711,7 +708,7 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c) } else { - size = buf->size + 1024; + size = buf->size + 64; new = malloc (size); if (new) { @@ -767,26 +764,21 @@ FcStrCopyFilename (const FcChar8 *s) if (*s == '~') { FcChar8 *home = FcConfigHome (); + FcChar8 *full; int size; if (!home) return 0; size = strlen ((char *) home) + strlen ((char *) s); - new = (FcChar8 *) malloc (size); - if (!new) + full = (FcChar8 *) malloc (size); + if (!full) return 0; - FcMemAlloc (FC_MEM_STRING, size); - strcpy ((char *) new, (char *) home); - strcat ((char *) new, (char *) s + 1); + strcpy ((char *) full, (char *) home); + strcat ((char *) full, (char *) s + 1); + new = FcStrCanonFilename (full); + free (full); } else - { - int size = strlen ((char *) s) + 1; - new = (FcChar8 *) malloc (size); - if (!new) - return 0; - FcMemAlloc (FC_MEM_STRING, size); - strcpy ((char *) new, (const char *) s); - } + new = FcStrCanonFilename (s); return new; } @@ -838,6 +830,66 @@ FcStrBasename (const FcChar8 *file) return FcStrCopy (slash + 1); } +FcChar8 * +FcStrCanonFilename (const FcChar8 *s) +{ + FcChar8 *file; + FcChar8 *f; + const FcChar8 *slash; + int size; + + if (*s != '/') + { + FcChar8 *full; + + FcChar8 cwd[FC_MAX_FILE_LEN + 2]; + if (getcwd ((char *) cwd, FC_MAX_FILE_LEN) == NULL) + return NULL; + strcat ((char *) cwd, "/"); + full = FcStrPlus (cwd, s); + file = FcStrCanonFilename (full); + FcStrFree (full); + return file; + } + size = strlen ((char *) s) + 1; + file = malloc (size); + if (!file) + return NULL; + FcMemAlloc (FC_MEM_STRING, size); + slash = NULL; + f = file; + for (;;) { + if (*s == '/' || *s == '\0') + { + if (slash) + { + switch (s - slash) { + case 2: + if (!strncmp ((char *) slash, "/.", 2)) + { + f -= 2; /* trim /. from file */ + } + break; + case 3: + if (!strncmp ((char *) slash, "/..", 3)) + { + f -= 3; /* trim /.. from file */ + while (f > file) { + if (*--f == '/') + break; + } + } + break; + } + } + slash = s; + } + if (!(*f++ = *s++)) + break; + } + return file; +} + FcStrSet * FcStrSetCreate (void) { @@ -998,3 +1050,4 @@ FcStrListDone (FcStrList *list) FcMemFree (FC_MEM_STRLIST, sizeof (FcStrList)); free (list); } + diff --git a/src/fcxml.c b/src/fcxml.c index 7a48628..d91e522 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -22,10 +22,24 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include #include "fcint.h" +#include +#include #include +#ifdef ENABLE_LIBXML2 + +#include + +#define XML_Char xmlChar +#define XML_Parser xmlParserCtxtPtr +#define XML_ParserFree xmlFreeParserCtxt +#define XML_GetCurrentLineNumber xmlSAX2GetLineNumber +#define XML_GetErrorCode xmlCtxtGetLastError +#define XML_ErrorString(Error) (Error)->message + +#else /* ENABLE_LIBXML2 */ + #ifndef HAVE_XMLPARSE_H #define HAVE_XMLPARSE_H 0 #endif @@ -36,6 +50,8 @@ #include #endif +#endif /* ENABLE_LIBXML2 */ + #ifdef _WIN32 #define STRICT #include @@ -49,7 +65,6 @@ FcTestDestroy (FcTest *test) if (test->next) FcTestDestroy (test->next); FcExprDestroy (test->expr); - FcStrFree ((FcChar8 *) test->field); FcMemFree (FC_MEM_TEST, sizeof (FcTest)); free (test); } @@ -146,7 +161,7 @@ FcExprCreateField (const char *field) { FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr)); e->op = FcOpField; - e->u.field = (char *) FcStrCopy ((FcChar8 *) field); + e->u.object = FcObjectFromName (field); } return e; } @@ -202,7 +217,6 @@ FcExprDestroy (FcExpr *e) case FcOpBool: break; case FcOpField: - FcStrFree ((FcChar8 *) e->u.field); break; case FcOpConst: FcStrFree (e->u.constant); @@ -253,7 +267,6 @@ FcEditDestroy (FcEdit *e) { if (e->next) FcEditDestroy (e->next); - FcStrFree ((FcChar8 *) e->field); if (e->expr) FcExprDestroy (e->expr); free (e); @@ -269,6 +282,7 @@ typedef enum _FcElement { FcElementNone, FcElementFontconfig, FcElementDir, + FcElementCacheDir, FcElementCache, FcElementInclude, FcElementConfig, @@ -323,72 +337,73 @@ typedef enum _FcElement { FcElementUnknown } FcElement; +static const struct { + const char name[16]; + FcElement element; +} fcElementMap[] = { + { "fontconfig", FcElementFontconfig }, + { "dir", FcElementDir }, + { "cachedir", FcElementCacheDir }, + { "cache", FcElementCache }, + { "include", FcElementInclude }, + { "config", FcElementConfig }, + { "match", FcElementMatch }, + { "alias", FcElementAlias }, + + { "blank", FcElementBlank }, + { "rescan", FcElementRescan }, + + { "prefer", FcElementPrefer }, + { "accept", FcElementAccept }, + { "default", FcElementDefault }, + { "family", FcElementFamily }, + + { "selectfont", FcElementSelectfont }, + { "acceptfont", FcElementAcceptfont }, + { "rejectfont", FcElementRejectfont }, + { "glob", FcElementGlob }, + { "pattern", FcElementPattern }, + { "patelt", FcElementPatelt }, + + { "test", FcElementTest }, + { "edit", FcElementEdit }, + { "int", FcElementInt }, + { "double", FcElementDouble }, + { "string", FcElementString }, + { "matrix", FcElementMatrix }, + { "bool", FcElementBool }, + { "charset", FcElementCharset }, + { "name", FcElementName }, + { "const", FcElementConst }, + { "or", FcElementOr }, + { "and", FcElementAnd }, + { "eq", FcElementEq }, + { "not_eq", FcElementNotEq }, + { "less", FcElementLess }, + { "less_eq", FcElementLessEq }, + { "more", FcElementMore }, + { "more_eq", FcElementMoreEq }, + { "contains", FcElementContains }, + { "not_contains", FcElementNotContains }, + { "plus", FcElementPlus }, + { "minus", FcElementMinus }, + { "times", FcElementTimes }, + { "divide", FcElementDivide }, + { "not", FcElementNot }, + { "if", FcElementIf }, + { "floor", FcElementFloor }, + { "ceil", FcElementCeil }, + { "round", FcElementRound }, + { "trunc", FcElementTrunc }, +}; +#define NUM_ELEMENT_MAPS (int) (sizeof fcElementMap / sizeof fcElementMap[0]) + static FcElement FcElementMap (const XML_Char *name) { - static struct { - char *name; - FcElement element; - } fcElementMap[] = { - { "fontconfig", FcElementFontconfig }, - { "dir", FcElementDir }, - { "cache", FcElementCache }, - { "include", FcElementInclude }, - { "config", FcElementConfig }, - { "match", FcElementMatch }, - { "alias", FcElementAlias }, - - { "blank", FcElementBlank }, - { "rescan", FcElementRescan }, - - { "prefer", FcElementPrefer }, - { "accept", FcElementAccept }, - { "default", FcElementDefault }, - { "family", FcElementFamily }, - - { "selectfont", FcElementSelectfont }, - { "acceptfont", FcElementAcceptfont }, - { "rejectfont", FcElementRejectfont }, - { "glob", FcElementGlob }, - { "pattern", FcElementPattern }, - { "patelt", FcElementPatelt }, - - { "test", FcElementTest }, - { "edit", FcElementEdit }, - { "int", FcElementInt }, - { "double", FcElementDouble }, - { "string", FcElementString }, - { "matrix", FcElementMatrix }, - { "bool", FcElementBool }, - { "charset", FcElementCharset }, - { "name", FcElementName }, - { "const", FcElementConst }, - { "or", FcElementOr }, - { "and", FcElementAnd }, - { "eq", FcElementEq }, - { "not_eq", FcElementNotEq }, - { "less", FcElementLess }, - { "less_eq", FcElementLessEq }, - { "more", FcElementMore }, - { "more_eq", FcElementMoreEq }, - { "contains", FcElementContains }, - { "not_contains",FcElementNotContains }, - { "plus", FcElementPlus }, - { "minus", FcElementMinus }, - { "times", FcElementTimes }, - { "divide", FcElementDivide }, - { "not", FcElementNot }, - { "if", FcElementIf }, - { "floor", FcElementFloor }, - { "ceil", FcElementCeil }, - { "round", FcElementRound }, - { "trunc", FcElementTrunc }, - - { 0, 0 } - }; int i; - for (i = 0; fcElementMap[i].name; i++) + for (i = 0; i < NUM_ELEMENT_MAPS; i++) if (!strcmp ((char *) name, fcElementMap[i].name)) return fcElementMap[i].element; return FcElementUnknown; @@ -461,9 +476,9 @@ typedef enum _FcConfigSeverity { } FcConfigSeverity; static void -FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, char *fmt, ...) +FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, const char *fmt, ...) { - char *s = "unknown"; + const char *s = "unknown"; va_list args; va_start (args, fmt); @@ -477,10 +492,10 @@ FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, char *fmt, ...) { if (parse->name) fprintf (stderr, "Fontconfig %s: \"%s\", line %d: ", s, - parse->name, XML_GetCurrentLineNumber (parse->parser)); + parse->name, (int)XML_GetCurrentLineNumber (parse->parser)); else fprintf (stderr, "Fontconfig %s: line %d: ", s, - XML_GetCurrentLineNumber (parse->parser)); + (int)XML_GetCurrentLineNumber (parse->parser)); if (severe >= FcSevereError) parse->error = FcTrue; } @@ -492,7 +507,7 @@ FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, char *fmt, ...) } -static char * +static const char * FcTypeName (FcType type) { switch (type) { @@ -561,7 +576,7 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type) case FcOpNil: break; case FcOpField: - o = FcNameGetObjectType (expr->u.field); + o = FcNameGetObjectType (FcObjectName (expr->u.object)); if (o) FcTypecheckValue (parse, o->type, type); break; @@ -573,6 +588,10 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type) if (o) FcTypecheckValue (parse, o->type, type); } + else + FcConfigMessage (parse, FcSevereWarning, + "invalid constant used : %s", + expr->u.constant); break; case FcOpQuest: FcTypecheckExpr (parse, expr->u.tree.left, FcTypeBool); @@ -637,10 +656,10 @@ FcTestCreate (FcConfigParse *parse, test->next = 0; test->kind = kind; test->qual = qual; - test->field = (char *) FcStrCopy (field); + test->object = FcObjectFromName ((const char *) field); test->op = compare; test->expr = expr; - o = FcNameGetObjectType (test->field); + o = FcNameGetObjectType (FcObjectName (test->object)); if (o) FcTypecheckExpr (parse, expr, o->type); } @@ -649,7 +668,7 @@ FcTestCreate (FcConfigParse *parse, static FcEdit * FcEditCreate (FcConfigParse *parse, - const char *field, + FcObject object, FcOp op, FcExpr *expr, FcValueBinding binding) @@ -661,11 +680,11 @@ FcEditCreate (FcConfigParse *parse, const FcObjectType *o; e->next = 0; - e->field = field; /* already saved in grammar */ + e->object = object; e->op = op; e->expr = expr; e->binding = binding; - o = FcNameGetObjectType (e->field); + o = FcNameGetObjectType (FcObjectName (e->object)); if (o) FcTypecheckExpr (parse, expr, o->type); } @@ -904,7 +923,6 @@ FcVStackElements (FcConfigParse *parse) static FcChar8 ** FcConfigSaveAttr (const XML_Char **attr) { - int n; int slen; int i; FcChar8 **new; @@ -914,8 +932,7 @@ FcConfigSaveAttr (const XML_Char **attr) return 0; slen = 0; for (i = 0; attr[i]; i++) - slen += strlen (attr[i]) + 1; - n = i; + slen += strlen ((char *) attr[i]) + 1; new = malloc ((i + 1) * sizeof (FcChar8 *) + slen); if (!new) return 0; @@ -998,13 +1015,16 @@ FcConfigCleanup (FcConfigParse *parse) } static const FcChar8 * -FcConfigGetAttribute (FcConfigParse *parse, char *attr) +FcConfigGetAttribute (FcConfigParse *parse, const char *attr) { FcChar8 **attrs; if (!parse->pstack) return 0; attrs = parse->pstack->attr; + if (!attrs) + return 0; + while (*attrs) { if (!strcmp ((char *) *attrs, attr)) @@ -1125,7 +1145,7 @@ FcStrtod (char *s, char **end) int slen = strlen (s); int dlen = strlen (locale_data->decimal_point); - if (slen + dlen > sizeof (buf)) + if (slen + dlen > (int) sizeof (buf)) { if (end) *end = s; @@ -1299,8 +1319,7 @@ FcParseFamilies (FcConfigParse *parse, FcVStackTag tag) if (!FcVStackPushExpr (parse, tag, expr)) { FcConfigMessage (parse, FcSevereError, "out of memory"); - if (expr) - FcExprDestroy (expr); + FcExprDestroy (expr); } } } @@ -1391,7 +1410,7 @@ FcParseAlias (FcConfigParse *parse) if (prefer) { edit = FcEditCreate (parse, - FcConfigSaveField ("family"), + FC_FAMILY_OBJECT, FcOpPrepend, prefer, FcValueBindingWeak); @@ -1404,7 +1423,7 @@ FcParseAlias (FcConfigParse *parse) { next = edit; edit = FcEditCreate (parse, - FcConfigSaveField ("family"), + FC_FAMILY_OBJECT, FcOpAppend, accept, FcValueBindingWeak); @@ -1417,7 +1436,7 @@ FcParseAlias (FcConfigParse *parse) { next = edit; edit = FcEditCreate (parse, - FcConfigSaveField ("family"), + FC_FAMILY_OBJECT, FcOpAppendLast, def, FcValueBindingWeak); @@ -1521,7 +1540,7 @@ FcPopBinary (FcConfigParse *parse, FcOp op) FcConfigMessage (parse, FcSevereError, "out of memory"); FcExprDestroy (left); FcExprDestroy (expr); - break; + return 0; } expr = new; } @@ -1591,7 +1610,7 @@ FcParseInclude (FcConfigParse *parse) } typedef struct _FcOpMap { - char *name; + char name[16]; FcOp op; } FcOpMap; @@ -1617,7 +1636,7 @@ static const FcOpMap fcCompareOps[] = { { "not_contains", FcOpNotContains } }; -#define NUM_COMPARE_OPS (sizeof fcCompareOps / sizeof fcCompareOps[0]) +#define NUM_COMPARE_OPS (int) (sizeof fcCompareOps / sizeof fcCompareOps[0]) static FcOp FcConfigLexCompare (const FcChar8 *compare) @@ -1648,6 +1667,8 @@ FcParseTest (FcConfigParse *parse) kind = FcMatchPattern; else if (!strcmp ((char *) kind_string, "font")) kind = FcMatchFont; + else if (!strcmp ((char *) kind_string, "scan")) + kind = FcMatchScan; else if (!strcmp ((char *) kind_string, "default")) kind = FcMatchDefault; else @@ -1717,7 +1738,7 @@ static const FcOpMap fcModeOps[] = { { "append_last", FcOpAppendLast }, }; -#define NUM_MODE_OPS (sizeof fcModeOps / sizeof fcModeOps[0]) +#define NUM_MODE_OPS (int) (sizeof fcModeOps / sizeof fcModeOps[0]) static FcOp FcConfigLexMode (const FcChar8 *mode) @@ -1772,7 +1793,8 @@ FcParseEdit (FcConfigParse *parse) } } expr = FcPopBinary (parse, FcOpComma); - edit = FcEditCreate (parse, (char *) FcStrCopy (name), mode, expr, binding); + edit = FcEditCreate (parse, FcObjectFromName ((char *) name), + mode, expr, binding); if (!edit) { FcConfigMessage (parse, FcSevereError, "out of memory"); @@ -1801,6 +1823,8 @@ FcParseMatch (FcConfigParse *parse) kind = FcMatchPattern; else if (!strcmp ((char *) kind_name, "font")) kind = FcMatchFont; + else if (!strcmp ((char *) kind_name, "scan")) + kind = FcMatchScan; else { FcConfigMessage (parse, FcSevereWarning, "invalid match target \"%s\"", kind_name); @@ -1930,6 +1954,7 @@ FcParsePatelt (FcConfigParse *parse) if (!name) { FcConfigMessage (parse, FcSevereWarning, "missing pattern element name"); + FcPatternDestroy (pattern); return; } @@ -1967,6 +1992,7 @@ FcParsePattern (FcConfigParse *parse) if (!FcPatternAppend (pattern, vstack->u.pattern)) { FcConfigMessage (parse, FcSevereError, "out of memory"); + FcPatternDestroy (pattern); return; } break; @@ -2027,11 +2053,11 @@ FcEndElement(void *userData, const XML_Char *name) if (!FcStrUsesHome (data) || FcConfigHome ()) { if (!FcConfigAddDir (parse->config, data)) - FcConfigMessage (parse, FcSevereError, "out of memory"); + FcConfigMessage (parse, FcSevereError, "out of memory; cannot add directory %s", data); } FcStrFree (data); break; - case FcElementCache: + case FcElementCacheDir: data = FcStrBufDone (&parse->pstack->str); if (!data) { @@ -2040,11 +2066,22 @@ FcEndElement(void *userData, const XML_Char *name) } if (!FcStrUsesHome (data) || FcConfigHome ()) { - if (!FcConfigSetCache (parse->config, data)) - FcConfigMessage (parse, FcSevereError, "out of memory"); + if (!FcConfigAddCacheDir (parse->config, data)) + FcConfigMessage (parse, FcSevereError, "out of memory; cannot add cache directory %s", data); } FcStrFree (data); break; + + case FcElementCache: + data = FcStrBufDone (&parse->pstack->str); + if (!data) + { + FcConfigMessage (parse, FcSevereError, "out of memory"); + break; + } + /* discard this data; no longer used */ + FcStrFree (data); + break; case FcElementInclude: FcParseInclude (parse); break; @@ -2213,11 +2250,35 @@ FcStartDoctypeDecl (void *userData, FcConfigMessage (parse, FcSevereError, "invalid doctype \"%s\"", doctypeName); } +#ifdef ENABLE_LIBXML2 + +static void +FcInternalSubsetDecl (void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid) +{ + FcStartDoctypeDecl (userData, doctypeName, sysid, pubid, 1); +} + +static void +FcExternalSubsetDecl (void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid) +{ + FcStartDoctypeDecl (userData, doctypeName, sysid, pubid, 0); +} + +#else /* ENABLE_LIBXML2 */ + static void FcEndDoctypeDecl (void *userData) { } +#endif /* ENABLE_LIBXML2 */ + static FcBool FcConfigParseAndLoadDir (FcConfig *config, const FcChar8 *name, @@ -2309,16 +2370,28 @@ FcConfigParseAndLoad (FcConfig *config, XML_Parser p; FcChar8 *filename; - FILE *f; + int fd; int len; - void *buf; FcConfigParse parse; FcBool error = FcTrue; +#ifdef ENABLE_LIBXML2 + xmlSAXHandler sax; + char buf[BUFSIZ]; +#else + void *buf; +#endif + filename = FcConfigFilename (name); if (!filename) goto bail0; + if (FcStrSetMember (config->configFiles, filename)) + { + FcStrFree (filename); + return FcTrue; + } + if (!FcStrSetAdd (config->configFiles, filename)) { FcStrFree (filename); @@ -2335,38 +2408,64 @@ FcConfigParseAndLoad (FcConfig *config, if (FcDebug () & FC_DBG_CONFIG) printf ("\tLoading config file %s\n", filename); - f = fopen ((char *) filename, "r"); - FcStrFree (filename); - if (!f) + fd = open ((char *) filename, O_RDONLY); + if (fd == -1) { + FcStrFree (filename); goto bail0; + } +#ifdef ENABLE_LIBXML2 + memset(&sax, 0, sizeof(sax)); + + sax.internalSubset = FcInternalSubsetDecl; + sax.externalSubset = FcExternalSubsetDecl; + sax.startElement = FcStartElement; + sax.endElement = FcEndElement; + sax.characters = FcCharacterData; + + p = xmlCreatePushParserCtxt (&sax, &parse, NULL, 0, (const char *) filename); +#else p = XML_ParserCreate ("UTF-8"); +#endif + FcStrFree (filename); + if (!p) goto bail1; if (!FcConfigInit (&parse, name, config, p)) goto bail2; +#ifndef ENABLE_LIBXML2 + XML_SetUserData (p, &parse); XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl); XML_SetElementHandler (p, FcStartElement, FcEndElement); XML_SetCharacterDataHandler (p, FcCharacterData); +#endif /* ENABLE_LIBXML2 */ + do { +#ifndef ENABLE_LIBXML2 buf = XML_GetBuffer (p, BUFSIZ); if (!buf) { FcConfigMessage (&parse, FcSevereError, "cannot get parse buffer"); goto bail3; } - len = fread (buf, 1, BUFSIZ, f); +#endif + len = read (fd, buf, BUFSIZ); if (len < 0) { FcConfigMessage (&parse, FcSevereError, "failed reading config file"); goto bail3; } + +#ifdef ENABLE_LIBXML2 + if (xmlParseChunk (p, buf, len, len == 0)) +#else if (!XML_ParseBuffer (p, len, len == 0)) +#endif { FcConfigMessage (&parse, FcSevereError, "%s", XML_ErrorString (XML_GetErrorCode (p))); @@ -2379,8 +2478,8 @@ bail3: bail2: XML_ParserFree (p); bail1: - fclose (f); - f = NULL; + close (fd); + fd = -1; bail0: if (error && complain) { diff --git a/src/fontconfig.def.in b/src/fontconfig.def.in index 83dac95..0bccef5 100755 --- a/src/fontconfig.def.in +++ b/src/fontconfig.def.in @@ -1,163 +1,303 @@ EXPORTS - FcAtomicCreate - FcAtomicDeleteNew - FcAtomicDestroy - FcAtomicLock - FcAtomicNewFile - FcAtomicOrigFile - FcAtomicReplaceOrig - FcAtomicUnlock - FcBlanksAdd + FcDirCacheValid + FcDirCacheHasCurrentArch + FcDirCacheUnlink FcBlanksCreate FcBlanksDestroy + FcBlanksAdd FcBlanksIsMember - FcCharSetAddChar - FcCharSetCopy - FcCharSetCount - FcCharSetCreate - FcCharSetDestroy - FcCharSetEqual - FcCharSetFirstPage - FcCharSetHasChar - FcCharSetIntersect - FcCharSetIntersectCount - FcCharSetIsSubset - FcCharSetNextPage - FcCharSetSubtract - FcCharSetSubtractCount - FcCharSetUnion - FcConfigAppFontAddDir - FcConfigAppFontAddFile - FcConfigAppFontClear - FcConfigBuildFonts - FcConfigCreate - FcConfigDestroy + FcConfigHome FcConfigEnableHome FcConfigFilename - FcConfigGetBlanks - FcConfigGetCache - FcConfigGetConfigDirs - FcConfigGetConfigFiles + FcConfigCreate + FcConfigDestroy + FcConfigSetCurrent FcConfigGetCurrent + FcConfigUptoDate + FcConfigBuildFonts FcConfigGetFontDirs - FcConfigGetFonts + FcConfigNormalizeFontDir + FcConfigGetConfigDirs + FcConfigGetConfigFiles + FcConfigGetCache + FcConfigGetBlanks FcConfigGetRescanInverval - FcConfigParseAndLoad - FcConfigSetCurrent FcConfigSetRescanInverval - FcConfigSubstitute + FcConfigGetFonts + FcConfigAppFontAddFile + FcConfigAppFontAddDir + FcConfigAppFontClear FcConfigSubstituteWithPat - FcConfigUptoDate + FcConfigSubstitute + FcCharSetCreate + FcCharSetDestroy + FcCharSetAddChar + FcCharSetCopy + FcCharSetEqual + FcCharSetIntersect + FcCharSetUnion + FcCharSetSubtract + FcCharSetHasChar + FcCharSetCount + FcCharSetIntersectCount + FcCharSetSubtractCount + FcCharSetIsSubset + FcCharSetFirstPage + FcCharSetNextPage + FcValuePrint + FcPatternPrint + FcFontSetPrint + FcDebugVal + FcFontSetUnserialize FcDefaultSubstitute - FcDirCacheValid - FcDirSave - FcDirScan FcFileScan - FcFini - FcFontList - FcFontMatch - FcFontRenderPrepare - FcFontSetAdd + FcDirScan + FcDirSave + FcFreeTypeQuery FcFontSetCreate FcFontSetDestroy - FcFontSetList - FcFontSetMatch - FcFontSetPrint - FcFontSetSort - FcFontSetSortDestroy - FcFontSort - FcFreeTypeCharIndex - FcFreeTypeCharSet - FcFreeTypeQuery - FcGetVersion - FcInit - FcInitBringUptoDate + FcFontSetAdd FcInitLoadConfig FcInitLoadConfigAndFonts + FcInit + FcFini + FcGetVersion FcInitReinitialize - FcLangSetAdd - FcLangSetCompare - FcLangSetCopy + FcInitBringUptoDate FcLangSetCreate FcLangSetDestroy - FcLangSetEqual + FcLangSetCopy + FcLangSetAdd FcLangSetHasLang + FcLangSetCompare + FcLangSetContains + FcLangSetEqual FcLangSetHash + FcObjectSetCreate + FcObjectSetAdd + FcObjectSetDestroy + FcObjectSetVaBuild + FcObjectSetBuild + FcFontSetList + FcFontList + FcAtomicCreate + FcAtomicLock + FcAtomicNewFile + FcAtomicOrigFile + FcAtomicReplaceOrig + FcAtomicDeleteNew + FcAtomicUnlock + FcAtomicDestroy + FcFontSetMatch + FcFontMatch + FcFontRenderPrepare + FcFontSetSort + FcFontSort + FcFontSetSortDestroy FcMatrixCopy FcMatrixEqual FcMatrixMultiply FcMatrixRotate FcMatrixScale FcMatrixShear - FcNameConstant - FcNameGetConstant + FcNameRegisterObjectTypes + FcNameUnregisterObjectTypes FcNameGetObjectType - FcNameParse FcNameRegisterConstants - FcNameRegisterObjectTypes - FcNameUnparse FcNameUnregisterConstants - FcNameUnregisterObjectTypes - FcObjectSetAdd - FcObjectSetBuild - FcObjectSetCreate - FcObjectSetDestroy - FcObjectSetVaBuild - FcPatternAdd - FcPatternAddBool - FcPatternAddCharSet - FcPatternAddDouble - FcPatternAddFTFace - FcPatternAddInteger - FcPatternAddLangSet - FcPatternAddMatrix - FcPatternAddString - FcPatternAddWeak - FcPatternBuild + FcNameGetConstant + FcNameConstant + FcNameParse + FcNameUnparse + FcNameUnparseEscaped FcPatternCreate - FcPatternDel - FcPatternDestroy FcPatternDuplicate + FcPatternReference + FcValueDestroy + FcValueEqual + FcValueSave + FcPatternDestroy FcPatternEqual FcPatternEqualSubset + FcPatternHash + FcPatternAdd + FcPatternAddWeak FcPatternGet - FcPatternGetBool - FcPatternGetCharSet - FcPatternGetDouble - FcPatternGetFTFace + FcPatternDel + FcPatternRemove + FcPatternAddInteger + FcPatternAddDouble + FcPatternAddString + FcPatternAddMatrix + FcPatternAddCharSet + FcPatternAddBool + FcPatternAddLangSet FcPatternGetInteger - FcPatternGetLangSet - FcPatternGetMatrix + FcPatternGetDouble FcPatternGetString - FcPatternHash - FcPatternPrint - FcPatternReference + FcPatternGetMatrix + FcPatternGetCharSet + FcPatternGetBool + FcPatternGetLangSet FcPatternVaBuild - FcStrBasename - FcStrCmp - FcStrCmp - FcStrCmpIgnoreCase + FcPatternBuild FcStrCopy FcStrCopyFilename + FcStrDowncase + FcStrCmpIgnoreCase + FcStrCmp + FcStrStrIgnoreCase + FcStrStr + FcUtf8ToUcs4 + FcUtf8Len + FcUcs4ToUtf8 + FcUtf16ToUcs4 + FcUtf16Len FcStrDirname - FcStrListCreate - FcStrListDone - FcStrListNext + FcStrBasename + FcStrSetCreate + FcStrSetMember + FcStrSetEqual FcStrSetAdd FcStrSetAddFilename - FcStrSetCreate FcStrSetDel FcStrSetDestroy - FcStrSetEqual - FcStrSetMember - FcUcs4ToUtf8 - FcUtf16Len - FcUtf16ToUcs4 - FcUtf8Len - FcUtf8ToUcs4 - FcValueDestroy - FcValueEqual - FcValuePrint - FcValueSave + FcStrListCreate + FcStrListNext + FcStrListDone + FcConfigParseAndLoad + FcFreeTypeCharIndex + FcFreeTypeCharSetAndSpacing + FcFreeTypeCharSet + FcPatternGetFTFace + FcPatternAddFTFace + FcGlobalCacheCreate + FcGlobalCacheDestroy + FcGlobalCacheReadDir + FcGlobalCacheLoad + FcGlobalCacheUpdate + FcGlobalCacheSave + FcCacheRead + FcDirCacheWrite + FcDirCacheRead + FcCacheBankToIndexMTF + FcCacheFindBankDir + FcConfigAddConfigDir + FcConfigAddFontDir + FcConfigAddDir + FcConfigAddConfigFile + FcConfigSetCache + FcConfigAddBlank + FcConfigAddEdit + FcConfigSetFonts + FcConfigCompareValue + FcConfigGlobAdd + FcConfigAcceptFilename + FcConfigPatternsAdd + FcConfigAcceptFont + FcConfigModifiedTime + FcLangCharSetPopulate + FcCharSetFreeze + FcCharSetThawAll + FcNameUnparseCharSet + FcNameParseCharSet + FcCharSetFindLeafCreate + FcCharSetNewBank + FcCharSetNeededBytes + FcCharSetNeededBytesAlign + FcCharSetDistributeBytes + FcCharSetUnserialize + FcValueListPrint + FcLangSetPrint + FcOpPrint + FcTestPrint + FcExprPrint + FcEditPrint + FcSubstPrint + FcInitDebug + FcGetDefaultLang + FcFileIsDir + FcFileScanConfig + FcDirScanConfig + FcFreeTypeIsExclusiveLang + FcFreeTypeUcs4ToPrivate + FcFreeTypePrivateToUcs4 + FcFreeTypeGetPrivateMap + FcFontSetNewBank + FcFontSetNeededBytes + FcFontSetNeededBytesAlign + FcFontSetDistributeBytes + FcFontSetSerialize + FcConfigSaveField + FcTestDestroy + FcExprCreateInteger + FcExprCreateDouble + FcExprCreateString + FcExprCreateMatrix + FcExprCreateBool + FcExprCreateNil + FcExprCreateField + FcExprCreateConst + FcExprCreateOp + FcExprDestroy + FcEditDestroy + FcMemReport + FcMemAlloc + FcMemFree + FcFreeTypeLangSet + FcLangCompare + FcCharSetForLang + FcLangSetPromote + FcNameParseLangSet + FcNameUnparseLangSet + FcLangSetNewBank + FcLangSetNeededBytes + FcLangSetNeededBytesAlign + FcLangSetDistributeBytes + FcLangSetSerialize + FcLangSetUnserialize + FcListPatternMatchAny + FcNameBool + FcObjectDistributeBytes + FcObjectToPtr + FcObjectNeededBytes + FcObjectNeededBytesAlign + FcObjectUnserialize + FcObjectSerialize + FcObjectPtrU + FcObjectStaticNameFini + FcValueCanonicalize + FcValueListDestroy + FcPatternFindElt + FcPatternInsertElt + FcPatternAddWithBinding + FcPatternFreeze + FcPatternFini + FcPatternAppend + FcPatternAddFullFname + FcPatternTransferFullFname + FcStrStaticName + FcStringHash + FcPatternNewBank + FcPatternNeededBytes + FcPatternNeededBytesAlign + FcPatternDistributeBytes + FcPatternSerialize + FcPatternUnserialize + FcMatrixFree + FcStrPlus + FcStrFree + FcStrBufInit + FcStrBufDestroy + FcStrBufDone + FcStrBufChar + FcStrBufString + FcStrBufData + FcStrCmpIgnoreBlanksAndCase + FcStrContainsIgnoreBlanksAndCase + FcStrContainsIgnoreCase + FcStrUsesHome + FcStrLastSlash + FcStrHashIgnoreCase LIBRARY libfontconfig-@LT_CURRENT_MINUS_AGE@.dll VERSION @LT_CURRENT@.@LT_REVISION@ diff --git a/src/ftglue.c b/src/ftglue.c new file mode 100644 index 0000000..413a933 --- /dev/null +++ b/src/ftglue.c @@ -0,0 +1,309 @@ +/* ftglue.c: Glue code for compiling the OpenType code from + * FreeType 1 using only the public API of FreeType 2 + * + * By David Turner, The FreeType Project (www.freetype.org) + * + * This code is explicitely put in the public domain + * + * See ftglue.h for more information. + */ + +#include "ftglue.h" + +#if 0 +#include +#define LOG(x) ftglue_log x + +static void +ftglue_log( const char* format, ... ) +{ + va_list ap; + + va_start( ap, format ); + vfprintf( stderr, format, ap ); + va_end( ap ); +} + +#else +#define LOG(x) do {} while (0) +#endif + +/* only used internally */ +static FT_Pointer +ftglue_qalloc( FT_Memory memory, + FT_ULong size, + FT_Error *perror ) +{ + FT_Error error = 0; + FT_Pointer block = NULL; + + if ( size > 0 ) + { + block = memory->alloc( memory, size ); + if ( !block ) + error = FT_Err_Out_Of_Memory; + } + + *perror = error; + return block; +} + +#undef QALLOC /* just in case */ +#define QALLOC(ptr,size) ( (ptr) = ftglue_qalloc( memory, (size), &error ), error != 0 ) +#define FREE(_ptr) \ + do { \ + if ( (_ptr) ) \ + { \ + ftglue_free( memory, _ptr ); \ + _ptr = NULL; \ + } \ + } while (0) + + +FTGLUE_APIDEF( FT_Pointer ) +ftglue_alloc( FT_Memory memory, + FT_ULong size, + FT_Error *perror ) +{ + FT_Error error = 0; + FT_Pointer block = NULL; + + if ( size > 0 ) + { + block = memory->alloc( memory, size ); + if ( !block ) + error = FT_Err_Out_Of_Memory; + else + memset( (char*)block, 0, (size_t)size ); + } + + *perror = error; + return block; +} + + +FTGLUE_APIDEF( FT_Pointer ) +ftglue_realloc( FT_Memory memory, + FT_Pointer block, + FT_ULong old_size, + FT_ULong new_size, + FT_Error *perror ) +{ + FT_Pointer block2 = NULL; + FT_Error error = 0; + + if ( old_size == 0 || block == NULL ) + { + block2 = ftglue_alloc( memory, new_size, &error ); + } + else if ( new_size == 0 ) + { + ftglue_free( memory, block ); + } + else + { + block2 = memory->realloc( memory, old_size, new_size, block ); + if ( block2 == NULL ) + error = FT_Err_Out_Of_Memory; + else if ( new_size > old_size ) + memset( (char*)block2 + old_size, 0, (size_t)(new_size - old_size) ); + } + + if ( !error ) + block = block2; + + *perror = error; + return block; +} + + +FTGLUE_APIDEF( void ) +ftglue_free( FT_Memory memory, + FT_Pointer block ) +{ + if ( block ) + memory->free( memory, block ); +} + + +FTGLUE_APIDEF( FT_Long ) +ftglue_stream_pos( FT_Stream stream ) +{ + LOG(( "ftglue:stream:pos() -> %ld\n", stream->pos )); + return stream->pos; +} + + +FTGLUE_APIDEF( FT_Error ) +ftglue_stream_seek( FT_Stream stream, + FT_Long pos ) +{ + FT_Error error = 0; + + stream->pos = pos; + if ( stream->read ) + { + if ( stream->read( stream, pos, 0, 0 ) ) + error = FT_Err_Invalid_Stream_Operation; + } + else if ( pos > stream->size ) + error = FT_Err_Invalid_Stream_Operation; + + LOG(( "ftglue:stream:seek(%ld) -> %d\n", pos, error )); + return error; +} + + +FTGLUE_APIDEF( FT_Error ) +ftglue_stream_frame_enter( FT_Stream stream, + FT_ULong count ) +{ + FT_Error error = FT_Err_Ok; + FT_ULong read_bytes; + + if ( stream->read ) + { + /* allocate the frame in memory */ + FT_Memory memory = stream->memory; + + + if ( QALLOC( stream->base, count ) ) + goto Exit; + + /* read it */ + read_bytes = stream->read( stream, stream->pos, + stream->base, count ); + if ( read_bytes < count ) + { + FREE( stream->base ); + error = FT_Err_Invalid_Stream_Operation; + } + stream->cursor = stream->base; + stream->limit = stream->cursor + count; + stream->pos += read_bytes; + } + else + { + /* check current and new position */ + if ( stream->pos >= stream->size || + stream->pos + count > stream->size ) + { + error = FT_Err_Invalid_Stream_Operation; + goto Exit; + } + + /* set cursor */ + stream->cursor = stream->base + stream->pos; + stream->limit = stream->cursor + count; + stream->pos += count; + } + +Exit: + LOG(( "ftglue:stream:frame_enter(%ld) -> %d\n", count, error )); + return error; +} + + +FTGLUE_APIDEF( void ) +ftglue_stream_frame_exit( FT_Stream stream ) +{ + if ( stream->read ) + { + FT_Memory memory = stream->memory; + + FREE( stream->base ); + } + stream->cursor = 0; + stream->limit = 0; + + LOG(( "ftglue:stream:frame_exit()\n" )); +} + + +FTGLUE_APIDEF( FT_Error ) +ftglue_face_goto_table( FT_Face face, + FT_ULong the_tag, + FT_Stream stream ) +{ + FT_Error error; + + LOG(( "ftglue_face_goto_table( %p, %c%c%c%c, %p )\n", + face, + (int)((the_tag >> 24) & 0xFF), + (int)((the_tag >> 16) & 0xFF), + (int)((the_tag >> 8) & 0xFF), + (int)(the_tag & 0xFF), + stream )); + + if ( !FT_IS_SFNT(face) ) + { + LOG(( "not a SFNT face !!\n" )); + error = FT_Err_Invalid_Face_Handle; + } + else + { + /* parse the directory table directly, without using + * FreeType's built-in data structures + */ + FT_ULong offset = 0; + FT_UInt count, nn; + + if ( face->num_faces > 1 ) + { + /* deal with TrueType collections */ + + LOG(( ">> This is a TrueType Collection\n" )); + + if ( FILE_Seek( 12 + face->face_index*4 ) || + ACCESS_Frame( 4 ) ) + goto Exit; + + offset = GET_ULong(); + + FORGET_Frame(); + } + + LOG(( "TrueType offset = %ld\n", offset )); + + if ( FILE_Seek( offset+4 ) || + ACCESS_Frame( 2 ) ) + goto Exit; + + count = GET_UShort(); + + FORGET_Frame(); + + if ( FILE_Seek( offset+12 ) || + ACCESS_Frame( count*16 ) ) + goto Exit; + + for ( nn = 0; nn < count; nn++ ) + { + FT_ULong tag = GET_ULong(); + FT_ULong checksum = GET_ULong(); + FT_ULong start = GET_ULong(); + FT_ULong size = GET_ULong(); + + FT_UNUSED(checksum); + FT_UNUSED(size); + + if ( tag == the_tag ) + { + LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size )); + error = ftglue_stream_seek( stream, start ); + goto FoundIt; + } + } + error = TT_Err_Table_Missing; + + FoundIt: + FORGET_Frame(); + } + +Exit: + LOG(( "TrueType error=%d\n", error )); + + return error; +} + +#undef QALLOC diff --git a/src/ftglue.h b/src/ftglue.h new file mode 100644 index 0000000..93fd91e --- /dev/null +++ b/src/ftglue.h @@ -0,0 +1,142 @@ +/* ftglue.c: Glue code for compiling the OpenType code from + * FreeType 1 using only the public API of FreeType 2 + * + * By David Turner, The FreeType Project (www.freetype.org) + * + * This code is explicitely put in the public domain + * + * ========================================================================== + * + * the OpenType parser codes was originally written as an extension to + * FreeType 1.x. As such, its source code was embedded within the library, + * and used many internal FreeType functions to deal with memory and + * stream i/o. + * + * When it was 'salvaged' for Pango and Qt, the code was "ported" to FreeType 2, + * which basically means that some macro tricks were performed in order to + * directly access FT2 _internal_ functions. + * + * these functions were never part of FT2 public API, and _did_ change between + * various releases. This created chaos for many users: when they upgraded the + * FreeType library on their system, they couldn't run Gnome anymore since + * Pango refused to link. + * + * Very fortunately, it's possible to completely avoid this problem because + * the FT_StreamRec and FT_MemoryRec structure types, which describe how + * memory and stream implementations interface with the rest of the font + * library, have always been part of the public API, and never changed. + * + * What we do thus is re-implement, within the OpenType parser, the few + * functions that depend on them. This only adds one or two kilobytes of + * code, and ensures that the parser can work with _any_ version + * of FreeType installed on your system. How sweet... ! + * + * Note that we assume that Pango doesn't use any other internal functions + * from FreeType. It used to in old versions, but this should no longer + * be the case. (crossing my fingers). + * + * - David Turner + * - The FreeType Project (www.freetype.org) + * + * PS: This "glue" code is explicitely put in the public domain + */ +#ifndef __OPENTYPE_FTGLUE_H__ +#define __OPENTYPE_FTGLUE_H__ + +#include +#include FT_FREETYPE_H + +FT_BEGIN_HEADER + + +/* utility macros */ +#define TT_Err_Ok FT_Err_Ok +#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument +#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle +#define TT_Err_Table_Missing FT_Err_Table_Missing + +#define SET_ERR(c) ( (error = (c)) != 0 ) + +#ifndef FTGLUE_API +#define FTGLUE_API(x) extern x +#endif + +#ifndef FTGLUE_APIDEF +#define FTGLUE_APIDEF(x) x +#endif + +/* stream macros used by the OpenType parser */ +#define FILE_Pos() ftglue_stream_pos( stream ) +#define FILE_Seek(pos) SET_ERR( ftglue_stream_seek( stream, pos ) ) +#define ACCESS_Frame(size) SET_ERR( ftglue_stream_frame_enter( stream, size ) ) +#define FORGET_Frame() ftglue_stream_frame_exit( stream ) + +#define GET_Byte() (*stream->cursor++) +#define GET_Short() (stream->cursor += 2, (FT_Short)( \ + (*(((FT_Byte*)stream->cursor)-2) << 8) | \ + *(((FT_Byte*)stream->cursor)-1) \ + )) +#define GET_Long() (stream->cursor += 4, (FT_Long)( \ + (*(((FT_Byte*)stream->cursor)-4) << 24) | \ + (*(((FT_Byte*)stream->cursor)-3) << 16) | \ + (*(((FT_Byte*)stream->cursor)-2) << 8) | \ + *(((FT_Byte*)stream->cursor)-1) \ + )) + +#define GET_Char() ((FT_Char)GET_Byte()) +#define GET_UShort() ((FT_UShort)GET_Short()) +#define GET_ULong() ((FT_ULong)GET_Long()) +#define GET_Tag4() GET_ULong() + +#define FT_SET_ERROR( expression ) \ + ( ( error = (expression) ) != 0 ) + +FTGLUE_API( FT_Long ) +ftglue_stream_pos( FT_Stream stream ); + +FTGLUE_API( FT_Error ) +ftglue_stream_seek( FT_Stream stream, + FT_Long pos ); + +FTGLUE_API( FT_Error ) +ftglue_stream_frame_enter( FT_Stream stream, + FT_ULong size ); + +FTGLUE_API( void ) +ftglue_stream_frame_exit( FT_Stream stream ); + +FTGLUE_API( FT_Byte ) +ftglue_stream_get_byte( FT_Stream stream ); + +FTGLUE_API( FT_Short ) +ftglue_stream_get_short( FT_Stream stream ); + +FTGLUE_API( FT_Long ) +ftglue_stream_get_long( FT_Stream stream ); + +FTGLUE_API( FT_Error ) +ftglue_face_goto_table( FT_Face face, + FT_ULong tag, + FT_Stream stream ); + +FTGLUE_API( FT_Pointer ) +ftglue_alloc( FT_Memory memory, + FT_ULong size, + FT_Error *perror_ ); + +FTGLUE_API( FT_Pointer ) +ftglue_realloc( FT_Memory memory, + FT_Pointer block, + FT_ULong old_size, + FT_ULong new_size, + FT_Error *perror_ ); + +FTGLUE_API( void ) +ftglue_free( FT_Memory memory, + FT_Pointer block ); + +/* */ + +FT_END_HEADER + +#endif /* __OPENTYPE_FTGLUE_H__ */ diff --git a/test/fonts.conf.in b/test/fonts.conf.in index 492e36f..95def72 100644 --- a/test/fonts.conf.in +++ b/test/fonts.conf.in @@ -1,4 +1,4 @@ @FONTDIR@ -@CACHEFILE@ +@CACHEDIR@ diff --git a/test/run-test.sh b/test/run-test.sh index 428503b..e7174b2 100644 --- a/test/run-test.sh +++ b/test/run-test.sh @@ -2,7 +2,7 @@ TESTDIR=${srcdir-`pwd`} FONTDIR=`pwd`/fonts -CACHEFILE=`pwd`/fonts.cache +CACHEDIR=`pwd`/cache.dir ECHO=true @@ -28,7 +28,7 @@ check () { } prep() { - rm -rf $CACHEFILE + rm -rf $CACHEDIR rm -rf $FONTDIR mkdir $FONTDIR } @@ -39,7 +39,7 @@ dotest () { } sed "s!@FONTDIR@!$FONTDIR! -s!@CACHEFILE@!$CACHEFILE!" < $TESTDIR/fonts.conf.in > fonts.conf +s!@CACHEDIR@!$CACHEDIR!" < $TESTDIR/fonts.conf.in > fonts.conf FONTCONFIG_FILE=`pwd`/fonts.conf export FONTCONFIG_FILE @@ -89,4 +89,4 @@ mkdir $FONTDIR/a cp $FONT2 $FONTDIR/a check -rm -rf $FONTDIR $CACHEFILE $FONTCONFIG_FILE out +rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out