Re: Calculating bounding boxes for rendered fonts



Hi,

Ian King [ES] wrote:
I need to be able to correctly calculate a bounding box for a string in a particular rendered font. At the moment I am creating a PangoLayout with a particular string and font description, then calling pango_layout_get_pixel_size. This seems to work when the rendered font is non-italic. However, when I italicize the font description, the query to pango_layout_get_pixel_size returns the same value, even though the rendered font is wider than the returned dimensions.

I'm using

 pango_layout_get_extents( layout, &ink_rect, &logical_rect );

ink rect is the bounding box of the pixels that will be painted, logical_rect includes a bunch of extra spacing and allowance for ascenders / descenders / extra punctuation / other stuff I don't understand. PANGO_PIXELS() converts to pixel coordinates.

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]