ScreenDC doesn't draw text

Hi,

I’m doing some experiments with the ScreenDC class for on-screen
drawing. Drawing shapes like a circle or rectangle works fine, but when
I try to draw text onto the screen, nothing happens. I’m using the
wxruby-ruby19 gem with ruby 1.9.1p243 (2009-07-16 revision 24175)
[i686-linux] on an Ubuntu Karmic machine.

My code looks like this (I know, it doesn’t make much sense, but it’s
only to demonstrate the problem):

#!/usr/bin/env ruby
#Encoding: UTF-8
require “wx”

class TestApp < Wx::App
include Wx

def on_init

Timer.every(1000) do
  sc = ScreenDC.new
  sc.font = NORMAL_FONT #To ensure there's a font to draw with
  sc.draw_rectangle(0, 0, 100, 100) #This gets drawn...
  sc.draw_text("Test", 0, 150) #...but this doesn't
end

end

end

x = TestApp.new
x.main_loop

The rectangle is drawn without problems, but I can’t find the text
anywhere on my screen.

Is this a bug?

Marvin

Marvin Gülker wrote:

The rectangle is drawn without problems, but I can’t find the text
anywhere on my screen.

Is this a bug?

Marvin

Nobody experiencing the same problem? However, I’ve filed that as a bug
now:
http://rubyforge.org/tracker/index.php?func=detail&aid=27564&group_id=35&atid=218

Marvin

Hi Marvin

Marvin Gülker wrote:

I’m doing some experiments with the ScreenDC class for on-screen
drawing. Drawing shapes like a circle or rectangle works fine, but when
I try to draw text onto the screen, nothing happens. I’m using the
wxruby-ruby19 gem with ruby 1.9.1p243 (2009-07-16 revision 24175)
[i686-linux] on an Ubuntu Karmic machine.

My code looks like this

  sc.draw_text("Test", 0, 150) #...but this doesn't

I got round to trying your sample, running it with a debug build on Mac.
The line above is causing an assertion in Wx to fail, and then a crash.
The message I get is rather cryptic,:

Assertion failed: ((min.y == p[0].y && max.y == p[order].y) || (min.y ==
p[order].y && max.y == p[0].y)), function crossing_count, file
Paths/path-crossing.c, line 176.
Abort trap

But I’m not sure if this is because ScreenDC doesn’t work properly on
Mac, or if there’s something else wrong with the usage. I’ve never tried
drawing directly on the screen.

sorry i can’t be more hlepful
alex