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
[EMAIL PROTECTED]
http://move.to/hpkb

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to