Re: Font size



On Sat, Apr 10, 2004 at 09:28:03PM +1000, Russell Shaw wrote:
Hi,
This code won't change the size of a gtk_label text:

  PangoAttrList *attr_list;
  PangoAttribute *attr;
  label=gtk_label_new("title");
  attr_list=pango_attr_list_new();
  attr=pango_attr_size_new(20000);
  pango_attr_list_insert(attr_list,attr);
  gtk_label_set_attributes(GTK_LABEL(label),attr_list);

What you've discovered is the underlying programming API thats
used by the <span> markup feature. The reason what you have
doesn't work as you expect is that you didn't set the range
of characters over which the attribute applies.
Its better to use the markup for static things anyway.

You should, however, see if what you want can be accomplished
by simply applying to the modifier style of the widget.
For example:

PangoFontDescription *fdesc = pango_font_description_new();
pango_font_description_set_size(fdesc, 20000);
gtk_widget_modify_font(widget, fdesc);

As long as you don't unref this PFD you can apply it to as
many widgets as you like.

  -jkl



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