[EMAIL PROTECTED] wrote:

> 
> 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"

No such thing aas 'bool' in C. Use int. Don't forget the semi colon at the 
end. Don't forget to actually give this thing some memory somewhere ;-) See 
below.

> 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 ?" 

It makes sense.

> If yes, then how can I implement this
> strategy ?  I cannot even make "if(use_fontset)" correctly recognized
> (Poor me!) Can you help ?

Perhaps define a new option recognised by fl_initialize. Eg --use-fontset. 
Thereafter in flresource.c:

/* Define a new, globally accessible variable to toggle the use of
 * XmbDrawString over XdrwString when using multi-byte, CJK input.
 * By default, this is turned off.
 */
int use_fontsel = 0;

fl_initialize(int *na, char *arg[], const char *appclass,
              XrmOptionDescList appopt, int nappopt)
{
        /* Add code to test whether to use fontsel stuff. */
}

and anywhere else in the xforms code:
extern int use_fontsel;

-- 
Angus

Reply via email to