Ruby entry widget does not display properly

In win2k ruby does not seem to be able to display properly Tk entry widget
entered
in Unicode.
I know already that ruby script written in utf-8 will display without any
difficulties thanks to the command line option rubyw -Ku script.rbw but
when one enters Unicode through the global IME in Japanese for example into
an Tk entry widget one gets an ugly cursor obstructing most of the display
and nothing else except a series of strings ???

When the equivalent is done under Tcl/Tk, the Japanese characters are
displayed
beautifully without any ugly showing up of the cursor!
Any pointer is most welcome since I am new to ruby.
Many thanks
Jean-Pierre Berard

------------- Tcl/Tk script

entry .e -width 40 -font "Times 16 normal"
pack .e

------------- ruby script

require “tk”

TkEntry.new {
insertwidth 40
font 'Times 16 normal’
pack
}

Tk.mainloop

In win2k ruby does not seem to be able to display properly Tk entry widget
entered
in Unicode.
I know already that ruby script written in utf-8 will display without any
difficulties thanks to the command line option rubyw -Ku script.rbw but
when one enters Unicode through the global IME in Japanese for example into
an Tk entry widget one gets an ugly cursor obstructing most of the display
and nothing else except a series of strings ???

When the equivalent is done under Tcl/Tk, the Japanese characters are
displayed
beautifully without any ugly showing up of the cursor!
Any pointer is most welcome since I am new to ruby.

TkEntry.new {
insertwidth 40

This is part of the problem. Instead of ‘insertwidth’, use ‘width’, just
as you would in Tk. The config options almost always have the same names
in Ruby/Tk as in Tcl/Tk … it’s just the syntax that’s different.

font ‘Times 16 normal’

Does your Times font include Japanese characters? I suppose it must,
since it worked with Tcl/Tk. But if you’re not sure, try using a
different font that you know includes Japanese characters.

···

On Fri, Sep 06, 2002 at 07:10:18PM +0900, Jean-Pierre Berard wrote:


Matt Gushee
Englewood, Colorado, USA
mgushee@havenrock.com

Matt Gushee mgushee@havenrock.com wrote in
news:20020906101958.GJ4604@swordfish:

In win2k ruby does not seem to be able to display properly Tk entry
widget entered
in Unicode.
I know already that ruby script written in utf-8 will display without
any difficulties thanks to the command line option rubyw -Ku
script.rbw but when one enters Unicode through the global IME in
Japanese for example into an Tk entry widget one gets an ugly cursor
obstructing most of the display and nothing else except a series of
strings ???

When the equivalent is done under Tcl/Tk, the Japanese characters are
displayed
beautifully without any ugly showing up of the cursor!
Any pointer is most welcome since I am new to ruby.

TkEntry.new {
insertwidth 40

This is part of the problem. Instead of ‘insertwidth’, use ‘width’,
just as you would in Tk. The config options almost always have the
same names in Ruby/Tk as in Tcl/Tk … it’s just the syntax that’s
different.

font ‘Times 16 normal’

Does your Times font include Japanese characters? I suppose it must,
since it worked with Tcl/Tk. But if you’re not sure, try using a
different font that you know includes Japanese characters.

It is reassuring to know that the transcription of tk scripts into ruby
will be just a matter of syntax!
The failing of the Japanese characters to display must to a degree also
be a matter of syntax since ruby can display utf-8 without a further a
do even without invoking the font command.
It is the input, which must need somehow a reset from its default.

The script with the word “Japanese” written in utf-8 displays without
any font support but when one writes in Japanese into the entry widget
one gets only ???

ruby -Ku script.rb

require “tk”

root = TkRoot.new() { title “Packing Example” }
entry = TkEntry.new(root).pack(“side”=>“top”, “fill”=>“x”)

entry.insert(0, “Entry on the top”)

entry.insert(0, “æ-¥æœ¬èªž”)

Tk.mainloop

···

On Fri, Sep 06, 2002 at 07:10:18PM +0900, Jean-Pierre Berard wrote: