[cairo] Custom logical / inked rect for PangoRenderer subclass?

Behdad Esfahbod behdad at behdad.org
Mon Dec 22 21:43:59 PST 2008


Peter Clifton wrote:
> Hi,
> 
> Another noob-pango-user question I'm afraid..
> 
> I've got a custom PangoRenderer which adds an attribute for drawing
> overbars on some text in CAD drawings. What concerns me now is that I
> need an accurate way to measure the text for invalidating on-screen
> regions, and recording just were the text objects are on our canvas (so
> we know what to repaint when we get an expose event).
> 
> It wasn't obvious to me that I could provide new information for the
> inked / logical rectangles retrieved with 
> pango_layout_get_extents() or pango_layout_get_pixel_extents().

You currently can't.  I'll look into fixing that if you open a bug.

> For now, it seems to work, since I'm (mostly by luck) keeping the
> overbars inside the logical extents of the rendered text.
> 
> Is it always the case that the logical extents are the same or larger
> than the inked extents? (Or is it possible that inked extents exceed
> logical extents?). For now, I'm basically just invalidating the logical
> extents.

No, definitely not.

> Behdad, you mentioned bug #457990 before.. is pango_layout_get_extents()
> affected by that bug?

It is, but very marginally.  In that the height of empty lines does not scale
with ctm.

> I'm having difficulty getting sensible bounds from
> that when I have a non identity CTM. Setting cairo_set_font_matrix ()
> with my world to device scaling factors didn't seem to affect its output
> either.
> 
> Best regards,

behdad


More information about the cairo mailing list