Re: pango text size
- From: Paul Davis <paul linuxaudiosystems com>
- To: Richard Boaz <riboaz xs4all nl>
- Cc: Jose Hevia <jose francisco hevia gmail com>, gtk-list gnome org
- Subject: Re: pango text size
- Date: Wed, 29 Mar 2006 09:44:17 -0500
On Wed, 2006-03-29 at 16:30 +0200, Richard Boaz wrote:
> hi,
>
> i have no idea if i do this correctly myself (comments?), but the way
> i have achieved this is with the following code:
>
> int fontSIZE(char *str, gboolean type)
type is not a boolean.
> PangoLayout *layout = pango_layout_new (gtk_widget_get_pango_context
> pango_layout_set_text(layout, str, -1);
> pango_layout_set_font_description(layout, desc);
> pango_layout_get_pixel_size (layout, &width, &height);
> but i'm with you, it would seem to me there should be an easier way
> of getting these values, in that, requiring to know the width/height
> of a string strikes me as crucial information if you're rendering
> text to a drawing area where the location of other stuff in the
> drawing area is dependent on the size of other displayed text.
which steps do you think can be dropped?
a) create an object (layout) that understands fonts+text
b) tell the object about the text you want to measure
c) tell it the font you want to use
d) ask for the size
e) clean up
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]