From 594b1215d65a7a619a2dfe237b8ed5a2e6fa96c8 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Fri, 16 Nov 2007 22:37:20 +0000 Subject: [PATCH] * Update README --- ruby/README | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/ruby/README b/ruby/README index 501987d..ca6df1f 100644 --- a/ruby/README +++ b/ruby/README @@ -2,12 +2,16 @@ This a Ruby binding for libcucul, libcaca will be added later. There is no real documentation but "methods" on any object should help you :) -The only object available for now is Cucul::Canvas (meaning that only -functions that have a cucul_canvas_t* as first argument except -cucul_dither_bitmap are available). +The objects available for now are : + +- Cucul::Canvas (functions that have a cucul_canvas_t* as first argument) + * dither_bitmap is missing as Cucul::Dither is not yet implemented + +- Cucul::Font (functions that have a cucul_font_t* as first argument) + * The constructor can currently only accept the name of a builtin font I tried to follow Ruby spirit meaning that : -- most of the Cucul::Canvas methods return self +- most of the methods return self - the methods set_foo with only an argument are also available as foo= (returning the value instead of self) - the methods originally named get_foo are available only as foo @@ -19,7 +23,7 @@ irb(main):001:0> Cucul.constants => ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK", "MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", "UNDERLINE", "RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY", -"ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas"] +"ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Font"] irb(main):002:0> Cucul::Canvas.methods.sort - Cucul::Canvas.ancestors[1].methods @@ -41,6 +45,14 @@ Cucul::Canvas.ancestors[1].instance_methods "set_frame_name", "set_handle", "set_height", "set_size", "set_width", "stretch_left", "stretch_right", "width", "width="] +irb(main):004:0> Cucul::Font.methods.sort - +Cucul::Font.ancestors[1].methods +=> ["list"] + +irb(main):005:0> Cucul::Font.instance_methods.sort - +Cucul::Font.ancestors[1].instance_methods +=> ["blocks", "height", "width"] + And here are sample uses : $ ruby -rcucul -e 'c=Cucul::Canvas.new(6, 3).fill_box(0,0,2,2,"#"[0]); @@ -62,3 +74,6 @@ with ANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and MS-DOS \\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"], ["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg", "SVG vector image"], ["tga", "TGA image"]] + +$ ruby -rcucul -e 'p Cucul::Font.list' +["Monospace 9", "Monospace Bold 12"]