G
gaizin
Using Ruby 1.8.3 with libxosd2-ruby 0.4 (also tried ruby-xosd 1.1.0), I
run into trouble with the following simple program:
----------------------------
#!/usr/bin/env ruby
$KCODE="UTF8"
require "xosd"
text = "何ã "
osd = Xosd.new(3)
osd.timeout=5
osd.font = "-sazanami" # or any other Japanese-capable font
osd.align = "center"
osd.valign = "middle"
osd.display("what", 0)
osd.display(text, 1)
osd.display("what", 2)
osd.wait
----------------------------
The code should, using the XOSD library, display three lines in the
middle of the screen, with the first and third displaying "what" and
the second displaying "何ã " (nan da). When the code is run through
irb or the ruby debugger ('ruby -r debug'), it works as expected.
However, when run normally (either with just 'ruby' or as a standalone
script), only the English "what" lines appear.
After experimenting with debug.rb, I found that first making a call to
readline, as show below, solves the problem:
require 'readline'
input = Readline::readline()
.... however, this is of course not really acceptable/practical, as it
causes the program to wait for an initial input.
Does anyone have any idea what the problem might be? What is readline
doing that is fixing the problem?
- Lance F.
run into trouble with the following simple program:
----------------------------
#!/usr/bin/env ruby
$KCODE="UTF8"
require "xosd"
text = "何ã "
osd = Xosd.new(3)
osd.timeout=5
osd.font = "-sazanami" # or any other Japanese-capable font
osd.align = "center"
osd.valign = "middle"
osd.display("what", 0)
osd.display(text, 1)
osd.display("what", 2)
osd.wait
----------------------------
The code should, using the XOSD library, display three lines in the
middle of the screen, with the first and third displaying "what" and
the second displaying "何ã " (nan da). When the code is run through
irb or the ruby debugger ('ruby -r debug'), it works as expected.
However, when run normally (either with just 'ruby' or as a standalone
script), only the English "what" lines appear.
After experimenting with debug.rb, I found that first making a call to
readline, as show below, solves the problem:
require 'readline'
input = Readline::readline()
.... however, this is of course not really acceptable/practical, as it
causes the program to wait for an initial input.
Does anyone have any idea what the problem might be? What is readline
doing that is fixing the problem?
- Lance F.