Re: PangoLayout



On Sat, 2004-03-06 at 10:29, Chris Hoefler wrote:
Ok, Pango is driving me crazy. I am trying to set attributes on a
PangoLayout, but I can't seem to get it to work. Here is the code:

layout = gtk_widget_create_pango_layout (widget, NULL);
text_size = pango_attr_size_new (100);

attr_size() is in points / PANGO_SCALE, so you are asking for
an approximately 0.1 point font.

text_weight = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
layout_attr = pango_attr_list_new ();
pango_attr_list_insert (layout_attr, text_size);
pango_attr_list_insert (layout_attr, text_weight);
pango_layout_set_attributes(layout, layout_attr);

The default range for a newly created attribute is 0-0. So you
need:

 text_size->start_index = 0;
 text_size->end_index = G_MAXUINT;

and the same for the weight. (pango_layout_set_font_description()
is probably considerably easier if you want to affect the
entire layout. You can use partial font descriptions like 
"Bold 10")

Regards,
                                                Owen





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