Re: Get a character size (height, width) in pango
- From: Eduardo M KALINOWSKI <ekalin bol com br>
- To: gtk-app-devel-list gnome org
- Subject: Re: Get a character size (height, width) in pango
- Date: Tue, 10 Oct 2006 19:18:04 -0300
Alexandre wrote:
Hi.
I've searched for it in the pango reference but I haven't found..
I realy want to know how to get the width and height of a character in pago, with it's
PangoFontDescriptor..
I know the character's width is not constant, but a average would be ok...
I use something like this to get the character size in a GtkTextView:
get_char_size(GtkWidget *widget, gint *char_height, gint *char_width)
{
PangoLayout *layout;
PangoRectangle logical_rect;
layout = gtk_widget_create_pango_layout(widget, "W");
pango_layout_get_pixel_extents(layout, NULL, &logical_rect);
*char_height = logical_rect.height;
*char_width = logical_rect.width;
g_object_unref(layout);
}
But I use fixed-width fonts. With variable-width fonts the problem is
more complicated.
--
Practical people would be more practical if they would take a little
more time for dreaming.
-- J. P. McEvoy
Eduardo M KALINOWSKI
ekalin bol com br
http://move.to/hpkb
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]