Reputation: 12018
Gtk how should I calculate width of the string in pixels.
I have created a markup string using g_markup_printf_escaped
and I want to calculate width of the string in pixels not in chars.
Does Pango
provides any function to calculate string length in pixels, depending on font type, size and weight?
Upvotes: 2
Views: 3134
Reputation: 19204
You can get PangoLayout size using pango_layout_get_pixel_size () function:
http://www.gtk.org/api/2.6/pango/pango-Layout-Objects.html#pango-layout-get-pixel-size
Upvotes: 4