Date: Thu, 26 Aug 2004 16:50:52 +0900 (JST) Message-Id: <20040826.165052.74190188.garrigue at kurims.kyoto-u.ac.jp> To: briand at aracnet.com Cc: lablgtk at kaba.or.jp Subject: Re: how to put text in a drawing_area ? From: Jacques GARRIGUE In-Reply-To: <16685.28897.429085.9744 at soggy.deldotd.com> References: <16685.28897.429085.9744 at soggy.deldotd.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: briand at aracnet.com > Seems like a very simple thing and in fact gDraw.mli contains the > following comment : > > > (** Functions for drawing points, lines, arcs, and text > @gtkdoc gdk gdk-Drawing-Primitives *) > > > However there is no text method and I can't seem to trace out a link > to the regular text widgets, nor can I find anything in the examples > directory... You need to use the #put_layout method. But for that you must first create a layout with: let layout = area#misc#pango_context#create_layout in Then you write in the layout, before drawing it: Pango.Layout.set_text layout "my text"; drawable#put_layout layout ~x:10 ~y:10 Hope this helps. Jacques P.S. maybe we could add a simpler utility method...