PangoLayout
- From: Chris Hoefler <hoeflerb brandeis edu>
- To: gtk-app-devel-list gnome org
- Subject: PangoLayout
- Date: Sat, 06 Mar 2004 10:29:12 -0500
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:
PangoLayout *layout;
PangoRectangle logical_rect;
PangoAttrList *layout_attr;
PangoAttribute *text_size, *text_weight;
gchar label_str[100];
<snip>
layout = gtk_widget_create_pango_layout (widget, NULL);
text_size = pango_attr_size_new (100);
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);
<snip>
g_snprintf (label_str, sizeof (label_str), "%.*f", AXIS_PRECISION,
major_tick_num);
pango_layout_set_text (layout, label_str, -1);
pango_layout_get_extents (layout, NULL, &logical_rect);
gtk_paint_layout (widget->style, widget->window, GTK_STATE_NORMAL,
FALSE, NULL, widget, "tick_label",
major_tick_x_pos - PANGO_PIXELS (logical_rect.width / 2),
ysrc + axis_height, layout);
I am trying to draw some text onto a new widget I am creating. When I
run this code, the correct number is drawn, but without the attributes
(bold, small font). If I move the pango_layout_set_attributes after the
pango_layout_set_text, that has no effect. Neither does applying a
property like pango_layout_set_indent. Is there some layout refresh
command I am missing here?
-Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]