Re: gdtk_draw_text deprecated , what use instead of it ?



Tom Liu wrote:
But, for your problem,
You don't need to create 32 layout, you just need 1 layout and draw.

PangoLayout     *pl;
pl = gtk_widget_create_pango_layout(w, NULL);
for (i=0;i<8;i++) {
        sprintf(s, "%c", i+'A');
        pango_layout_set_text(pl, s, -1);
        gdk_draw_layout(w->window, w->style->black_gc, i*20,0, pl);
}
g_object_unref(pl);

Yeah, sometimes one misses an obvious solution :o

For my program it shouldn't be anywhere time-critical (unless it slows
board drawing down enough for it to be noticeable while resizing), but
still i want to note: while the above is simple and clean it wastes
some system resources (especially if the labels are dynamic), while
gives absolutely no advantages over gdk_draw_text() (because labels are
guaranteed to be in ascii and short).

I would like to see any comments from GTK+ developers on if there's any
hope of seeing gdk_draw_text() to be resurrected.

Olexiy Avramchenko wrote:
If you dont need pango - use raw X lib functions. gdk_draw_text() has no 
significant advantages over XDraw[Image]String[16].

It has that significant advantage of hiding X System.  I don't want any
X code to leak into my program unless absolutely needed.  That's bad for
your health, err..., compatibility ;)

Paul Pogonyshev



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