On Fri, 21 Feb 2003, Angus Leeming wrote:

> Ok, CG. I tried it. xfs uses all my cpu. This is very wrong :-( Can you 
try
> things out with LANG=C or something 'normal'. This thing has to work for   
> the rest of the world too, doesn't it?


Well, I should have expected this kind of disaster sooner. See ? All I can 
do is 'beavering'(I like this word very much!), and I have to do another 
'beavering' to solve this problem.  My suggestion is to make all the 
changes "XDrawString->XmbDrawString" conditional. For example, I define a 
boolean variable, as

"extern bool use_fontset"  

and then define 

"char * loc = setlocale(LC_CTYPE,NULL);

if (!loc || !strcmp(loc,"C") || !strcmp(loc,"POSIX") || 
!XSupportLocale()){

        use_fontset = True;
} else {

        use_fontset = False;
} "

Then, make

"if(use_fontset) {
                  XmbDrawString, XfontSet,...
} else {
        original XDrawString, XFontStruct,...
} "

 
By doing this, machines with non-CJK environment do not have to load the 
XFontSet which cause the slowness problem. Now my question is, "Does this 
strategy work as intended ?"  If yes, then how can I implement this 
strategy ?  I cannot even make "if(use_fontset)" correctly recognized 
(Poor me!) Can you help ?


Regards,



cghan

Reply via email to