[Fontconfig] fontconfig: Branch 'master'

Keith Packard keithp at kemper.freedesktop.org
Sat Sep 9 10:06:02 PDT 2006


 src/fcdefault.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)

New commits:
diff-tree 5d2f7a9d9224d4df1655cd1d6fd72646734b0272 (from f6cfbe16bfc252b46532f699b496e4a41a1a1c22)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Sat Sep 9 10:04:42 2006 -0700

    Accept locale environment variables that do not contain territory.
    
    Locale environment variables (LC_ALL, LC_CTYPE, LANG) must contain language,
    and may contain territory and encoding. Don't accidentally require territory
    as that will cause fontconfig to fall back to 'en'.

diff --git a/src/fcdefault.c b/src/fcdefault.c
index ddf4237..4e5823b 100644
--- a/src/fcdefault.c
+++ b/src/fcdefault.c
@@ -91,6 +91,22 @@ FcGetDefaultLang (void)
 		lang_local[lang_len + 1 + territory_len] = '\0';
 	    }
 	}
+	else
+	{
+	    after = strchr (ctype, '.');
+	    if (!after)
+	    {
+		after = strchr (ctype, '@');
+		if (!after)
+		    after = ctype + strlen (ctype);
+	    }
+	    lang_len = after - ctype;
+	    if (lang_len + 1 <= (int) sizeof (lang_local))
+	    {
+		strncpy (lang_local, ctype, lang_len);
+		lang_local[lang_len] = '\0';
+	    }
+	}
     }
 
     /* set default lang to en */


More information about the Fontconfig mailing list