pango layout size question
- From: Chris Casinghino <chris casinghino gmail com>
- To: gtk-list gnome org
- Subject: pango layout size question
- Date: Sun, 23 May 2010 13:52:09 -0400
Hi all,
I have a basic question about scaling text with pango. I have a small
fragment of text (less than 8 characters) and I must fit it into a
particular square region of a GdkDrawable. I know the size of this
area in pixels.
I'd like to create a PangoLayout that makes the text as big as
possible while still fitting in this area. What's the best way to do
this? I see the font size of a pango context can be adjusted, but I
don't know how to calculate the right font size from the bounding
region for my string (short of trying a bunch of different font
sizes).
Some particulars: My font is fixed (but I am happy to adjust its
size). The characters are allowed to flow over two lines (i.e., the
word wrap mode is PANGO_WRAP_CHAR. Currently I am drawing the layout
directly to a drawable with gdk_draw_layout. So, I'm not using Cairo
at all now, but if there is something there that can help me I'd love
to hear about it.
Thanks for your help!
--Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]