Re: How to use a monospace font in a Gtk::Label?
- From: "Jonathon Jongsma" <jonathon jongsma gmail com>
- To: gtkmm-list gnome org
- Subject: Re: How to use a monospace font in a Gtk::Label?
- Date: Fri, 4 May 2007 10:45:13 -0500
On 5/4/07, Robert Pearce <rob bdt-home demon co uk> wrote:
On Fri, 4 May 2007 07:48:55 +0200 (CEST)
Chris Dams mi infn it 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]