Re: Bold text



Russell Shaw wrote:

Hi,
What do i do with a pangolayout to set the Label text to bold?

  PangoLayout* gtk_label_get_layout(GtkLabel *label);

Hello,
Use PangoAttrList for this:
http://developer.gnome.org/doc/API/2.0/pango/pango-Text-Attributes.html
with pango_layout_set_attributes():
http://developer.gnome.org/doc/API/2.0/pango/pango-Layout-Objects.html#pango-layout-set-attributes
You can avoid getting layout from label with gtk_label_set_attributes():
http://developer.gnome.org/doc/API/2.0/gtk/GtkLabel.html#gtk-label-set-attributes

Some code:

   GtkWidget *label;
   PangoAttribute *pa;
   PangoAttrList *pal;
pa = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
   pa->start_index = 0;
   pa->end_index = G_MAXINT;
   pal = pango_attr_list_new ();
   pango_attr_list_insert (pal, pa);
   gtk_label_set_attributes (label, pal);
   pango_attr_list_unref (pal);

   Olexiy




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