--=-Vh8Ks7jIidQiTxGdLE+M Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, 2003-03-04 at 13:20, Keith Packard wrote: > I'm thinking it would be nice to allow people to elide some fonts from > their configurations. It seems like there are a couple of ways: > > 1) exclude by path name -- have a regex that matches > filenames and includes/excludes them. > > 2) exclude by pattern -- have some match rules that > select fonts by pattern and include/exclude them. > > 1) would allow us to easily eliminate all .pcf.gz fonts from the > configuration while 2) would allow us to build "suitcases" if combined > with some conditional expressions based on X resources or environment > variables. The Red Hat fontconfig package actually has the attached patch in it. (I haven't submitted for obvious total-hack reasons). A way to do this as a config option would be nice. While this patch is more like 1), I do actually know the full pathnames to these fonts, so 2) would work as well, if it is perhaps a little less robust. (They are from the ghostscript distribution and don't render properly with FreeType.) Regards, Owen --=-Vh8Ks7jIidQiTxGdLE+M Content-Disposition: attachment; filename=fontconfig-0.0.1.020826.1330-blacklist.patch Content-Type: text/plain; name=fontconfig-0.0.1.020826.1330-blacklist.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit --- fontconfig/src/fcdir.c.blacklist Mon Aug 26 15:57:40 2002 +++ fontconfig/src/fcdir.c Fri Aug 30 14:59:05 2002 @@ -150,6 +150,40 @@ return ret; } +static FcBool +FcBlackListed (const char *name) +{ + static const char * const black_listed_names[] = { + "hrger.pfa", + "hrgrr.pfa", + "hritr.pfa", + "hrpld.pfa", + "hrpldi.pfa", + "hrplt.pfa", + "hrplti.pfa", + "hrscc.pfa", + "hrscs.pfa", + "u003043t.gsf", + "u004006t.gsf" + }; + + int low = 0; + int high = sizeof(black_listed_names) / sizeof(black_listed_names[0]) - 1; + + while (low <= high) { + int mid = (low + high) / 2; + int res = strcmp (name, black_listed_names[mid]); + if (res == 0) + return FcTrue; + else if (res < 0) + high = mid - 1; + else + low = mid + 1; + } + + return FcFalse; +} + #define FC_MAX_FILE_LEN 4096 FcBool @@ -201,7 +235,8 @@ } while (ret && (e = readdir (d))) { - if (e->d_name[0] != '.' && strlen (e->d_name) < FC_MAX_FILE_LEN) + if (e->d_name[0] != '.' && strlen (e->d_name) < FC_MAX_FILE_LEN && + !FcBlackListed (e->d_name)) { strcpy ((char *) base, (char *) e->d_name); ret = FcFileScan (set, dirs, cache, blanks, file, force); --=-Vh8Ks7jIidQiTxGdLE+M--