[cairo] New ruby cairo binding landed in CVS

MenTaLguY mental at rydia.net
Tue Feb 8 19:35:09 PST 2005


On Tue, 2005-02-08 at 19:41, Ned Konz wrote:
> Because I don't necessarily want to use inline blocks.
> 
> Consider this. At a global scope, I have:
> 
> $textBlock = Proc.new { |cr,font,scale,x,y,text|
>       cr.select_font(font, Cairo::FONT_WEIGHT_NORMAL, 
> Cairo::FONT_SLANT_NORMAL)
>       cr.scale_font(scale)
>       cr.move_to(x, y).text_path(text)
> }
> 
> 
> later...
> 
>     cr.closed_path(cr, 'Sans', 140, 50, 230, 'rcairo', &$textBlock)

Ah.  I think that's pretty uncommon usage.  Most Rubyists would simply
define a method for that, or at least do this:

 cr.closed_path { $textBlock.call(cr, 'Sans', 140, 50, 230, 'rcairo') }

-mental
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050208/7225f98d/attachment.pgp


More information about the cairo mailing list