Re: PangoLayout



On Saturday 06 March 2004 15: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:
 (snip)

I don't know why your code doesn't work [*], but here's an alternative way of 
doing what you want:

  PangoLayout *layout;
  gchar label_str[100];

  layout = gtk_widget_create_pango_layout (widget, NULL);

  g_snprintf (label_str, sizeof (label_str),
                       "<span scale=<span size='x-small'><b>%.*f</b></span>",
                       AXIS_PRECISION, major_tick_num);

  pango_layout_set_markup(layout, label_str);
  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);

Maybe that works.

Cheers
 -Tim

[*] maybe pango just ignores your attributes once it comes across the font 
size of 0.1pt?





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