On 5/4/07, Robert Pearce <[EMAIL PROTECTED]> wrote:
> On Fri, 4 May 2007 07:48:55 +0200 (CEST)
> [EMAIL PROTECTED] wrote:
>
> > Could somebody please tell me how I can use a monospace font in a
> > Gtk::Label? Browsing Pango documentation does not seem to lead to
> > enlightenment with respect to this question within a reasonable amount of
> > time.
>
> I did it (in C/Gtk rather than Gtkmm, but the principle is the same)
> like this:
>
>   static const char ValueMarkup[] =
>                        "<span font_desc=\"mono 24\">%6s%s</span>";
>
>      G_Value[cc] = gtk_label_new ( NULL );
>      sprintf ( markup, ValueMarkup, "--", ValueCoding[cc].Units );
>      gtk_label_set_markup ( GTK_LABEL(G_Value[cc]), markup );
>
> The essence is to use Gtk::Label::set_markup and pass a Pango markup
> with a mono font specified.
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

Alternately:
Pango::FontDescription font_desc("monospace"); // could be any font
name, + optional size
lbl->modify_font(font_desc);

-- 
jonner
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to