Re: [gtkmm] Drawing a string to a drawable.



Am 2002.12.06 02:20 schrieb(en) Juan Linietsky:
Hello, what is the procedure to draw a string into a Gdk::Drawable?
So far what is on the documentation seems to be outdated, because
by checking in the sources the only way to draw "text" are complex
functions that ask me to make a pango glyphstring. I looked
at the pangomm headers but I cant figure out how am I supposed
to create anything usable for the Gtk::Drawable.

What you need is

Gtk::Widget::create_pango_layout(const Glib::ustring& text);

You can pass the returned Pango Layout object into

Gdk::Drawable::draw_layout (const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout);

to render the text.
Gdk::Window inherits Gdk::Drawable so you can get the
Gdk object representing the screen area of the widget
you want to render the text into with

Gtk::Widget::get_window();

Regards,

  Martin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]