[PATCH libX11 2/2] Don't try so hard to find a matching font with the given encoding

Jon TURNEY jon.turney at dronecode.org.uk
Thu Oct 7 10:46:08 PDT 2010


See http://sourceware.org/bugzilla/show_bug.cgi?id=10948

Currently, if the locale is UTF-8, no CJK fonts are installed, and someone
does XCreateFontSet() with a font name of "*", we end up asking the server
to list the (non-existent) fonts 11 times for each CJK encoding, which can
take a while.

A * wildcard can match multiple components in a XLFD name in XListFonts(),
so there's no need to try adding more than one to get a match.

We do try once with a leading '*-' in case the fontname isn't a full
well-formed XLFD name, maybe even that isn't needed?

(See also http://invisible-island.net/xterm/xterm.faq.html#slow_menus)

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 modules/om/generic/omGeneric.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/om/generic/omGeneric.c b/modules/om/generic/omGeneric.c
index c78c0a9..da2a13d 100644
--- a/modules/om/generic/omGeneric.c
+++ b/modules/om/generic/omGeneric.c
@@ -841,7 +841,7 @@ parse_omit_name(
 	return True;
 
     /* This may mot be needed anymore as XListFonts() takes care of this */
-    while (num_fields < 12) {
+    if (num_fields < 12) {
 	if ((last - buf) > (XLFD_MAX_LEN - 2))
 	    return -1;
 	*last = '*';
-- 
1.7.2.3



More information about the xorg-devel mailing list