Re: Use Pango Layouts with GooCanvas Text
- From: Damon Chaplin <damon karuna eclipse co uk>
- To: Aditya Rajgarhia <adityar7 gmail com>
- Cc: goocanvas-list gnome org
- Subject: Re: Use Pango Layouts with GooCanvas Text
- Date: Sat, 22 Aug 2009 10:30:09 +0100
On Fri, 2009-08-21 at 16:35 -0700, Aditya Rajgarhia wrote:
> 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.
GooCanvasText can ellipsize multiple lines, if you separate them with
newline characters.
If you really need your own code for custom ellipsization I think you'll
have to create your own canvas item.
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]