Hi, Conrad Schneiker wrote: > 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. Noting that ext/tk/lib/tkfont.rb referenced $DEBUG in several places, I also tried running widget with $DEBUG = 1 and got "Exception `RuntimeError' at ./tkencoding.rb:27" several times. Is this typical behavior or is this a serious problem (possibly indirectly caused by the changes tat I made to widget)?: # ./widget wm title . Ruby/Tk Widget Demonstration ==> "default latin font = Helvetica" "default kanji font = mincho" font actual -*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-* ==> -family helvetica -size 14 -weight normal -slant roman -underline 0 -overstrike 0 font create @font0000l -slant roman -size 14 -family helvetica -underline 0 -overstrike 0 -weight normal ==> @font0000l font create @font0000k ==> @font0000k font actual @font0000k ==> -family fixed -size 9 -weight normal -slant roman -underline 0 -overstrike 0 font configure -slant roman -size 9 -family fixed -underline 0 -overstrike 0 -weight normal Exception `RuntimeError' at ./tkencoding.rb:27 font create @font0000c ==> @font0000c font actual @font0000l ==> -family helvetica -size 14 -weight normal -slant roman -underline 0 -overstrike 0 font configure @font0000c -slant roman -size 14 -family helvetica -underline 0 -overstrike 0 -weight normal ==> font actual @font0000k ==> -family fixed -size 9 -weight normal -slant roman -underline 0 -overstrike 0 font configure @font0000c -slant roman -size 9 -family fixed -underline 0 -overstrike 0 -weight normal ==> font configure @font0000c ==> -family fixed -size 9 -weight normal -slant roman -underline 0 -overstrike 0 frame .w0001 ==> .w0001 menubutton .w0001.w0002 ==> .w0001.w0002 .w0001.w0002 configure -text File ==> .w0001.w0002 configure -underline 0 ==> <rest of long output snipped.> -- Conrad Schneiker (This note is unofficial and subject to improvement without notice.)