Text rendering with pango and gtkpixbuf
- From: Gonzalo Aguilar Delgado <gad aguilardelgado com>
- To: GTK desarrollo <gtk-app-devel-list gnome org>
- Subject: Text rendering with pango and gtkpixbuf
- Date: Sat, 14 Feb 2004 14:32:09 +0100
Hello all.
I've a widget derived from evolution e-map. I want to render text labels
on that widget. The maps are png files loaded with GtkPixbuf...
How can I render text into that maps?
What is better: To draw to the widget drawable or directly over
gdkpixbuf buffer?
I'm trying to get pango colors on my display but always is black...
This is the code:
------------------------------- Cut Here -----------------------
/* Pango Rendering */
PangoFontDescription *pfontdesc;
PangoLayout *playout;
GdkGC *Gc;
GdkColor fore = { 0, 255, 255, 0x00 };
PangoAttrList *pattrlist;
PangoAttribute *patcolor;
/* Test pango drawing */
playout = gtk_widget_create_pango_layout(GTK_WIDGET (map),"Test");
pfontdesc = pango_font_description_from_string ("Sans bold 11");
pango_layout_set_font_description (playout, pfontdesc);
patcolor = pango_attr_foreground_new(255,0,0);
pattrlist = pango_layout_get_attributes(playout);
if(pattrlist) {
pango_attr_list_insert(pattrlist,patcolor);
}else{
pattrlist=pango_attr_list_new();
pango_attr_list_insert(pattrlist,patcolor);
}
pango_layout_set_attributes(playout,pattrlist);
Gc = gdk_gc_new(GTK_WIDGET (map)->window);
/* I use this because without colors does not work, nor with this... */
gdk_draw_layout_with_colors(GTK_WIDGET(map)->window,Gc,(gint)winx,(gint)winy,
playout,&fore,NULL);
gdk_gc_unref(Gc);
-------------------------- Cut Here ---------------------------------
But nothing works... What I'm doing wrong?
Why can I set colors with the graphics context and with the pango
library?. What is the difference?
What are Graphics Contexts for?
Should I get it at init time and save for future references or should I
get a new gc each time?
Thank you in advance.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]