Pango probably is "the right way to do it;" an alternative is to use
Cairo's "toy text API," described here:

http://www.cairographics.org/manual/cairo-Text.html

This has a pretty straightforward approach, e.g.:

...
cairo_select_font_face(cr, "Trebuchet MS", 
    CAIRO_FONT_WEIGHT_BOLD, CAIRO_FONT_SLANT_OBLIQUE);
cairo_set_font_size(cr, 24);
cairo_show_text(cr, "example"); 
...

One can create a Cairo context from a GdkDrawable using
gdk_cairo_create().

Of course, if you're really planning on doing a lot of text
manipulation, using Pango may be better.  (Never really played with it
personally.)

-Andrew

On Tue, 2005-12-13 at 16:20 +0100, Bernd Muent wrote:
> Hi together,
> I (only) want to draw a red text "Example" or whatever in the middle of 
> a GtkDrawable.
> First I looked at gdk_draw_text.
> I did not find out how to draw a text in a specific color.
> And the other problem is that the documentation says that it is deprecated.
> I should use Pango rendering.
> But I got lost somewhere between PangoFontDefintions etc. etc. and did 
> not find an example with google.
> Who can explain me how to use Pango or whatever for my purpose?
> 
> Thanks für tips, Bernd
> 
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to