Re: Gtk2: how to get a bold variant of the default font



Jörn Reder said:
I want to get the bold variant of the current Gtk2 default font, e.g. to
display some labels with a bold font. What's the simplest way of doing
this?

with a label, the easiest way is to use pango markup.

$label = Gtk2::Label->new;
$label->set_markup ("<b>Pango markup</b> is <big>cool</big>, like <i>html</i>, "
                  . "but <span color=\"blue\">you use the span tag</a> for "
                  . "some things.");

see the reference for it in the API docs:

http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html



the traditional GtkStyle way still works, though you'd have to get the font
description and add bool to it somehow.  i've not tried that, as the markup
has always worked for me.


-- 
muppet <scott at asofyet dot org>





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