I don't see anything - at least, nothing simple - and I wouldn't be surprised if there weren't anything. Cairo is aimed at rasterizing vector drawing operations, not intersection testing.
However, if I were going to see if two pieces of text overlapped, here's what I would do:
- Pick a Cairo backend suitable to my
test environment - e.g. Xlib, etc. -
and use an offscreen surface that I
can use to do a pixel-by-pixel
analysis.
- Draw the first piece of text in solid blue with 100% alpha.
- Draw the second piece of text in solid red with 50% alpha.
- Scan the surface for pixels where both red and blue are non-zero.
It's rather brute force, but it will even cope with anti-aliasing. I've done something like that before (for a different purpose) with GTK on X, which indirectly uses Cairo.
If you don't want to do it that way, and Cairo doesn't provide an API, you might be able to add one. That would probably be difficult; you might want to talk with Carl Worth before doing that.