On Wed, 19 Sep 2001, Andrew Reid wrote:

>   I have a variety of questions revolving around the use of fonts
> in pyGTK.  The basic thing I want to do is boldify and/or italicize
> an existing font in a label -- this was asked a couple of weeks ago,
> and the reply said "there is no easy way", and pointed to GTK+ v2.0
> and pango.

The hard way can be hacked using:

ins = gtk.GtkLabel()
s = ins.get_style()
s.font=gtk.load_font("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1")
ins.set_style(ins)

>   My question is:  What is the hard way?  It seems that if you
> could find out what font was used in the first place, and get its
> XLFD string, then you could substitute "i" for "r" and/or
> "bold" for "medium" (or "normal") in the appropriate fields, and

I'm unsure of how to find out the XLFD string to start off with. I know
hardcoding sucks; one way to do this would be using rc styles and setting
the rc style dynamically. From my discussion with James on IRC, the XLFD
might not be obtainable at all from the GdkFont. At least I can't see how
you can.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to