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

Re: How to set the font's size of the Gtklabel



But I only use gtk api, not gtkmm. How to do this by gtk?

On Thu, Aug 28, 2008 at 9:50 PM, Garth's KidStuff
<garthskidstuff gmail com>wrote:

> Whops, hit the send button before I was finished..
>
> the method should be:
>
> void ChangeLabelFontSize(
>    Gtk::Label *pLabel,   // [in] Pointer to label to change font on
>    float scale)  // [in] amount to scale font size by.  1.0 leaves label
> unchanged
> {
>        Glib::RefPtr<Pango::Context> pPangoContext =
> pLabel->get_pango_context();
>        Pango::FontDescription fontD =
> pPangoContext->get_font_description();
>        fontD.set_size((int)(scale * fontD.get_size()));
>        pLabel->modify_font(fontD);
> }
>
> --
> Garth Upshaw
> Garth's KidStuff
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



-- 
----------------------------------------------
┏━━━━━━━━━━━━━━━━━━━━━━━━┓
┃菩提本无树,明镜亦非台。本来无一物,何处惹尘埃。┃
┗━━━━━━━━━━━━━━━━━━━━━━━━┛


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