Re: Setting fixed-width font
- From: Peter Krueger <pkrueger appss de>
- To: gtk-list gnome org
- Cc: "Egon Andersen, Talura" <post talura dk>
- Subject: Re: Setting fixed-width font
- Date: Fri, 26 Sep 2003 16:55:03 +0200 (MEST)
> I have a widget (actually a GtkLabel, but it may be changed later) for
> which I want use fixed-width font.
> Is there a simple way to achieve this?
yes it is. You can modify the font of any widget like this:
PangoFontDescription *font_desc = pango_font_description_from_string(
This will completely override the old font attributes. If you only want to
change the font from "Helvetica" or whatever it is to "Fixed" and keep the
other attributes (style and font size) but you don't already know
them, this is a bit more complicated. I never tried it, but I think
something like this could work:
First you must get the current PangoFontDescription from the
widget's style. Then get the description string for it ( char*
pango_font_description_to_string(const PangoFontDescription *desc); ) and
exchange the font name with "Fixed". When you got that you can
create a new PangoFontDescription and modify the widget as explained
applied software solutions (appss) GmbH
email: krueger appss de
Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg
"Virtual business becomes reality!"
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
] [Thread Prev