RE: gdtk_draw_text deprecated , what use instead of it ?



Agree! Pango is hard to learn, Hope someone can make an easy interface
for us.

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);

this will draw:
A B C D E F G H

-----Original Message-----
From: gtk-app-devel-list-admin gnome org [mailto:gtk-app-devel-list-
admin gnome org] On Behalf Of Reymond Dominique
Sent: Tuesday, December 30, 2003 1:05 PM
To: Paul Pogonyshev
Cc: gtk-app-devel-list gnome org
Subject: Re: gdtk_draw_text deprecated , what use instead of it ?


I approve with you: I don' t know pango, I am not enjoyed  to learn it
and modify all my code for placing text lavel;
the gdk_draw_text is very convenient, light,  and simple to use.

Dominique Reymond
----------------------------------------------------------------
Paul Pogonyshev wrote:

Tom Liu wrote:


You should use pango, read the FAQ came with GTK document,there is
an
example over there.



I once raised this issue but got no answer.  Consider a chess board:

  a b c d e f g h
8              8
7              7
6              6
5              5
4              4
3              3
2              2
1              1
  a b c d e f g h

To draw the labels with Pango one would need 32 layout structures,
unless
i miss something.  Ok, moving further.  I'm writing a program that is
an
interface for the game of go.  Standard go board (goban) is 19x19 and
so
i would have to use 76 Pango layouts, which is simply ridiculous.

I think deprecating gdk_draw_text() was a hastily decision.  I can
see
absolutely no point in creating a layout for drawing a single letter
(or
even two, like "15") at a certain position.  I understand that Pango
provides better support for unicode, can break lines and so on.  But
if
i simply don't need any of its features?

It seems to me it was better to _recommend_ using Pango layouts for
most
purposes, rather than deprecating gdk_draw_text() completely.  You
cannot
say that any characters drawn need to be text.  And Pango layouts are
there to handle exactly text, not single characters.

Performance issues mentioned here are also a good reason to resurrect
gdk_draw_text().

If no one can point me to a nice and simple way of drawing 76+ labels
scattered on a widget using Pango layouts, i think i'll have to use
gdk_draw_text().  And i can't say i like it this way, because i
currently compile my program with *_DISABLE_DEPRECATED flags defined.

Paul Pogonyshev

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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