Hello all,
  I discovered macruby since a few weeks and I'm really enthusiast.
I begun playing with it and really like the hotcocoa approach, but it seems
stopped since more than a year, is it still maintained ?

Anyway, I think I found a bug in the hotcocoa canvas part: the text method
draws at a very big size regardless of the chosen font. The problem is that
the transformation matrix for the text is not set.

Here is the fix if anyone needs it:

module HotCocoa::Graphics
  class Canvas
    def text(txt="A", x=0, y=0)
      affine = CGContextGetCTM(@ctx)
      CGContextSetTextMatrix (@ctx, affine);
      txt = txt.to_s unless txt.kind_of?(String)
      if @registration == :center
        width = textwidth(txt)
        x = x - width / 2
        y = y + @fsize / 2
      end
      CGContextShowTextAtPoint(@ctx, x, y, txt, txt.length)
    end
  end
end
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to