Re: gdtk_draw_text deprecated , what use instead of it ?



Olexiy Avramchenko wrote:
Paul Pogonyshev wrote:
iain wrote:
On Tue, 2003-12-30 at 23:31 +0000, Paul Pogonyshev wrote:
while
gives absolutely no advantages over gdk_draw_text() (because labels are
guaranteed to be in ascii and short).

Apart from being antialiased and use decent fonts you mean.

Not speaking as a GTK developer I don't think the gdk_draw_text stuff is
coming back.

gdk_draw_text() is not antialiased?  I'm taking my comment back.

But seriously, don't you think layouts are too complicated and overkill
for some problems to make them mandatory?  Maybe there should be a
light-weight gdk_draw_<something-else>() which would be antialiased
and use Pango fonts, but more like gdk_draw_text() in respect of
position parameters?

Looks like you dont know about gdk_draw_layout() function:
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Drawing-Primitives.html#gdk-draw-layout
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Drawing-Primitives.html#gdk-draw-layout-with-colors

Layouts usage in G?K (in the way of just displaying some text with
selected font) is as easy as old scheme. If you dont need extra
functionality that layouts give - dont use it, if you want use it but
dont want to learn some docs and code - use Pango Markup:
http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html

I did know about gdk_draw_layout() i rather did not know about that layout
could be "simple" in that sense it could be just be a string of text.
This is a problem of the references to a large extent, which have mainly
functions prototypes with three-word-comments and not enough descriptions
of the objects themselves.

When performance issues becomes a problem for the specific application
you should consider to use platform-depended low-level text drawing
functions because they're fastest and you have a full control on what is
going on. If you want to have portable and fine-looking application -
you forced to use pango stuff. How, for example, you'll explain the
windows-user what XLFD is (you have to use XLFD for font-handling for
gdk_draw_text) ?

Why would i need to explain anything to user?  Ideally, i'd call

        gdk_draw_<something>(..., x, y, "a");

to draw a letter "a" at point (x, y).  GTK+ is already compiled for a
certain platform, so it would internally call the appropriate platform
function for "the real action".  Regarding performance, it would only
waste time on 1--3 function calls, nothing else.

The point is that i can move font handling out of the drawing loops
and use anything for it, including Pango -- font handling is done much
more rare than drawing and i don't care about its influence on
performance.  On the other hand, i cannot move layouts out of drawing
loops with the current drawing scheme (unless i'm willing to keep
dozens of them with each widget), even if i don't need them at all.

gdk_draw_layout() uses some internal algorithm to handle lines of text,
markup and all other wonders.  gdk_draw_<something>() could have used
a shortcut of that algorithm, assuming only one line, no markup and
providing no other wonders.  That is, it could be gdk_draw_layout()
reduced to pushing font, selected with Pango, onto system-specific
level.

gdk_draw_glyphs() is probably intended to do this, but i don't see any
nice interface of creating a glyph string (apart from doing with a
layout).

Paul



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