Use Pango Layouts with GooCanvas Text



Hi,

I am a beginner with GTK and am porting a project from Gnome Canvas to GooCanvas (using the C++ APIs). I have mostly finished it, but there are a few things I can't figure out. One of them is how to ellipsize Text while using multiple lines.

In the existing code. the Gnome Canvas code creates a Pango layout from the Gnome Canvas Text like this:

   Glib::RefPtr<Pango::Layout> layout =
      Glib::wrap(GNOME_CANVAS_TEXT(text->gobj())->layout, TRUE);

and then calls a utility function which ellipsizes the text in a particular way:

   text->property_text() = Ellipsize(string, layout, width, lines);

The Ellipsize function then splits the string into multiple lines using Pango::LayoutLine, ellipsizes it and returns the text.

How can a achieve a similar functionality with GooCanvas? I tried replacing GNOME_CANVAS_TEXT in the above code with GOO_CANVAS_TEXT but that is not valid. Of course, GooCanvas::Text does have a property_ellipsize() but I want multiple lines, preferably while using the same mechanism (the Pango stuff) that the existing code uses.

Any help would be great!

Thanks,

Aditya


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