Hi,

Hidetoshi NAGAI wrote:

> Conrad Schneiker <schneik / austin.ibm.com> writes:
> > One curious thing that I noticed is that the individual widget demos run
> > by the Ruby/Tk widget program start up noticeably slower on the AIX
> > machine than on the NT machine, even though the AIX machine is much
> > faster. Moreover, Ruby/Tk doesn't seem to be using more than a small
> > fraction of the available CPU time of the AIX machine. Any idea of what
> > it might be doing?
>
> I think that the problem is based on 'font search'.
> You wrote
>
> > I've got the Ruby/Tk widget demo partly converted from Kanji to English.
>
> So, probably some texts to display are Japanese, aren't it?

I guess they try to. I tried installing Japanese fonts, but never got them to
display. (Maybe I should have changed the setting of LANG.) So what I did next
was to remove all references to Japanese fonts and variables referencing them.
Then I would get displays with text with lots of mostly strange symbol
characters that look like "line noise", possibly due to extended characters
now being interpreted as single byte characters.

> Many of(?) TrueType fonts on Windows have both of Japanese and English
> Glyph. But on X, Font files are separated by encoding. If you configure
> the font to 'Helvetica', Tk will search Japanese 'Helvetica' font to
> display Japanese text, and if you configure the font to 'Mincho', Tk
> will search English 'Mincho' font to display English text. But most of
> X environment will have no Japanese 'Helvetica' font or no English
> 'Mincho' font. Therefore, Tk must search another font instead of the
> right font, and it will need long time.

This might explain what is going on, except that I have already removed
references to Japanese fonts. What I've now noticed is that all of the widget
demos that I have since converted to standard English/ASCII character strings
now start reasonably quickly, and that only the unconverted widget demos are
now very slow starting up. So this problem will hopefully be gone by the end
of the week, when I hope to finish up.

However, even on the converted widget demos, it seems that Ruby/Tk is not
finding any of the specified fonts (for example,
'-*-Helvetica-Bold-R-Normal--*-180-*-*-*-*-*-*') and is apparently using some
default system font, yet the Tcl/Tk widget demo (running on the same system)
seems to be able to find them all without any problem. This may result is a
slow search process, such as what you mentioned above. I see this particular
problem on both AIX and NT. What is interesting is that places where default
fonts are used (i.e. such as on buttons and menus where they are not being
specified by the demo program), Ruby/Tk is finding and using the same sort of
fonts that Tck/Tk is.

--
Conrad Schneiker
(This note is unofficial and subject to improvement without notice.)