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

Re: Size of text



On Wed, 2003-04-23 at 18:23, ZHOU DX wrote:
> Hi,
> 
> How can we determine the size of the text in terms of
> pxiel? 
> 
> My gtkmm code looks like this:
> Glib::RefPtr<Pango::Layout> pango_layout =
> create_pango_layout(ustr);
> Pango::FontDescription fd("Courier 400");
> pango_layout->set_font_description( fd);              
> window_->draw_layout(gc_, 220, 100, pango_layout);
> 
> I want to know how big the "ustr" is, so that I can
> position it in the right place on the screen
> automatically instead of using things like "220" and
> "100" here.

In C, simplest is:

void     pango_layout_get_pixel_size       (PangoLayout    *layout,
                                            int            *width,
                                            int            *height);

Regards,
                                           Owen





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