Re: Howto retrieve selected font size from GtkFontButton



Am Dienstag, den 02.12.2008, 14:55 +0100 schrieb Christian Dywan:
> Am Tue, 2 Dec 2008 14:19:49 +0100
> schrieb "Nelson Benítez León" <nbenitezl gmail com>:
> > 2008/12/2 Christian Dywan <christian imendio com>
> > 
> > > Am Tue, 2 Dec 2008 14:03:01 +0100
> > > schrieb "Nelson Benítez León" <nbenitezl gmail com>:
> > >
> > > > Hi,
> > > > Gtkfontbutton provides api to get the name of the selected font,
> > > > but not to get the selected font size, so I would appreciate if
> > > > you know of some way to get the size, or if that is not possible,
> > > > if you will accept a patch to provide that api..
> > > >
> > > > Thank you
> > >
> > > Hey,
> > >
> > > you can convert the font string with
> > > pango_font_description_from_string and then obtain the size easily.
> > > I would however also think the font button should provide API for
> > > that. Ideally it were a GtkFontSelection but unfortunately that's
> > > not the case.
> > 
> > 
> >  And, how could I get the font string of the currently selected font
> > in the gtkfontbutton? to pass it to
> > pango_font_description_from_string later...
> 
> gtk_font_button_get_font_name
> 
> That returns the font name, as seen in the button, including styles and
> size.

Right. So, Nelson, if you want to render something with the font, just
use pango_font_description_from_string() and use the font description.
If you're interested in peeking certain values (family name, style,
size, weight), just query these properties from the
PangoFontDescription.

Regards,
  Sven



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