From: Keith Packard Date: Thu, 22 Aug 2002 07:36:45 +0000 (+0000) Subject: Reimplement FC_LANG as FcTypeLang, freeze patterns, other cleanup X-Git-Tag: fcpackage_rc3~3 X-Git-Url: https://git.wh0rd.org/?p=fontconfig.git;a=commitdiff_plain;h=d8d7395877238acbc9cd4709e3b4e76f8ca978cb Reimplement FC_LANG as FcTypeLang, freeze patterns, other cleanup --- diff --git a/ChangeLog b/ChangeLog index b12772c..5bbe97a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,24 @@ -Mon Aug 19 11:57:27 PDT 2002 +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. diff --git a/fc-lang/fc-lang.c b/fc-lang/fc-lang.c index c8fec3e..0d35f87 100644 --- a/fc-lang/fc-lang.c +++ b/fc-lang/fc-lang.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/fc-lang/fc-lang.c,v 1.1 2002/07/06 23:21:36 keithp Exp $ + * $XFree86: xc/lib/fontconfig/fc-lang/fc-lang.c,v 1.2 2002/07/07 19:18:51 keithp Exp $ * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * @@ -159,9 +159,16 @@ get_lang (char *name) return lang; } +static int compare (const void *a, const void *b) +{ + const FcChar8 *const *as = a, *const *bs = b; + return FcStrCmpIgnoreCase (*as, *bs); +} + int main (int argc, char **argv) { + char *files[1024]; FcCharSet *sets[1024]; int duplicate[1024]; char *names[1024]; @@ -173,12 +180,17 @@ main (int argc, char **argv) char line[1024]; while (*++argv) + files[i++] = *argv; + files[i] = 0; + qsort (files, i, sizeof (char *), compare); + i = 0; + while (files[i]) { - f = fopen (*argv, "r"); + f = fopen (files[i], "r"); if (!f) - fatal (*argv, 0, strerror (errno)); - sets[i] = scan (f, *argv); - names[i] = get_name (*argv); + fatal (files[i], 0, strerror (errno)); + sets[i] = scan (f, files[i]); + names[i] = get_name (files[i]); total_leaves += sets[i]->num; i++; fclose (f); @@ -304,7 +316,7 @@ main (int argc, char **argv) if (j < 0) j = i; printf (" { (FcChar8 *) \"%s\",\n" - " { 1, FcTrue, %d, " + " { FC_REF_CONSTANT, %d, " "(FcCharLeaf **) leaves_%s, " "(FcChar16 *) numbers_%s } },\n", get_lang(names[i]), diff --git a/fc-lang/fclang.h b/fc-lang/fclang.h index dab7f65..05d06f5 100644 --- a/fc-lang/fclang.h +++ b/fc-lang/fclang.h @@ -82,21 +82,21 @@ static const FcCharLeaf leaves[609] = { 0x300c0000, 0x0f00c000, 0x03000000, 0x00000300, } }, { { /* 14 */ + 0xffff0002, 0xffffffff, 0x0002ffff, 0x00000000, + 0x030c0000, 0x0000cc0f, 0x03000000, 0x00000300, + } }, + { { /* 15 */ 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe, 0x00000000, 0x00000000, 0x00000000, 0x00000000, } }, - { { /* 15 */ + { { /* 16 */ 0x00000000, 0x00000000, 0x00000c00, 0x00000000, 0x20010040, 0x00000000, 0x00000000, 0x00000000, } }, - { { /* 16 */ + { { /* 17 */ 0x00000000, 0x00000000, 0x08100000, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, } }, - { { /* 17 */ - 0xffff0002, 0xffffffff, 0x0002ffff, 0x00000000, - 0x030c0000, 0x0000cc0f, 0x03000000, 0x00000300, - } }, { { /* 18 */ 0xffff4042, 0xffffffff, 0x4042ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -111,19 +111,19 @@ static const FcCharLeaf leaves[609] = { } }, { { /* 21 */ 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe, - 0x00000000, 0x00000000, 0x060c3303, 0x060c3303, + 0x00000000, 0x00000000, 0x10008200, 0x10008200, } }, { { /* 22 */ - 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe, + 0x00000000, 0x00000000, 0x060c3303, 0x060c3303, } }, { { /* 23 */ + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x03000000, 0x00003000, 0x00000000, } }, { { /* 24 */ - 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe, - 0x00000000, 0x00000000, 0x10008200, 0x10008200, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x03000000, 0x00003000, 0x00000000, } }, { { /* 25 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -154,13 +154,13 @@ static const FcCharLeaf leaves[609] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, } }, { { /* 32 */ - 0xffff0002, 0xffffffff, 0x0002ffff, 0x00000000, - 0x00000000, 0x00000030, 0x000c0000, 0x030300c0, - } }, - { { /* 33 */ 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe, 0x00000000, 0x00000000, 0x10020004, 0x10020004, } }, + { { /* 33 */ + 0xffff0002, 0xffffffff, 0x0002ffff, 0x00000000, + 0x00000000, 0x00000030, 0x000c0000, 0x030300c0, + } }, { { /* 34 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x001fffff, @@ -738,17 +738,17 @@ static const FcCharLeaf leaves[609] = { 0x00000000, 0x00000000, 0x00000000, 0x00000020, } }, { { /* 178 */ - 0xffff0002, 0xffffffff, 0x0002ffff, 0x000c0000, - 0x0c0c0000, 0x000cc00c, 0x03000000, 0x00000000, - } }, - { { /* 179 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, } }, - { { /* 180 */ + { { /* 179 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffff003f, 0x087fffff, } }, + { { /* 180 */ + 0xffff0002, 0xffffffff, 0x0002ffff, 0x000c0000, + 0x0c0c0000, 0x000cc00c, 0x03000000, 0x00000000, + } }, { { /* 181 */ 0x00000000, 0x00000300, 0x00000000, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -1118,17 +1118,17 @@ static const FcCharLeaf leaves[609] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, } }, { { /* 273 */ - 0xffff0002, 0xffffffff, 0x0002ffff, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - } }, - { { /* 274 */ 0x00000000, 0x00000000, 0x00820000, 0x00820000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, } }, - { { /* 275 */ + { { /* 274 */ 0xffff0000, 0xffff27bf, 0x000027bf, 0x00000000, 0x00000000, 0x0c000000, 0x03000000, 0x000000c0, } }, + { { /* 275 */ + 0xffff0002, 0xffffffff, 0x0002ffff, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + } }, { { /* 276 */ 0xffff0042, 0xffffffff, 0x0042ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000c0, @@ -2537,20 +2537,20 @@ static const FcChar16 numbers_az[4] = { 0x0000, 0x0001, 0x0002, 0x0004, }; -static const FcCharLeaf *leaves_bam[3] = { - L( 14), L( 15), L( 16), +static const FcCharLeaf *leaves_ba[1] = { + L( 14), }; -static const FcChar16 numbers_bam[3] = { - 0x0000, 0x0001, 0x0002, +static const FcChar16 numbers_ba[1] = { + 0x0004, }; -static const FcCharLeaf *leaves_ba[1] = { - L( 17), +static const FcCharLeaf *leaves_bam[3] = { + L( 15), L( 16), L( 17), }; -static const FcChar16 numbers_ba[1] = { - 0x0004, +static const FcChar16 numbers_bam[3] = { + 0x0000, 0x0001, 0x0002, }; static const FcCharLeaf *leaves_be[1] = { @@ -2569,28 +2569,28 @@ static const FcChar16 numbers_bg[1] = { 0x0004, }; -static const FcCharLeaf *leaves_bho[1] = { +static const FcCharLeaf *leaves_bh[1] = { L( 20), }; -static const FcChar16 numbers_bho[1] = { +static const FcChar16 numbers_bh[1] = { 0x0009, }; -static const FcCharLeaf *leaves_bin[3] = { - L( 21), L( 22), L( 23), +static const FcCharLeaf *leaves_bi[1] = { + L( 21), }; -static const FcChar16 numbers_bin[3] = { - 0x0000, 0x0003, 0x001e, +static const FcChar16 numbers_bi[1] = { + 0x0000, }; -static const FcCharLeaf *leaves_bi[1] = { - L( 24), +static const FcCharLeaf *leaves_bin[3] = { + L( 22), L( 23), L( 24), }; -static const FcChar16 numbers_bi[1] = { - 0x0000, +static const FcChar16 numbers_bin[3] = { + 0x0000, 0x0003, 0x001e, }; static const FcCharLeaf *leaves_bn[1] = { @@ -2618,7 +2618,7 @@ static const FcChar16 numbers_br[1] = { }; static const FcCharLeaf *leaves_bs[2] = { - L( 14), L( 28), + L( 15), L( 28), }; static const FcChar16 numbers_bs[2] = { @@ -2641,20 +2641,20 @@ static const FcChar16 numbers_ca[2] = { 0x0000, 0x0001, }; -static const FcCharLeaf *leaves_chm[1] = { +static const FcCharLeaf *leaves_ch[1] = { L( 32), }; -static const FcChar16 numbers_chm[1] = { - 0x0004, +static const FcChar16 numbers_ch[1] = { + 0x0000, }; -static const FcCharLeaf *leaves_ch[1] = { +static const FcCharLeaf *leaves_chm[1] = { L( 33), }; -static const FcChar16 numbers_ch[1] = { - 0x0000, +static const FcChar16 numbers_chm[1] = { + 0x0004, }; static const FcCharLeaf *leaves_chr[1] = { @@ -2738,7 +2738,7 @@ static const FcChar16 numbers_en[1] = { }; static const FcCharLeaf *leaves_eo[2] = { - L( 14), L( 50), + L( 15), L( 50), }; static const FcChar16 numbers_eo[2] = { @@ -2786,7 +2786,7 @@ static const FcChar16 numbers_fi[2] = { }; static const FcCharLeaf *leaves_fj[1] = { - L( 14), + L( 15), }; static const FcChar16 numbers_fj[1] = { @@ -2802,7 +2802,7 @@ static const FcChar16 numbers_fo[1] = { }; static const FcCharLeaf *leaves_ful[3] = { - L( 14), L( 60), L( 61), + L( 15), L( 60), L( 61), }; static const FcChar16 numbers_ful[3] = { @@ -2874,7 +2874,7 @@ static const FcChar16 numbers_gv[1] = { }; static const FcCharLeaf *leaves_ha[3] = { - L( 14), L( 75), L( 76), + L( 15), L( 75), L( 76), }; static const FcChar16 numbers_ha[3] = { @@ -2882,7 +2882,7 @@ static const FcChar16 numbers_ha[3] = { }; static const FcCharLeaf *leaves_haw[3] = { - L( 14), L( 77), L( 78), + L( 15), L( 77), L( 78), }; static const FcChar16 numbers_haw[3] = { @@ -2922,7 +2922,7 @@ static const FcChar16 numbers_hy[1] = { }; static const FcCharLeaf *leaves_ibo[2] = { - L( 14), L( 86), + L( 15), L( 86), }; static const FcChar16 numbers_ibo[2] = { @@ -2997,24 +2997,24 @@ static const FcChar16 numbers_ja[84] = { 0x009d, 0x009e, 0x009f, 0x00ff, }; -static const FcCharLeaf *leaves_kaa[1] = { - L(178), +static const FcCharLeaf *leaves_ka[2] = { + L(178), L(179), }; -static const FcChar16 numbers_kaa[1] = { - 0x0004, +static const FcChar16 numbers_ka[2] = { + 0x0005, 0x0010, }; -static const FcCharLeaf *leaves_ka[2] = { - L(179), L(180), +static const FcCharLeaf *leaves_kaa[1] = { + L(180), }; -static const FcChar16 numbers_ka[2] = { - 0x0005, 0x0010, +static const FcChar16 numbers_kaa[1] = { + 0x0004, }; static const FcCharLeaf *leaves_ki[2] = { - L( 14), L(181), + L( 15), L(181), }; static const FcChar16 numbers_ki[2] = { @@ -3093,20 +3093,20 @@ static const FcChar16 numbers_ko[129] = { 0x00fa, }; -static const FcCharLeaf *leaves_kum[1] = { - L(273), +static const FcCharLeaf *leaves_ku[2] = { + L(273), L(274), }; -static const FcChar16 numbers_kum[1] = { - 0x0004, +static const FcChar16 numbers_ku[2] = { + 0x0000, 0x0004, }; -static const FcCharLeaf *leaves_ku[2] = { - L(274), L(275), +static const FcCharLeaf *leaves_kum[1] = { + L(275), }; -static const FcChar16 numbers_ku[2] = { - 0x0000, 0x0004, +static const FcChar16 numbers_kum[1] = { + 0x0004, }; static const FcCharLeaf *leaves_kv[1] = { @@ -3118,7 +3118,7 @@ static const FcChar16 numbers_kv[1] = { }; static const FcCharLeaf *leaves_kw[3] = { - L( 14), L( 77), L(277), + L( 15), L( 77), L(277), }; static const FcChar16 numbers_kw[3] = { @@ -3134,7 +3134,7 @@ static const FcChar16 numbers_ky[1] = { }; static const FcCharLeaf *leaves_la[2] = { - L( 14), L(279), + L( 15), L(279), }; static const FcChar16 numbers_la[2] = { @@ -3158,7 +3158,7 @@ static const FcChar16 numbers_lo[1] = { }; static const FcCharLeaf *leaves_lt[2] = { - L( 14), L(282), + L( 15), L(282), }; static const FcChar16 numbers_lt[2] = { @@ -3166,7 +3166,7 @@ static const FcChar16 numbers_lt[2] = { }; static const FcCharLeaf *leaves_lv[2] = { - L( 14), L(283), + L( 15), L(283), }; static const FcChar16 numbers_lv[2] = { @@ -3182,7 +3182,7 @@ static const FcChar16 numbers_mg[1] = { }; static const FcCharLeaf *leaves_mh[2] = { - L( 14), L(285), + L( 15), L(285), }; static const FcChar16 numbers_mh[2] = { @@ -3190,7 +3190,7 @@ static const FcChar16 numbers_mh[2] = { }; static const FcCharLeaf *leaves_mi[3] = { - L( 14), L( 77), L(286), + L( 15), L( 77), L(286), }; static const FcChar16 numbers_mi[3] = { @@ -3222,7 +3222,7 @@ static const FcChar16 numbers_mn[1] = { }; static const FcCharLeaf *leaves_mo[4] = { - L(290), L( 40), L(291), L(273), + L(290), L( 40), L(291), L(275), }; static const FcChar16 numbers_mo[4] = { @@ -3270,7 +3270,7 @@ static const FcChar16 numbers_nn[1] = { }; static const FcCharLeaf *leaves_ny[2] = { - L( 14), L(299), + L( 15), L(299), }; static const FcChar16 numbers_ny[2] = { @@ -3342,7 +3342,7 @@ static const FcChar16 numbers_sah[1] = { }; static const FcCharLeaf *leaves_sco[3] = { - L( 14), L(308), L(309), + L( 15), L(308), L(309), }; static const FcChar16 numbers_sco[3] = { @@ -3382,13 +3382,21 @@ static const FcChar16 numbers_sk[2] = { }; static const FcCharLeaf *leaves_sl[3] = { - L( 14), L(316), L(317), + L( 15), L(316), L(317), }; static const FcChar16 numbers_sl[3] = { 0x0000, 0x0001, 0x0004, }; +static const FcCharLeaf *leaves_sm[2] = { + L( 15), L( 78), +}; + +static const FcChar16 numbers_sm[2] = { + 0x0000, 0x0002, +}; + static const FcCharLeaf *leaves_sma[1] = { L(318), }; @@ -3413,14 +3421,6 @@ static const FcChar16 numbers_smn[2] = { 0x0000, 0x0001, }; -static const FcCharLeaf *leaves_sm[2] = { - L( 14), L( 78), -}; - -static const FcChar16 numbers_sm[2] = { - 0x0000, 0x0002, -}; - static const FcCharLeaf *leaves_sms[3] = { L(322), L(323), L(324), }; @@ -3550,7 +3550,7 @@ static const FcChar16 numbers_uz[1] = { }; static const FcCharLeaf *leaves_ven[2] = { - L( 14), L(345), + L( 15), L(345), }; static const FcChar16 numbers_ven[2] = { @@ -3709,354 +3709,354 @@ static const FcChar16 numbers_zh_mo[83] = { static const FcLangCharSet fcLangCharSets[] = { { (FcChar8 *) "aa", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_aa, (FcChar16 *) numbers_aa } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_aa, (FcChar16 *) numbers_aa } }, { (FcChar8 *) "ab", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ab, (FcChar16 *) numbers_ab } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ab, (FcChar16 *) numbers_ab } }, { (FcChar8 *) "af", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_af, (FcChar16 *) numbers_af } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_af, (FcChar16 *) numbers_af } }, { (FcChar8 *) "am", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_am, (FcChar16 *) numbers_am } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_am, (FcChar16 *) numbers_am } }, { (FcChar8 *) "ar", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ar, (FcChar16 *) numbers_ar } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ar, (FcChar16 *) numbers_ar } }, { (FcChar8 *) "ast", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ast, (FcChar16 *) numbers_ast } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ast, (FcChar16 *) numbers_ast } }, { (FcChar8 *) "ava", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ava, (FcChar16 *) numbers_ava } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ava, (FcChar16 *) numbers_ava } }, { (FcChar8 *) "ay", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ay, (FcChar16 *) numbers_ay } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ay, (FcChar16 *) numbers_ay } }, { (FcChar8 *) "az", - { 1, FcTrue, 4, (FcCharLeaf **) leaves_az, (FcChar16 *) numbers_az } }, - { (FcChar8 *) "bam", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_bam, (FcChar16 *) numbers_bam } }, + { FC_REF_CONSTANT, 4, (FcCharLeaf **) leaves_az, (FcChar16 *) numbers_az } }, { (FcChar8 *) "ba", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ba, (FcChar16 *) numbers_ba } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ba, (FcChar16 *) numbers_ba } }, + { (FcChar8 *) "bam", + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_bam, (FcChar16 *) numbers_bam } }, { (FcChar8 *) "be", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_be, (FcChar16 *) numbers_be } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_be, (FcChar16 *) numbers_be } }, { (FcChar8 *) "bg", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bg, (FcChar16 *) numbers_bg } }, - { (FcChar8 *) "bho", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bg, (FcChar16 *) numbers_bg } }, { (FcChar8 *) "bh", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, - { (FcChar8 *) "bin", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_bin, (FcChar16 *) numbers_bin } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, + { (FcChar8 *) "bho", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, { (FcChar8 *) "bi", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bi, (FcChar16 *) numbers_bi } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bi, (FcChar16 *) numbers_bi } }, + { (FcChar8 *) "bin", + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_bin, (FcChar16 *) numbers_bin } }, { (FcChar8 *) "bn", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bn, (FcChar16 *) numbers_bn } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bn, (FcChar16 *) numbers_bn } }, { (FcChar8 *) "bo", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bo, (FcChar16 *) numbers_bo } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bo, (FcChar16 *) numbers_bo } }, { (FcChar8 *) "br", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_br, (FcChar16 *) numbers_br } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_br, (FcChar16 *) numbers_br } }, { (FcChar8 *) "bs", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_bs, (FcChar16 *) numbers_bs } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_bs, (FcChar16 *) numbers_bs } }, { (FcChar8 *) "bua", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bua, (FcChar16 *) numbers_bua } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bua, (FcChar16 *) numbers_bua } }, { (FcChar8 *) "ca", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ca, (FcChar16 *) numbers_ca } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ca, (FcChar16 *) numbers_ca } }, { (FcChar8 *) "ce", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ava, (FcChar16 *) numbers_ava } }, - { (FcChar8 *) "chm", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_chm, (FcChar16 *) numbers_chm } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ava, (FcChar16 *) numbers_ava } }, { (FcChar8 *) "ch", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ch, (FcChar16 *) numbers_ch } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ch, (FcChar16 *) numbers_ch } }, + { (FcChar8 *) "chm", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_chm, (FcChar16 *) numbers_chm } }, { (FcChar8 *) "chr", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_chr, (FcChar16 *) numbers_chr } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_chr, (FcChar16 *) numbers_chr } }, { (FcChar8 *) "co", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_co, (FcChar16 *) numbers_co } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_co, (FcChar16 *) numbers_co } }, { (FcChar8 *) "cs", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_cs, (FcChar16 *) numbers_cs } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_cs, (FcChar16 *) numbers_cs } }, { (FcChar8 *) "cu", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_cu, (FcChar16 *) numbers_cu } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_cu, (FcChar16 *) numbers_cu } }, { (FcChar8 *) "cv", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_cv, (FcChar16 *) numbers_cv } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_cv, (FcChar16 *) numbers_cv } }, { (FcChar8 *) "cy", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_cy, (FcChar16 *) numbers_cy } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_cy, (FcChar16 *) numbers_cy } }, { (FcChar8 *) "da", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_da, (FcChar16 *) numbers_da } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_da, (FcChar16 *) numbers_da } }, { (FcChar8 *) "de", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_de, (FcChar16 *) numbers_de } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_de, (FcChar16 *) numbers_de } }, { (FcChar8 *) "dz", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bo, (FcChar16 *) numbers_bo } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bo, (FcChar16 *) numbers_bo } }, { (FcChar8 *) "el", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_el, (FcChar16 *) numbers_el } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_el, (FcChar16 *) numbers_el } }, { (FcChar8 *) "en", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_en, (FcChar16 *) numbers_en } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_en, (FcChar16 *) numbers_en } }, { (FcChar8 *) "eo", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_eo, (FcChar16 *) numbers_eo } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_eo, (FcChar16 *) numbers_eo } }, { (FcChar8 *) "es", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_es, (FcChar16 *) numbers_es } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_es, (FcChar16 *) numbers_es } }, { (FcChar8 *) "et", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_et, (FcChar16 *) numbers_et } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_et, (FcChar16 *) numbers_et } }, { (FcChar8 *) "eu", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_eu, (FcChar16 *) numbers_eu } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_eu, (FcChar16 *) numbers_eu } }, { (FcChar8 *) "fa", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_fa, (FcChar16 *) numbers_fa } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_fa, (FcChar16 *) numbers_fa } }, { (FcChar8 *) "fi", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_fi, (FcChar16 *) numbers_fi } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_fi, (FcChar16 *) numbers_fi } }, { (FcChar8 *) "fj", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "fo", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fo, (FcChar16 *) numbers_fo } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fo, (FcChar16 *) numbers_fo } }, { (FcChar8 *) "fr", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_co, (FcChar16 *) numbers_co } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_co, (FcChar16 *) numbers_co } }, { (FcChar8 *) "ful", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_ful, (FcChar16 *) numbers_ful } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_ful, (FcChar16 *) numbers_ful } }, { (FcChar8 *) "fur", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fur, (FcChar16 *) numbers_fur } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fur, (FcChar16 *) numbers_fur } }, { (FcChar8 *) "fy", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fy, (FcChar16 *) numbers_fy } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fy, (FcChar16 *) numbers_fy } }, { (FcChar8 *) "ga", - { 1, FcTrue, 4, (FcCharLeaf **) leaves_ga, (FcChar16 *) numbers_ga } }, + { FC_REF_CONSTANT, 4, (FcCharLeaf **) leaves_ga, (FcChar16 *) numbers_ga } }, { (FcChar8 *) "gd", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_gd, (FcChar16 *) numbers_gd } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_gd, (FcChar16 *) numbers_gd } }, { (FcChar8 *) "gez", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_am, (FcChar16 *) numbers_am } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_am, (FcChar16 *) numbers_am } }, { (FcChar8 *) "gl", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_gl, (FcChar16 *) numbers_gl } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_gl, (FcChar16 *) numbers_gl } }, { (FcChar8 *) "gn", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_gn, (FcChar16 *) numbers_gn } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_gn, (FcChar16 *) numbers_gn } }, { (FcChar8 *) "gu", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_gu, (FcChar16 *) numbers_gu } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_gu, (FcChar16 *) numbers_gu } }, { (FcChar8 *) "gv", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_gv, (FcChar16 *) numbers_gv } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_gv, (FcChar16 *) numbers_gv } }, { (FcChar8 *) "ha", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_ha, (FcChar16 *) numbers_ha } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_ha, (FcChar16 *) numbers_ha } }, { (FcChar8 *) "haw", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_haw, (FcChar16 *) numbers_haw } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_haw, (FcChar16 *) numbers_haw } }, { (FcChar8 *) "he", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_he, (FcChar16 *) numbers_he } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_he, (FcChar16 *) numbers_he } }, { (FcChar8 *) "hi", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, { (FcChar8 *) "ho", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "hr", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_hr, (FcChar16 *) numbers_hr } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_hr, (FcChar16 *) numbers_hr } }, { (FcChar8 *) "hu", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_hu, (FcChar16 *) numbers_hu } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_hu, (FcChar16 *) numbers_hu } }, { (FcChar8 *) "hy", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_hy, (FcChar16 *) numbers_hy } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_hy, (FcChar16 *) numbers_hy } }, { (FcChar8 *) "ia", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "ibo", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ibo, (FcChar16 *) numbers_ibo } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ibo, (FcChar16 *) numbers_ibo } }, { (FcChar8 *) "id", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_id, (FcChar16 *) numbers_id } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_id, (FcChar16 *) numbers_id } }, { (FcChar8 *) "ie", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "ik", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ik, (FcChar16 *) numbers_ik } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ik, (FcChar16 *) numbers_ik } }, { (FcChar8 *) "io", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "is", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_is, (FcChar16 *) numbers_is } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_is, (FcChar16 *) numbers_is } }, { (FcChar8 *) "it", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_it, (FcChar16 *) numbers_it } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_it, (FcChar16 *) numbers_it } }, { (FcChar8 *) "iu", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_iu, (FcChar16 *) numbers_iu } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_iu, (FcChar16 *) numbers_iu } }, { (FcChar8 *) "ja", - { 1, FcTrue, 84, (FcCharLeaf **) leaves_ja, (FcChar16 *) numbers_ja } }, - { (FcChar8 *) "kaa", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kaa, (FcChar16 *) numbers_kaa } }, + { FC_REF_CONSTANT, 84, (FcCharLeaf **) leaves_ja, (FcChar16 *) numbers_ja } }, { (FcChar8 *) "ka", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ka, (FcChar16 *) numbers_ka } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ka, (FcChar16 *) numbers_ka } }, + { (FcChar8 *) "kaa", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kaa, (FcChar16 *) numbers_kaa } }, { (FcChar8 *) "ki", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ki, (FcChar16 *) numbers_ki } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ki, (FcChar16 *) numbers_ki } }, { (FcChar8 *) "kk", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kk, (FcChar16 *) numbers_kk } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kk, (FcChar16 *) numbers_kk } }, { (FcChar8 *) "kl", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_kl, (FcChar16 *) numbers_kl } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_kl, (FcChar16 *) numbers_kl } }, { (FcChar8 *) "km", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_km, (FcChar16 *) numbers_km } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_km, (FcChar16 *) numbers_km } }, { (FcChar8 *) "kn", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kn, (FcChar16 *) numbers_kn } }, - { (FcChar8 *) "kok", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kn, (FcChar16 *) numbers_kn } }, { (FcChar8 *) "ko", - { 1, FcTrue, 129, (FcCharLeaf **) leaves_ko, (FcChar16 *) numbers_ko } }, + { FC_REF_CONSTANT, 129, (FcCharLeaf **) leaves_ko, (FcChar16 *) numbers_ko } }, + { (FcChar8 *) "kok", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, { (FcChar8 *) "ks", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, - { (FcChar8 *) "kum", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kum, (FcChar16 *) numbers_kum } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, { (FcChar8 *) "ku", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ku, (FcChar16 *) numbers_ku } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ku, (FcChar16 *) numbers_ku } }, + { (FcChar8 *) "kum", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kum, (FcChar16 *) numbers_kum } }, { (FcChar8 *) "kv", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kv, (FcChar16 *) numbers_kv } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kv, (FcChar16 *) numbers_kv } }, { (FcChar8 *) "kw", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_kw, (FcChar16 *) numbers_kw } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_kw, (FcChar16 *) numbers_kw } }, { (FcChar8 *) "ky", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ky, (FcChar16 *) numbers_ky } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ky, (FcChar16 *) numbers_ky } }, { (FcChar8 *) "la", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_la, (FcChar16 *) numbers_la } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_la, (FcChar16 *) numbers_la } }, { (FcChar8 *) "lb", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_lb, (FcChar16 *) numbers_lb } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_lb, (FcChar16 *) numbers_lb } }, { (FcChar8 *) "lez", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ava, (FcChar16 *) numbers_ava } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ava, (FcChar16 *) numbers_ava } }, { (FcChar8 *) "lo", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_lo, (FcChar16 *) numbers_lo } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_lo, (FcChar16 *) numbers_lo } }, { (FcChar8 *) "lt", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_lt, (FcChar16 *) numbers_lt } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_lt, (FcChar16 *) numbers_lt } }, { (FcChar8 *) "lv", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_lv, (FcChar16 *) numbers_lv } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_lv, (FcChar16 *) numbers_lv } }, { (FcChar8 *) "mg", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_mg, (FcChar16 *) numbers_mg } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_mg, (FcChar16 *) numbers_mg } }, { (FcChar8 *) "mh", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_mh, (FcChar16 *) numbers_mh } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_mh, (FcChar16 *) numbers_mh } }, { (FcChar8 *) "mi", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_mi, (FcChar16 *) numbers_mi } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_mi, (FcChar16 *) numbers_mi } }, { (FcChar8 *) "mk", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_mk, (FcChar16 *) numbers_mk } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_mk, (FcChar16 *) numbers_mk } }, { (FcChar8 *) "ml", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ml, (FcChar16 *) numbers_ml } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ml, (FcChar16 *) numbers_ml } }, { (FcChar8 *) "mn", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_mn, (FcChar16 *) numbers_mn } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_mn, (FcChar16 *) numbers_mn } }, { (FcChar8 *) "mo", - { 1, FcTrue, 4, (FcCharLeaf **) leaves_mo, (FcChar16 *) numbers_mo } }, + { FC_REF_CONSTANT, 4, (FcCharLeaf **) leaves_mo, (FcChar16 *) numbers_mo } }, { (FcChar8 *) "mr", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, { (FcChar8 *) "mt", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_mt, (FcChar16 *) numbers_mt } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_mt, (FcChar16 *) numbers_mt } }, { (FcChar8 *) "my", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_my, (FcChar16 *) numbers_my } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_my, (FcChar16 *) numbers_my } }, { (FcChar8 *) "nb", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_nb, (FcChar16 *) numbers_nb } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_nb, (FcChar16 *) numbers_nb } }, { (FcChar8 *) "ne", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, { (FcChar8 *) "nl", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_nl, (FcChar16 *) numbers_nl } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_nl, (FcChar16 *) numbers_nl } }, { (FcChar8 *) "nn", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_nn, (FcChar16 *) numbers_nn } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_nn, (FcChar16 *) numbers_nn } }, { (FcChar8 *) "no", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_nb, (FcChar16 *) numbers_nb } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_nb, (FcChar16 *) numbers_nb } }, { (FcChar8 *) "ny", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ny, (FcChar16 *) numbers_ny } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ny, (FcChar16 *) numbers_ny } }, { (FcChar8 *) "oc", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_oc, (FcChar16 *) numbers_oc } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_oc, (FcChar16 *) numbers_oc } }, { (FcChar8 *) "om", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "or", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_or, (FcChar16 *) numbers_or } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_or, (FcChar16 *) numbers_or } }, { (FcChar8 *) "os", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kum, (FcChar16 *) numbers_kum } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kum, (FcChar16 *) numbers_kum } }, { (FcChar8 *) "pl", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_pl, (FcChar16 *) numbers_pl } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_pl, (FcChar16 *) numbers_pl } }, { (FcChar8 *) "pt", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_pt, (FcChar16 *) numbers_pt } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_pt, (FcChar16 *) numbers_pt } }, { (FcChar8 *) "rm", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_rm, (FcChar16 *) numbers_rm } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_rm, (FcChar16 *) numbers_rm } }, { (FcChar8 *) "ro", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_ro, (FcChar16 *) numbers_ro } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_ro, (FcChar16 *) numbers_ro } }, { (FcChar8 *) "ru", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ru, (FcChar16 *) numbers_ru } }, - { (FcChar8 *) "sah", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_sah, (FcChar16 *) numbers_sah } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ru, (FcChar16 *) numbers_ru } }, { (FcChar8 *) "sa", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_bho, (FcChar16 *) numbers_bho } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_bh, (FcChar16 *) numbers_bh } }, + { (FcChar8 *) "sah", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_sah, (FcChar16 *) numbers_sah } }, { (FcChar8 *) "sco", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_sco, (FcChar16 *) numbers_sco } }, - { (FcChar8 *) "sel", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_kum, (FcChar16 *) numbers_kum } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_sco, (FcChar16 *) numbers_sco } }, { (FcChar8 *) "se", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_se, (FcChar16 *) numbers_se } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_se, (FcChar16 *) numbers_se } }, + { (FcChar8 *) "sel", + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_kum, (FcChar16 *) numbers_kum } }, { (FcChar8 *) "sh", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_sh, (FcChar16 *) numbers_sh } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_sh, (FcChar16 *) numbers_sh } }, { (FcChar8 *) "si", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_si, (FcChar16 *) numbers_si } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_si, (FcChar16 *) numbers_si } }, { (FcChar8 *) "sk", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_sk, (FcChar16 *) numbers_sk } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_sk, (FcChar16 *) numbers_sk } }, { (FcChar8 *) "sl", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_sl, (FcChar16 *) numbers_sl } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_sl, (FcChar16 *) numbers_sl } }, + { (FcChar8 *) "sm", + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_sm, (FcChar16 *) numbers_sm } }, { (FcChar8 *) "sma", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_sma, (FcChar16 *) numbers_sma } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_sma, (FcChar16 *) numbers_sma } }, { (FcChar8 *) "smj", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_smj, (FcChar16 *) numbers_smj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_smj, (FcChar16 *) numbers_smj } }, { (FcChar8 *) "smn", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_smn, (FcChar16 *) numbers_smn } }, - { (FcChar8 *) "sm", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_sm, (FcChar16 *) numbers_sm } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_smn, (FcChar16 *) numbers_smn } }, { (FcChar8 *) "sms", - { 1, FcTrue, 3, (FcCharLeaf **) leaves_sms, (FcChar16 *) numbers_sms } }, + { FC_REF_CONSTANT, 3, (FcCharLeaf **) leaves_sms, (FcChar16 *) numbers_sms } }, { (FcChar8 *) "so", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "sq", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_sq, (FcChar16 *) numbers_sq } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_sq, (FcChar16 *) numbers_sq } }, { (FcChar8 *) "sr", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_sh, (FcChar16 *) numbers_sh } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_sh, (FcChar16 *) numbers_sh } }, { (FcChar8 *) "sv", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_sv, (FcChar16 *) numbers_sv } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_sv, (FcChar16 *) numbers_sv } }, { (FcChar8 *) "sw", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "syr", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_syr, (FcChar16 *) numbers_syr } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_syr, (FcChar16 *) numbers_syr } }, { (FcChar8 *) "ta", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ta, (FcChar16 *) numbers_ta } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ta, (FcChar16 *) numbers_ta } }, { (FcChar8 *) "te", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_te, (FcChar16 *) numbers_te } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_te, (FcChar16 *) numbers_te } }, { (FcChar8 *) "tg", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_tg, (FcChar16 *) numbers_tg } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_tg, (FcChar16 *) numbers_tg } }, { (FcChar8 *) "th", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_th, (FcChar16 *) numbers_th } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_th, (FcChar16 *) numbers_th } }, { (FcChar8 *) "ti", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_am, (FcChar16 *) numbers_am } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_am, (FcChar16 *) numbers_am } }, { (FcChar8 *) "tk", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_tk, (FcChar16 *) numbers_tk } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_tk, (FcChar16 *) numbers_tk } }, { (FcChar8 *) "tl", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_tl, (FcChar16 *) numbers_tl } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_tl, (FcChar16 *) numbers_tl } }, { (FcChar8 *) "tn", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_tn, (FcChar16 *) numbers_tn } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_tn, (FcChar16 *) numbers_tn } }, { (FcChar8 *) "to", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_sm, (FcChar16 *) numbers_sm } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_sm, (FcChar16 *) numbers_sm } }, { (FcChar8 *) "tr", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_tr, (FcChar16 *) numbers_tr } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_tr, (FcChar16 *) numbers_tr } }, { (FcChar8 *) "ts", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "tt", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_tt, (FcChar16 *) numbers_tt } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_tt, (FcChar16 *) numbers_tt } }, { (FcChar8 *) "tw", - { 1, FcTrue, 5, (FcCharLeaf **) leaves_tw, (FcChar16 *) numbers_tw } }, + { FC_REF_CONSTANT, 5, (FcCharLeaf **) leaves_tw, (FcChar16 *) numbers_tw } }, { (FcChar8 *) "tyv", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ky, (FcChar16 *) numbers_ky } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ky, (FcChar16 *) numbers_ky } }, { (FcChar8 *) "ug", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ar, (FcChar16 *) numbers_ar } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ar, (FcChar16 *) numbers_ar } }, { (FcChar8 *) "uk", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_uk, (FcChar16 *) numbers_uk } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_uk, (FcChar16 *) numbers_uk } }, { (FcChar8 *) "ur", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_ar, (FcChar16 *) numbers_ar } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_ar, (FcChar16 *) numbers_ar } }, { (FcChar8 *) "uz", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_uz, (FcChar16 *) numbers_uz } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_uz, (FcChar16 *) numbers_uz } }, { (FcChar8 *) "ven", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_ven, (FcChar16 *) numbers_ven } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_ven, (FcChar16 *) numbers_ven } }, { (FcChar8 *) "vi", - { 1, FcTrue, 4, (FcCharLeaf **) leaves_vi, (FcChar16 *) numbers_vi } }, + { FC_REF_CONSTANT, 4, (FcCharLeaf **) leaves_vi, (FcChar16 *) numbers_vi } }, { (FcChar8 *) "vo", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_vo, (FcChar16 *) numbers_vo } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_vo, (FcChar16 *) numbers_vo } }, { (FcChar8 *) "vot", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_vot, (FcChar16 *) numbers_vot } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_vot, (FcChar16 *) numbers_vot } }, { (FcChar8 *) "wa", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_wa, (FcChar16 *) numbers_wa } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_wa, (FcChar16 *) numbers_wa } }, { (FcChar8 *) "wen", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_wen, (FcChar16 *) numbers_wen } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_wen, (FcChar16 *) numbers_wen } }, { (FcChar8 *) "wo", - { 1, FcTrue, 2, (FcCharLeaf **) leaves_wo, (FcChar16 *) numbers_wo } }, + { FC_REF_CONSTANT, 2, (FcCharLeaf **) leaves_wo, (FcChar16 *) numbers_wo } }, { (FcChar8 *) "xh", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, { (FcChar8 *) "yap", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_yap, (FcChar16 *) numbers_yap } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_yap, (FcChar16 *) numbers_yap } }, { (FcChar8 *) "yi", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_he, (FcChar16 *) numbers_he } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_he, (FcChar16 *) numbers_he } }, { (FcChar8 *) "yo", - { 1, FcTrue, 4, (FcCharLeaf **) leaves_yo, (FcChar16 *) numbers_yo } }, + { FC_REF_CONSTANT, 4, (FcCharLeaf **) leaves_yo, (FcChar16 *) numbers_yo } }, { (FcChar8 *) "zh-cn", - { 1, FcTrue, 82, (FcCharLeaf **) leaves_zh_cn, (FcChar16 *) numbers_zh_cn } }, + { FC_REF_CONSTANT, 82, (FcCharLeaf **) leaves_zh_cn, (FcChar16 *) numbers_zh_cn } }, { (FcChar8 *) "zh-hk", - { 1, FcTrue, 83, (FcCharLeaf **) leaves_zh_hk, (FcChar16 *) numbers_zh_hk } }, + { FC_REF_CONSTANT, 83, (FcCharLeaf **) leaves_zh_hk, (FcChar16 *) numbers_zh_hk } }, { (FcChar8 *) "zh-mo", - { 1, FcTrue, 83, (FcCharLeaf **) leaves_zh_mo, (FcChar16 *) numbers_zh_mo } }, + { FC_REF_CONSTANT, 83, (FcCharLeaf **) leaves_zh_mo, (FcChar16 *) numbers_zh_mo } }, { (FcChar8 *) "zh-sg", - { 1, FcTrue, 82, (FcCharLeaf **) leaves_zh_cn, (FcChar16 *) numbers_zh_cn } }, + { FC_REF_CONSTANT, 82, (FcCharLeaf **) leaves_zh_cn, (FcChar16 *) numbers_zh_cn } }, { (FcChar8 *) "zh-tw", - { 1, FcTrue, 83, (FcCharLeaf **) leaves_zh_mo, (FcChar16 *) numbers_zh_mo } }, + { FC_REF_CONSTANT, 83, (FcCharLeaf **) leaves_zh_mo, (FcChar16 *) numbers_zh_mo } }, { (FcChar8 *) "zu", - { 1, FcTrue, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, + { FC_REF_CONSTANT, 1, (FcCharLeaf **) leaves_fj, (FcChar16 *) numbers_fj } }, }; diff --git a/fontconfig/fcprivate.h b/fontconfig/fcprivate.h index cd63ad6..4afdb1a 100644 --- a/fontconfig/fcprivate.h +++ b/fontconfig/fcprivate.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.4 2002/08/11 18:10:41 keithp Exp $ + * $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.5 2002/08/19 19:32:04 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -73,6 +73,9 @@ case FcTypeFTFace: \ __v__.u.f = va_arg (va, FT_Face); \ break; \ + case FcTypeLangSet: \ + __v__.u.l = va_arg (va, FcLangSet *); \ + break; \ } \ if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ goto _FcPatternVapBuild_bail1; \ diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 6f378cd..c2ab09b 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.25 2002/08/11 18:10:41 keithp Exp $ + * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.26 2002/08/19 19:32:04 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -109,7 +109,8 @@ typedef enum _FcType { FcTypeBool, FcTypeMatrix, FcTypeCharSet, - FcTypeFTFace + FcTypeFTFace, + FcTypeLangSet } FcType; typedef struct _FcMatrix { @@ -143,6 +144,8 @@ typedef enum _FcResult { typedef struct _FcPattern FcPattern; +typedef struct _FcLangSet FcLangSet; + typedef struct _FcValue { FcType type; union { @@ -154,6 +157,7 @@ typedef struct _FcValue { const FcCharSet *c; void *f; const FcPattern *p; + const FcLangSet *l; } u; } FcValue; @@ -173,6 +177,10 @@ typedef enum _FcMatchKind { FcMatchPattern, FcMatchFont } FcMatchKind; +typedef enum _FcLangResult { + FcLangEqual, FcLangDifferentCountry, FcLangDifferentLang +} FcLangResult; + typedef enum _FcSetName { FcSetSystem = 0, FcSetApplication = 1 @@ -409,6 +417,31 @@ FcInitReinitialize (void); FcBool FcInitBringUptoDate (void); +/* fclang.c */ +FcLangSet * +FcLangSetCreate (void); + +void +FcLangSetDestroy (FcLangSet *ls); + +FcLangSet * +FcLangSetCopy (const FcLangSet *ls); + +FcBool +FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang); + +FcLangResult +FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang); + +FcLangResult +FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb); + +FcBool +FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb); + +FcChar32 +FcLangSetHash (const FcLangSet *ls); + /* fclist.c */ FcObjectSet * FcObjectSetCreate (void); @@ -609,6 +642,9 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c); FcBool FcPatternAddBool (FcPattern *p, const char *object, FcBool b); +FcBool +FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls); + FcResult FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i); @@ -627,6 +663,9 @@ FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c); FcResult FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b); +FcResult +FcPatternGetLangSet (FcPattern *p, const char *object, int n, FcLangSet **ls); + FcPattern * FcPatternVaBuild (FcPattern *orig, va_list va); @@ -691,6 +730,9 @@ FcStrSetCreate (void); FcBool FcStrSetMember (FcStrSet *set, const FcChar8 *s); +FcBool +FcStrSetEqual (FcStrSet *sa, FcStrSet *sb); + FcBool FcStrSetAdd (FcStrSet *set, const FcChar8 *s); diff --git a/src/fccache.c b/src/fccache.c index f4d6f91..0ff2721 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.10 2002/08/06 19:00:43 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.11 2002/08/19 19:32:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -247,6 +247,7 @@ FcCacheFontSetAdd (FcFontSet *set, int len; FcBool ret = FcFalse; FcPattern *font; + FcPattern *frozen; path = path_buf; len = (dir_len + 1 + strlen ((const char *) file) + 1); @@ -277,10 +278,15 @@ FcCacheFontSetAdd (FcFontSet *set, { if (FcDebug () & FC_DBG_CACHEV) printf (" dir cache file \"%s\"\n", file); - ret = (FcPatternAddString (font, FC_FILE, path) && - FcFontSetAdd (set, font)); - if (!ret) - FcPatternDestroy (font); + ret = FcPatternAddString (font, FC_FILE, path); + if (ret) + { + frozen = FcPatternFreeze (font); + ret = (frozen != 0); + if (ret) + ret = FcFontSetAdd (set, frozen); + } + FcPatternDestroy (font); } } if (path != path_buf) free (path); diff --git a/src/fccfg.c b/src/fccfg.c index ab99278..2ec9f77 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.19 2002/08/11 18:10:42 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.20 2002/08/19 19:32:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -473,6 +473,11 @@ FcConfigPromote (FcValue v, FcValue u) v.u.m = &FcIdentityMatrix; v.type = FcTypeMatrix; } + else if (v.type == FcTypeString && u.type == FcTypeLangSet) + { + v.u.l = FcLangSetPromote (v.u.s); + v.type = FcTypeLangSet; + } return v; } @@ -570,6 +575,21 @@ FcConfigCompareValue (FcValue m, break; } break; + case FcTypeLangSet: + switch (op) { + case FcOpContains: + ret = FcLangSetCompare (v.u.l, m.u.l) != FcLangDifferentLang; + break; + case FcOpEqual: + ret = FcLangSetEqual (v.u.l, m.u.l); + break; + case FcOpNotEqual: + ret = !FcLangSetEqual (v.u.l, m.u.l); + break; + default: + break; + } + break; case FcTypeVoid: switch (op) { case FcOpEqual: diff --git a/src/fccharset.c b/src/fccharset.c index c455efb..22fde8e 100644 --- a/src/fccharset.c +++ b/src/fccharset.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.16 2002/07/09 02:28:29 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.17 2002/07/13 05:43:25 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -42,7 +42,6 @@ FcCharSetCreate (void) fcs->num = 0; fcs->leaves = 0; fcs->numbers = 0; - fcs->constant = FcFalse; return fcs; } @@ -59,28 +58,28 @@ FcCharSetNew (void) void FcCharSetDestroy (FcCharSet *fcs) { - if (!fcs->constant && --fcs->ref <= 0) + int i; + if (fcs->ref == FC_REF_CONSTANT) + return; + if (--fcs->ref > 0) + return; + for (i = 0; i < fcs->num; i++) { - int i; - - for (i = 0; i < fcs->num; i++) - { - FcMemFree (FC_MEM_CHARNODE, sizeof (FcCharLeaf)); - free (fcs->leaves[i]); - } - if (fcs->leaves) - { - FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcCharLeaf *)); - free (fcs->leaves); - } - if (fcs->numbers) - { - FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16)); - free (fcs->numbers); - } - FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); - free (fcs); + FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf)); + free (fcs->leaves[i]); + } + if (fcs->leaves) + { + FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcCharLeaf *)); + free (fcs->leaves); } + if (fcs->numbers) + { + FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16)); + free (fcs->numbers); + } + FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); + free (fcs); } /* @@ -143,6 +142,7 @@ FcCharSetPutLeaf (FcCharSet *fcs, leaves = realloc (fcs->leaves, (fcs->num + 1) * sizeof (FcCharLeaf *)); if (!leaves) return FcFalse; + FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharLeaf *)); fcs->leaves = leaves; if (!fcs->numbers) numbers = malloc (sizeof (FcChar16)); @@ -150,6 +150,7 @@ FcCharSetPutLeaf (FcCharSet *fcs, numbers = realloc (fcs->numbers, (fcs->num + 1) * sizeof (FcChar16)); if (!numbers) return FcFalse; + FcMemAlloc (FC_MEM_CHARSET, sizeof (FcChar16)); fcs->numbers = numbers; memmove (fcs->leaves + pos + 1, fcs->leaves + pos, @@ -187,6 +188,7 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4) free (leaf); return 0; } + FcMemAlloc (FC_MEM_CHARLEAF, sizeof (FcCharLeaf)); return leaf; } @@ -198,7 +200,7 @@ FcCharSetInsertLeaf (FcCharSet *fcs, FcChar32 ucs4, FcCharLeaf *leaf) pos = FcCharSetFindLeafPos (fcs, ucs4); if (pos >= 0) { - FcMemAlloc (FC_MEM_CHARNODE, sizeof (FcCharLeaf)); + FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf)); free (fcs->leaves[pos]); fcs->leaves[pos] = leaf; return FcTrue; @@ -213,7 +215,7 @@ FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4) FcCharLeaf *leaf; FcChar32 *b; - if (fcs->constant) + if (fcs->ref == FC_REF_CONSTANT) return FcFalse; leaf = FcCharSetFindLeafCreate (fcs, ucs4); if (!leaf) @@ -307,7 +309,8 @@ FcCharSetIterStart (const FcCharSet *fcs, FcCharSetIter *iter) FcCharSet * FcCharSetCopy (FcCharSet *src) { - src->ref++; + if (src->ref != FC_REF_CONSTANT) + src->ref++; return src; } @@ -835,6 +838,7 @@ FcCharLeafEntCreate (void) block = malloc (FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt)); if (!block) return 0; + FcMemAlloc (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt)); remain = FC_CHAR_LEAF_BLOCK; } remain--; @@ -921,6 +925,7 @@ FcCharSetFreezeBase (FcCharSet *fcs) FcChar32 hash = FcCharSetHash (fcs); FcCharSetEnt **bucket = &hashTable[hash % FC_CHAR_SET_HASH_SIZE]; FcCharSetEnt *ent; + int size; FcCharSetTotal++; FcCharSetTotalEnts += fcs->num; @@ -937,16 +942,17 @@ FcCharSetFreezeBase (FcCharSet *fcs) } } - ent = malloc (sizeof (FcCharSetEnt) + - fcs->num * sizeof (FcCharLeaf *) + - fcs->num * sizeof (FcChar16)); + size = (sizeof (FcCharSetEnt) + + fcs->num * sizeof (FcCharLeaf *) + + fcs->num * sizeof (FcChar16)); + ent = malloc (size); if (!ent) return 0; + FcMemAlloc (FC_MEM_CHARSET, size); FcCharSetUsed++; FcCharSetUsedEnts += fcs->num; - ent->set.ref = 0; - ent->set.constant = FcTrue; + ent->set.ref = FC_REF_CONSTANT; ent->set.num = fcs->num; if (fcs->num) { @@ -989,9 +995,16 @@ FcCharSetFreeze (FcCharSet *fcs) n = FcCharSetFreezeBase (b); bail1: if (b->leaves) + { + FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcCharLeaf *)); free (b->leaves); + } if (b->numbers) + { + FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcChar16)); free (b->numbers); + } + FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); free (b); bail0: return n; @@ -1056,9 +1069,16 @@ FcNameParseCharSet (FcChar8 *string) n = FcCharSetFreezeBase (c); bail1: if (c->leaves) + { + FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcCharLeaf *)); free (c->leaves); + } if (c->numbers) + { + FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcChar16)); free (c->numbers); + } + FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet)); free (c); bail0: return n; diff --git a/src/fcdbg.c b/src/fcdbg.c index a3deba1..adb8e81 100644 --- a/src/fcdbg.c +++ b/src/fcdbg.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fcdbg.c,v 1.7 2002/08/11 18:10:42 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fcdbg.c,v 1.8 2002/08/19 19:32:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -51,6 +51,9 @@ FcValuePrint (const FcValue v) case FcTypeCharSet: /* XXX */ printf (" set"); break; + case FcTypeLangSet: + printf (" langset"); + break; case FcTypeFTFace: printf (" face"); break; diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 8e0a0a5..8f16c74 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.8 2002/07/09 02:28:29 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.9 2002/07/13 05:43:25 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -123,6 +123,7 @@ FcFreeTypeQuery (const FcChar8 *file, int weight; int i; FcCharSet *cs; + FcLangSet *ls; FT_Library ftLibrary; FcChar8 *family; FcChar8 *style; @@ -526,8 +527,12 @@ FcFreeTypeQuery (const FcChar8 *file, if (!FcPatternAddCharSet (pat, FC_CHARSET, cs)) goto bail2; - if (!FcFreeTypeSetLang (pat, cs, exclusiveLang)) - goto bail2; + ls = FcFreeTypeLangSet (cs, exclusiveLang); + if (!ls) + goto bail2; + + if (!FcPatternAddLangSet (pat, FC_LANG, ls)) + goto bail2; /* * Drop our reference to the charset diff --git a/src/fcinit.c b/src/fcinit.c index 5f1fe36..7783194 100644 --- a/src/fcinit.c +++ b/src/fcinit.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.5 2002/05/21 17:48:15 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.6 2002/05/23 23:00:46 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -102,6 +102,8 @@ FcInit (void) if (!config) return FcTrue; FcConfigSetCurrent (config); + if (FcDebug() & FC_DBG_MEMORY) + FcMemReport (); return FcTrue; } @@ -153,7 +155,7 @@ static struct { int free_mem; } FcInUse[FC_MEM_NUM] = { { "charset", 0, 0 }, - { "charnode", 0 ,0 }, + { "charleaf", 0 ,0 }, { "fontset", 0, 0 }, { "fontptr", 0, 0 }, { "objectset", 0, 0 }, @@ -165,6 +167,10 @@ static struct { { "substate", 0, 0 }, { "string", 0, 0 }, { "listbuck", 0, 0 }, + { "strset", 0, 0 }, + { "strlist", 0, 0 }, + { "config", 0, 0 }, + { "langset", 0, 0 }, }; static int FcAllocCount, FcAllocMem; @@ -174,6 +180,9 @@ static int FcMemNotice = 1*1024*1024; static int FcAllocNotify, FcFreeNotify; +void +FcValueListReport (void); + void FcMemReport (void) { @@ -196,6 +205,7 @@ FcMemReport (void) FcAllocMem - FcFreeMem); FcAllocNotify = 0; FcFreeNotify = 0; + FcValueListReport (); } void diff --git a/src/fcint.h b/src/fcint.h index b861dc1..1a16801 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -65,7 +65,7 @@ typedef struct _FcSymbolic { #define FC_DBG_MEMORY 512 #define FC_MEM_CHARSET 0 -#define FC_MEM_CHARNODE 1 +#define FC_MEM_CHARLEAF 1 #define FC_MEM_FONTSET 2 #define FC_MEM_FONTPTR 3 #define FC_MEM_OBJECTSET 4 @@ -77,10 +77,12 @@ typedef struct _FcSymbolic { #define FC_MEM_SUBSTATE 10 #define FC_MEM_STRING 11 #define FC_MEM_LISTBUCK 12 -#define FC_MEM_NUM 13 -#define FC_MEM_STRSET 14 -#define FC_MEM_STRLIST 15 -#define FC_MEM_CONFIG 16 +#define FC_MEM_STRSET 13 +#define FC_MEM_STRLIST 14 +#define FC_MEM_CONFIG 15 +#define FC_MEM_LANGSET 16 + +#define FC_MEM_NUM 17 typedef enum _FcValueBinding { FcValueBindingWeak, FcValueBindingStrong @@ -97,6 +99,7 @@ typedef struct _FcPatternElt { FcValueList *values; } FcPatternElt; + struct _FcPattern { int num; int size; @@ -167,13 +170,10 @@ typedef struct _FcCharLeaf { FcChar32 map[256/32]; } FcCharLeaf; -typedef enum _FcLangResult { - FcLangEqual, FcLangDifferentCountry, FcLangDifferentLang -} FcLangResult; +#define FC_REF_CONSTANT -1 struct _FcCharSet { int ref; /* reference count */ - FcBool constant; /* in hash table constant */ int num; /* size of leaves and numbers arrays */ FcCharLeaf **leaves; FcChar16 *numbers; @@ -537,9 +537,8 @@ void FcMemFree (int kind, int size); /* fclang.c */ -FcBool -FcFreeTypeSetLang (FcPattern *pattern, - FcCharSet *charset, +FcLangSet * +FcFreeTypeLangSet (const FcCharSet *charset, const FcChar8 *exclusiveLang); FcLangResult @@ -548,6 +547,15 @@ FcLangCompare (const FcChar8 *s1, const FcChar8 *s2); const FcCharSet * FcCharSetForLang (const FcChar8 *lang); +FcLangSet * +FcLangSetPromote (const FcChar8 *lang); + +FcLangSet * +FcNameParseLangSet (const FcChar8 *string); + +FcBool +FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls); + /* fclist.c */ /* fcmatch.c */ @@ -574,6 +582,9 @@ FcPatternAddWithBinding (FcPattern *p, FcValueBinding binding, FcBool append); +FcPattern * +FcPatternFreeze (FcPattern *p); + /* fcrender.c */ /* fcmatrix.c */ diff --git a/src/fclang.c b/src/fclang.c index 7a958b0..3ca09f7 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fclang.c,v 1.3 2002/07/08 07:31:53 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fclang.c,v 1.4 2002/07/12 21:06:03 keithp Exp $ * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * @@ -31,20 +31,32 @@ typedef struct { #include "../fc-lang/fclang.h" -#define NUM_LANG_CHAR_SET (sizeof (fcLangCharSets) / sizeof (fcLangCharSets[0])) - -FcBool -FcFreeTypeSetLang (FcPattern *pattern, - FcCharSet *charset, +#define NUM_LANG_CHAR_SET (sizeof (fcLangCharSets) / sizeof (fcLangCharSets[0])) +#define NUM_LANG_SET_MAP ((NUM_LANG_CHAR_SET + 31) / 32) + +struct _FcLangSet { + FcChar32 map[NUM_LANG_SET_MAP]; + FcStrSet *extra; +}; + +#define FcLangSetBitSet(ls, id) ((ls)->map[(id)>>5] |= ((FcChar32) 1 << ((id) & 0x1f))) +#define FcLangSetBitGet(ls, id) (((ls)->map[(id)>>5] >> ((id) & 0x1f)) & 1) + +FcLangSet * +FcFreeTypeLangSet (const FcCharSet *charset, const FcChar8 *exclusiveLang) { int i; FcChar32 missing; - FcBool hasLang = FcFalse; const FcCharSet *exclusiveCharset = 0; + FcLangSet *ls; + if (exclusiveLang) exclusiveCharset = FcCharSetForLang (exclusiveLang); + ls = FcLangSetCreate (); + if (!ls) + return 0; for (i = 0; i < NUM_LANG_CHAR_SET; i++) { /* @@ -91,76 +103,42 @@ FcFreeTypeSetLang (FcPattern *pattern, printf ("%s(%d) ", fcLangCharSets[i].lang, missing); } if (!missing) - { - if (!FcPatternAddString (pattern, FC_LANG, fcLangCharSets[i].lang)) - return FcFalse; - hasLang = FcTrue; - } + FcLangSetBitSet (ls, i); } - /* - * Make sure it has a lang entry - */ - if (!hasLang) - if (!FcPatternAddString (pattern, FC_LANG, (FcChar8 *) "x-unknown")) - return FcFalse; if (FcDebug() & FC_DBG_SCANV) printf ("\n"); - return FcTrue; + + + return ls; } +#define FcLangEnd(c) ((c) == '-' || (c) == '\0') FcLangResult FcLangCompare (const FcChar8 *s1, const FcChar8 *s2) { - const FcChar8 *orig_s1 = s1; FcChar8 c1, c2; - FcLangResult result; - /* - * Compare ISO 639 language codes - */ - for (;;) - { - c1 = *s1++; - c2 = *s2++; - if (c1 == '\0' || c1 == '-') - break; - if (c2 == '\0' || c2 == '-') - break; - c1 = FcToLower (c1); - c2 = FcToLower (c2); - if (c1 != c2) - return FcLangDifferentLang; /* mismatching lang code */ - } - if (!c1 && !c2) - return FcLangEqual; - /* - * Make x-* mismatch as if the lang part didn't match - */ - result = FcLangDifferentCountry; - if (orig_s1[0] == 'x' && (orig_s1[1] == '\0' || orig_s1[1] == '-')) - result = FcLangDifferentLang; - - if (c1 == '\0' || c2 == '\0') - return result; - /* - * Compare ISO 3166 country codes - */ + FcLangResult result = FcLangDifferentLang; + for (;;) { c1 = *s1++; c2 = *s2++; - if (!c1 || !c2) - break; + c1 = FcToLower (c1); c2 = FcToLower (c2); if (c1 != c2) - break; + { + if (FcLangEnd (c1) && FcLangEnd (c2)) + result = FcLangDifferentCountry; + return result; + } + else if (!c1) + return FcLangEqual; + else if (c1 == '-') + result = FcLangDifferentCountry; } - if (c1 == c2) - return FcLangEqual; - else - return result; } const FcCharSet * @@ -184,3 +162,340 @@ FcCharSetForLang (const FcChar8 *lang) return 0; return &fcLangCharSets[i].charset; } + +FcLangSet * +FcLangSetCreate (void) +{ + FcLangSet *ls; + + ls = malloc (sizeof (FcLangSet)); + if (!ls) + return 0; + FcMemAlloc (FC_MEM_LANGSET, sizeof (FcLangSet)); + memset (ls->map, '\0', sizeof (ls->map)); + ls->extra = 0; + return ls; +} + +void +FcLangSetDestroy (FcLangSet *ls) +{ + if (ls->extra) + FcStrSetDestroy (ls->extra); + FcMemFree (FC_MEM_LANGSET, sizeof (FcLangSet)); + free (ls); +} + +FcLangSet * +FcLangSetCopy (const FcLangSet *ls) +{ + FcLangSet *new; + + new = FcLangSetCreate (); + if (!new) + goto bail0; + memcpy (new->map, ls->map, sizeof (new->map)); + if (ls->extra) + { + FcStrList *list; + FcChar8 *extra; + + new->extra = FcStrSetCreate (); + if (!new->extra) + goto bail1; + + list = FcStrListCreate (ls->extra); + if (!list) + goto bail1; + + while ((extra = FcStrListNext (list))) + if (!FcStrSetAdd (new->extra, extra)) + { + FcStrListDone (list); + goto bail1; + } + FcStrListDone (list); + } + return new; +bail1: + FcLangSetDestroy (new); +bail0: + return 0; +} + +static int +FcLangSetIndex (const FcChar8 *lang) +{ + int low, high, mid; + int cmp; + + low = 0; + high = NUM_LANG_CHAR_SET - 1; + while (low <= high) + { + mid = (high + low) >> 1; + cmp = FcStrCmpIgnoreCase (fcLangCharSets[mid].lang, lang); + if (cmp == 0) + return mid; + if (cmp < 0) + low = mid + 1; + else + high = mid - 1; + } + if (cmp < 0) + mid++; + return -(mid + 1); +} + +FcBool +FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang) +{ + int id; + + id = FcLangSetIndex (lang); + if (id >= 0) + { + FcLangSetBitSet (ls, id); + return FcTrue; + } + if (!ls->extra) + { + ls->extra = FcStrSetCreate (); + if (!ls->extra) + return FcFalse; + } + return FcStrSetAdd (ls->extra, lang); +} + +FcLangResult +FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang) +{ + int id; + FcLangResult best, r; + int i; + + id = FcLangSetIndex (lang); + if (id >= 0) + return FcLangEqual; + id = -id - 1; + best = FcLangDifferentLang; + for (i = id - 1; i >= 0; i--) + { + r = FcLangCompare (lang, fcLangCharSets[i].lang); + if (r == FcLangDifferentLang) + break; + if (FcLangSetBitGet (ls, i) && r < best) + best = r; + } + for (i = id; i < NUM_LANG_CHAR_SET; i++) + { + r = FcLangCompare (lang, fcLangCharSets[i].lang); + if (r == FcLangDifferentLang) + break; + if (FcLangSetBitGet (ls, i) && r < best) + best = r; + } + if (ls->extra) + { + FcStrList *list = FcStrListCreate (ls->extra); + FcChar8 *extra; + FcLangResult r; + + if (list) + { + while (best > FcLangEqual && (extra = FcStrListNext (list))) + { + r = FcLangCompare (lang, extra); + if (r < best) + best = r; + } + FcStrListDone (list); + } + } + return best; +} + +static FcLangResult +FcLangSetCompareStrSet (const FcLangSet *ls, FcStrSet *set) +{ + FcStrList *list = FcStrListCreate (set); + FcLangResult r, best = FcLangDifferentLang; + FcChar8 *extra; + + if (list) + { + while (best > FcLangEqual && (extra = FcStrListNext (list))) + { + r = FcLangSetHasLang (ls, extra); + if (r < best) + best = r; + } + FcStrListDone (list); + } + return best; +} + +FcLangResult +FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb) +{ + int i; + FcLangResult best, r; + + for (i = 0; i < NUM_LANG_SET_MAP; i++) + if (lsa->map[i] & lsb->map[i]) + return FcLangEqual; + best = FcLangDifferentLang; + if (lsa->extra) + { + r = FcLangSetCompareStrSet (lsb, lsa->extra); + if (r < best) + best = r; + } + if (best > FcLangEqual && lsb->extra) + { + r = FcLangSetCompareStrSet (lsa, lsb->extra); + if (r < best) + best = r; + } + return best; +} + +/* + * Used in computing values -- mustn't allocate any storage + */ +FcLangSet * +FcLangSetPromote (const FcChar8 *lang) +{ + static FcLangSet ls; + static FcStrSet strs; + static FcChar8 *str; + int id; + + memset (ls.map, '\0', sizeof (ls.map)); + ls.extra = 0; + id = FcLangSetIndex (lang); + if (id > 0) + { + FcLangSetBitSet (&ls, id); + } + else + { + ls.extra = &strs; + strs.num = 1; + strs.size = 1; + strs.strs = &str; + str = (FcChar8 *) lang; + } + return &ls; +} + +FcChar32 +FcLangSetHash (const FcLangSet *ls) +{ + FcChar32 h = 0; + int i; + + for (i = 0; i < NUM_LANG_SET_MAP; i++) + h ^= ls->map[i]; + if (ls->extra) + h ^= ls->extra->num; + return h; +} + +FcLangSet * +FcNameParseLangSet (const FcChar8 *string) +{ + FcChar8 lang[32]; + const FcChar8 *end, *next; + FcLangSet *ls; + + ls = FcLangSetCreate (); + if (!ls) + goto bail0; + + while (string && *string) + { + end = (FcChar8 *) strchr ((char *) string, '|'); + if (!end) + { + end = string + strlen ((char *) string); + next = end; + } + else + next = end + 1; + if (end - string < sizeof (lang) - 1) + { + strncpy ((char *) lang, (char *) string, end - string); + lang[end-string] = '\0'; + if (!FcLangSetAdd (ls, lang)) + goto bail1; + } + string = next; + } + return ls; +bail1: + FcLangSetDestroy (ls); +bail0: + return 0; +} + +FcBool +FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls) +{ + int i, bit; + FcChar32 bits; + FcBool first = FcTrue; + + for (i = 0; i < NUM_LANG_SET_MAP; i++) + { + if ((bits = ls->map[i])) + { + for (bit = 0; bit <= 31; bit++) + if (bits & (1 << bit)) + { + int id = (i << 5) | bit; + if (!first) + if (!FcStrBufChar (buf, '|')) + return FcFalse; + if (!FcStrBufString (buf, fcLangCharSets[id].lang)) + return FcFalse; + first = FcFalse; + } + } + } + if (ls->extra) + { + FcStrList *list = FcStrListCreate (ls->extra); + FcChar8 *extra; + + if (!list) + return FcFalse; + while ((extra = FcStrListNext (list))) + { + if (!first) + if (!FcStrBufChar (buf, '|')) + return FcFalse; + if (!FcStrBufString (buf, extra)); + return FcFalse; + first = FcFalse; + } + } + return FcTrue; +} + +FcBool +FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb) +{ + int i; + + for (i = 0; i < NUM_LANG_SET_MAP; i++) + { + if (lsa->map[i] != lsb->map[i]) + return FcFalse; + } + if (!lsa->extra && !lsb->extra) + return FcTrue; + if (lsa->extra && lsb->extra) + return FcStrSetEqual (lsa->extra, lsb->extra); + return FcFalse; +} diff --git a/src/fclist.c b/src/fclist.c index 0ba7b04..3a48e0f 100644 --- a/src/fclist.c +++ b/src/fclist.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.8 2002/08/11 18:10:42 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.9 2002/08/19 19:32:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -247,6 +247,8 @@ FcListValueHash (FcValue v) return FcCharSetCount (v.u.c); case FcTypeFTFace: return (FcChar32) v.u.f; + case FcTypeLangSet: + return FcLangSetHash (v.u.l); } return 0; } diff --git a/src/fcmatch.c b/src/fcmatch.c index 3853cb7..20c0861 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.17 2002/08/11 18:10:42 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.18 2002/08/19 19:32:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -61,9 +61,34 @@ FcCompareLang (char *object, FcValue value1, FcValue value2) { FcLangResult result; - if (value2.type != FcTypeString || value1.type != FcTypeString) + switch (value1.type) { + case FcTypeLangSet: + switch (value2.type) { + case FcTypeLangSet: + result = FcLangSetCompare (value1.u.l, value2.u.l); + break; + case FcTypeString: + result = FcLangSetHasLang (value1.u.l, value2.u.s); + break; + default: + return -1.0; + } + break; + case FcTypeString: + switch (value2.type) { + case FcTypeLangSet: + result = FcLangSetHasLang (value2.u.l, value1.u.s); + break; + case FcTypeString: + result = FcLangCompare (value1.u.s, value2.u.s); + break; + default: + return -1.0; + } + break; + default: return -1.0; - result = FcLangCompare (value1.u.s, value2.u.s); + } switch (result) { case FcLangEqual: return 0; diff --git a/src/fcname.c b/src/fcname.c index 29e1c92..e0ab9ff 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.11 2002/08/11 18:10:42 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.12 2002/08/19 19:32:05 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -59,7 +59,7 @@ static const FcObjectType _FcBaseObjectTypes[] = { { FC_CHAR_HEIGHT, FcTypeInteger }, { FC_MATRIX, FcTypeMatrix }, { FC_CHARSET, FcTypeCharSet }, - { FC_LANG, FcTypeString }, + { FC_LANG, FcTypeLangSet }, }; #define NUM_OBJECT_TYPES (sizeof _FcBaseObjectTypes / sizeof _FcBaseObjectTypes[0]) @@ -300,6 +300,9 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m) case FcTypeCharSet: v.u.c = FcNameParseCharSet (string); break; + case FcTypeLangSet: + v.u.l = FcNameParseLangSet (string); + break; default: break; } @@ -393,12 +396,28 @@ FcNameParse (const FcChar8 *name) v = FcNameConvert (t->type, save, &m); if (!FcPatternAdd (pat, t->object, v, FcTrue)) { - if (v.type == FcTypeCharSet) + switch (v.type) { + case FcTypeCharSet: FcCharSetDestroy ((FcCharSet *) v.u.c); + break; + case FcTypeLangSet: + FcLangSetDestroy ((FcLangSet *) v.u.l); + break; + default: + break; + } goto bail2; } - if (v.type == FcTypeCharSet) + switch (v.type) { + case FcTypeCharSet: FcCharSetDestroy ((FcCharSet *) v.u.c); + break; + case FcTypeLangSet: + FcLangSetDestroy ((FcLangSet *) v.u.l); + break; + default: + break; + } } if (delim != ',') break; @@ -470,6 +489,8 @@ FcNameUnparseValue (FcStrBuf *buf, return FcNameUnparseString (buf, temp, 0); case FcTypeCharSet: return FcNameUnparseCharSet (buf, v.u.c); + case FcTypeLangSet: + return FcNameUnparseLangSet (buf, v.u.l); case FcTypeFTFace: return FcTrue; } diff --git a/src/fcpat.c b/src/fcpat.c index bf527a4..9c99170 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -24,6 +24,7 @@ #include #include +#include #include "fcint.h" FcPattern * @@ -55,6 +56,9 @@ FcValueDestroy (FcValue v) case FcTypeCharSet: FcCharSetDestroy ((FcCharSet *) v.u.c); break; + case FcTypeLangSet: + FcLangSetDestroy ((FcLangSet *) v.u.l); + break; default: break; } @@ -79,6 +83,11 @@ FcValueSave (FcValue v) if (!v.u.c) v.type = FcTypeVoid; break; + case FcTypeLangSet: + v.u.l = FcLangSetCopy (v.u.l); + if (!v.u.l) + v.type = FcTypeVoid; + break; default: break; } @@ -101,6 +110,9 @@ FcValueListDestroy (FcValueList *l) case FcTypeCharSet: FcCharSetDestroy ((FcCharSet *) l->value.u.c); break; + case FcTypeLangSet: + FcLangSetDestroy ((FcLangSet *) l->value.u.l); + break; default: break; } @@ -145,6 +157,8 @@ FcValueEqual (FcValue va, FcValue vb) return FcCharSetEqual (va.u.c, vb.u.c); case FcTypeFTFace: return va.u.f == vb.u.f; + case FcTypeLangSet: + return FcLangSetEqual (va.u.l, vb.u.l); } return FcFalse; } @@ -195,6 +209,8 @@ FcValueHash (FcValue v) case FcTypeFTFace: 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 FcFalse; } @@ -202,6 +218,9 @@ FcValueHash (FcValue v) static FcBool FcValueListEqual (FcValueList *la, FcValueList *lb) { + if (la == lb) + return FcTrue; + while (la && lb) { if (!FcValueEqual (la->value, lb->value)) @@ -232,7 +251,7 @@ FcPatternDestroy (FcPattern *p) { int i; - if (--p->ref > 0) + if (p->ref == FC_REF_CONSTANT || --p->ref > 0) return; for (i = 0; i < p->num; i++) @@ -250,6 +269,252 @@ FcPatternDestroy (FcPattern *p) free (p); } +#define FC_VALUE_LIST_HASH_SIZE 257 +#define FC_PATTERN_HASH_SIZE 67 + +typedef struct _FcValueListEnt FcValueListEnt; + +struct _FcValueListEnt { + FcValueListEnt *next; + FcChar32 hash; + FcValueList *list; +}; + +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) +{ + FcValueListEnt *e; + FcValueList *l, *new; + int n; + int string_size = 0; + FcChar8 *strs; + int size; + + n = 0; + for (l = h; l; l = l->next) + { + if (l->value.type == FcTypeString) + string_size += strlen ((char *) l->value.u.s) + 1; + n++; + } + size = sizeof (FcValueListEnt) + n * sizeof (FcValueList) + string_size; + FcValueListFrozenCount[h->value.type]++; + FcValueListFrozenBytes[h->value.type] += size; + e = malloc (size); + if (!e) + return 0; + FcMemAlloc (FC_MEM_VALLIST, size); + e->list = (FcValueList *) (e + 1); + strs = (FcChar8 *) (e->list + n); + new = e->list; + for (l = h; l; l = l->next) + { + if (l->value.type == FcTypeString) + { + new->value.type = FcTypeString; + new->value.u.s = strs; + strcpy ((char *) strs, (char *) l->value.u.s); + strs += strlen ((char *) strs) + 1; + } + else + new->value = FcValueSave (l->value); + new->binding = l->binding; + if (l->next) + new->next = new + 1; + else + new->next = 0; + } + return e; +} + +static int FcValueListTotal; +static int FcValueListUsed; + +static FcValueList * +FcValueListFreeze (FcValueList *l) +{ + static FcValueListEnt *hashTable[FC_VALUE_LIST_HASH_SIZE]; + FcChar32 hash = FcValueListHash (l); + FcValueListEnt **bucket = &hashTable[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 FcChar32 +FcPatternBaseHash (FcPattern *b) +{ + FcChar32 hash = b->num; + int i; + + for (i = 0; i < b->num; i++) + hash = ((hash << 1) | (hash >> 31)) ^ ((FcChar32) 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 FcPattern * +FcPatternBaseFreeze (FcPattern *b) +{ + static FcPatternEnt *hashTable[FC_VALUE_LIST_HASH_SIZE]; + FcChar32 hash = FcPatternBaseHash (b); + FcPatternEnt **bucket = &hashTable[hash % FC_VALUE_LIST_HASH_SIZE]; + FcPatternEnt *ent; + int i; + char *objects; + int size_objects; + 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 (strcmp (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 + object names + */ + size_objects = 0; + for (i = 0; i < b->num; i++) + size_objects += strlen (b->elts[i].object) + 1; + + size = sizeof (FcPatternEnt) + b->num*sizeof (FcPatternElt) + size_objects; + 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; + + objects = (char *) (ent->pattern.elts + b->num); + for (i = 0; i < b->num; i++) + { + ent->pattern.elts[i].values = b->elts[i].values; + strcpy (objects, b->elts[i].object); + ent->pattern.elts[i].object = objects; + objects += strlen (objects) + 1; + } + + ent->hash = hash; + ent->next = *bucket; + *bucket = ent; + return &ent->pattern; +} + +FcPattern * +FcPatternFreeze (FcPattern *p) +{ + FcPattern *b, *n = 0; + int size; + int i; + + size = sizeof (FcPattern) + p->num * sizeof (FcPatternElt); + b = (FcPattern *) malloc (size); + if (!b) + return 0; + 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) { @@ -404,6 +669,9 @@ FcPatternAddWithBinding (FcPattern *p, FcPatternElt *e; FcValueList *new, **prev; + if (p->ref == FC_REF_CONSTANT) + goto bail0; + new = (FcValueList *) malloc (sizeof (FcValueList)); if (!new) goto bail0; @@ -446,6 +714,9 @@ bail2: case FcTypeCharSet: FcCharSetDestroy ((FcCharSet *) value.u.c); break; + case FcTypeLangSet: + FcLangSetDestroy ((FcLangSet *) value.u.l); + break; default: break; } @@ -563,6 +834,16 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f) return FcPatternAdd (p, object, v, FcTrue); } +FcBool +FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls) +{ + FcValue v; + + v.type = FcTypeLangSet; + v.u.l = (FcLangSet *) ls; + return FcPatternAdd (p, object, v, FcTrue); +} + FcResult FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v) { @@ -704,6 +985,21 @@ FcPatternGetFTFace (FcPattern *p, const char *object, int id, FT_Face *f) return FcResultMatch; } +FcResult +FcPatternGetLangSet (FcPattern *p, const char *object, int id, FcLangSet **ls) +{ + FcValue v; + FcResult r; + + r = FcPatternGet (p, object, id, &v); + if (r != FcResultMatch) + return r; + if (v.type != FcTypeLangSet) + return FcResultTypeMismatch; + *ls = (FcLangSet *) v.u.l; + return FcResultMatch; +} + FcPattern * FcPatternDuplicate (FcPattern *orig) { @@ -733,7 +1029,8 @@ bail0: void FcPatternReference (FcPattern *p) { - p->ref++; + if (p->ref != FC_REF_CONSTANT) + p->ref++; } FcPattern * diff --git a/src/fcstr.c b/src/fcstr.c index a62cb7b..940bf49 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/src/fcstr.c,v 1.6 2002/07/06 23:47:44 keithp Exp $ + * $XFree86: xc/lib/fontconfig/src/fcstr.c,v 1.7 2002/07/13 05:43:25 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -526,6 +526,18 @@ FcStrSetMember (FcStrSet *set, const FcChar8 *s) return FcFalse; } +FcBool +FcStrSetEqual (FcStrSet *sa, FcStrSet *sb) +{ + int i; + if (sa->num != sb->num) + return FcFalse; + for (i = 0; i < sa->num; i++) + if (!FcStrSetMember (sb, sa->strs[i])) + return FcFalse; + return FcTrue; +} + FcBool FcStrSetAdd (FcStrSet *set, const FcChar8 *s) {