Drawing Text

Text is drawn via Pango Layouts. The easiest way to create a Pango::Layout is to use create_pango_layout. Once created, the layout can be manipulated in various ways, including changing the text, font, etc. Finally, the layout can be rendered using the draw_layout method of Gdk::Drawable, which takes the usual Gdk::GC, an x-position, a y-position and the layout itself.

Example

Here's a sample program using all of the drawing methods shown so far:

Figure 14.2. Drawing Area - Text

Drawing Area - Text

Source Code

The structure of the program is the same as the first one, except that this one includes examples of the drawing elements discussed up to now.