Keith Packard
2005-Nov-21 08:51 UTC
[Fontconfig] patch: fallback to POSIX if LC_CTYPE is the empty string "".
On Tue, 2005-08-16 at 18:02 +0200, Mike FABIAN wrote:> A SuSE user recently reported a bug that icewm didn''t show any fonts. > > It turned out to be user error, he had set LANG="" (and no > other locale specific environment variables).> Although setting LC_CTYPE="" is not a valid setting in my opinion, I > think fontconfig should fall back to matching an English font in that > case, just as it does for all the other invalid settings of LC_CTYPE.It should probably treat an empty lang as if the lang was not set: Index: fcdefault.c ==================================================================RCS file: /cvs/fontconfig/fontconfig/src/fcdefault.c,v retrieving revision 1.7 diff -u -p -r1.7 fcdefault.c --- fcdefault.c 7 Dec 2004 01:14:46 -0000 1.7 +++ fcdefault.c 16 Aug 2005 17:06:46 -0000 @@ -111,7 +111,8 @@ FcDefaultSubstitute (FcPattern *pattern) ctype = getenv ("LANG"); } } - if (ctype) + /* ignore missing or empty ctype */ + if (ctype && *ctype != ''\0'') { lang = ctype; territory = strchr (ctype, ''_''); There''s no point setting ctype to ''POSIX''; the only ctypes which have any effect on the library are those in <lang>_<territory> form. -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20050816/a4cb8aa3/attachment.pgp
Mike FABIAN
2005-Nov-21 08:51 UTC
[Fontconfig] Re: patch: fallback to POSIX if LC_CTYPE is the empty string "".
Keith Packard <keithp@keithp.com> ????????:> On Tue, 2005-08-16 at 18:02 +0200, Mike FABIAN wrote:[...]>> Although setting LC_CTYPE="" is not a valid setting in my opinion, I >> think fontconfig should fall back to matching an English font in that >> case, just as it does for all the other invalid settings of LC_CTYPE. > > It should probably treat an empty lang as if the lang was not set: > > Index: fcdefault.c > ==================================================================> RCS file: /cvs/fontconfig/fontconfig/src/fcdefault.c,v > retrieving revision 1.7 > diff -u -p -r1.7 fcdefault.c > --- fcdefault.c 7 Dec 2004 01:14:46 -0000 1.7 > +++ fcdefault.c 16 Aug 2005 17:06:46 -0000 > @@ -111,7 +111,8 @@ FcDefaultSubstitute (FcPattern *pattern) > ctype = getenv ("LANG"); > } > } > - if (ctype) > + /* ignore missing or empty ctype */ > + if (ctype && *ctype != ''\0'') > { > lang = ctype; > territory = strchr (ctype, ''_''); > > There''s no point setting ctype to ''POSIX''; the only ctypes which have > any effect on the library are those in <lang>_<territory> form.Thank you, that works as well. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Mike FABIAN
2005-Nov-21 08:51 UTC
[Fontconfig] patch: fallback to POSIX if LC_CTYPE is the empty string "".
A SuSE user recently reported a bug that icewm didn''t show any fonts. It turned out to be user error, he had set LANG="" (and no other locale specific environment variables). When the effective value of LC_CTYPE is the empty string, fontconfig currently matches apparently random and it may happen that a symbol font or some other font completely unsuitable for displaying even English is matched. This happens only when LC_CTYPE is the empty string, for all other values, even nonsensical ones, fontconfig falls back to English: mfabian@shannon:~$ LC_CTYPE="" fc-match sans SY______.PFB: "Symbol" "Regular" mfabian@shannon:~$ LC_CTYPE="fff" fc-match sans verdana.ttf: "Verdana" "Regular" mfabian@shannon:~$ LC_CTYPE="POSIX" fc-match sans verdana.ttf: "Verdana" "Regular" mfabian@shannon:~$ Although setting LC_CTYPE="" is not a valid setting in my opinion, I think fontconfig should fall back to matching an English font in that case, just as it does for all the other invalid settings of LC_CTYPE. Patch attached. -------------- next part -------------- A non-text attachment was scrubbed... Name: bugzilla-102328.patch Type: text/x-patch Size: 483 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20050816/ede76de9/bugzilla-102328.bin -------------- next part -------------- -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????