summaryrefslogtreecommitdiff
path: root/src/fclang.c
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2005-11-04 19:31:26 +0000
committerPatrick Lam <plam@MIT.EDU>2005-11-04 19:31:26 +0000
commit82f35f8bb4fe58ebc839531f4a63544dc07f0f5d (patch)
tree0bf6808a2f2efd81151efd0eedd34d58d759afb3 /src/fclang.c
parent50544b13c19c6a4a9fe9cf26cdd2170ddacf86d1 (diff)
Fix bug 2878 (excessive relocations at startup for charsets, reported by
Ross Burton): fc-lang/fc-lang now creates the static form of the langset, not the dynamic form, so that the charsets should now be in .rodata.
Diffstat (limited to 'src/fclang.c')
-rw-r--r--src/fclang.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/fclang.c b/src/fclang.c
index a10641e..b1c7c3f 100644
--- a/src/fclang.c
+++ b/src/fclang.c
@@ -44,6 +44,8 @@ struct _FcLangSet {
#define FcLangSetBitSet(ls, id) ((ls)->map[(id)>>5] |= ((FcChar32) 1 << ((id) & 0x1f)))
#define FcLangSetBitGet(ls, id) (((ls)->map[(id)>>5] >> ((id) & 0x1f)) & 1)
+static FcBool langsets_populated = FcFalse;
+
FcLangSet *
FcFreeTypeLangSet (const FcCharSet *charset,
const FcChar8 *exclusiveLang)
@@ -52,7 +54,12 @@ FcFreeTypeLangSet (const FcCharSet *charset,
FcChar32 missing;
const FcCharSet *exclusiveCharset = 0;
FcLangSet *ls;
-
+
+ if (!langsets_populated)
+ {
+ FcLangCharSetPopulate ();
+ langsets_populated = FcTrue;
+ }
if (exclusiveLang)
exclusiveCharset = FcCharSetForLang (exclusiveLang);
@@ -188,6 +195,13 @@ FcCharSetForLang (const FcChar8 *lang)
{
int i;
int country = -1;
+
+ if (!langsets_populated)
+ {
+ FcLangCharSetPopulate ();
+ langsets_populated = FcTrue;
+ }
+
for (i = 0; i < NUM_LANG_CHAR_SET; i++)
{
switch (FcLangCompare (lang, fcLangCharSets[i].lang)) {