[cairo] cairo_text_path() questions

Carl Worth cworth at cworth.org
Fri Nov 9 10:23:35 PST 2007

On Fri, 09 Nov 2007 17:46:21 +0100, Hans Breuer wrote:
> Recently I've written a prototype for outline rendering with Dia based on
> cairo_text_path(), see:

Excellent. I hope cairo continues to work well for you.

> 1) although there is a cario context required to call cairo_text_path() the
> transformation within it seems to be ignored (or I am doing something
> wrong:)) E.g. calling cairo_rotate() before cairo_text_path() does not have
> the desired effect of delivering a rotated path.

I suspect pilot error on this one. As evidence, here is the
text-rotate test from cairo's test suite:


Notice that the #if CAIRO_TEST_GENERATE_REFERENCE_IMAGE section isn't
normally compiled, but if one turns that on, (which I just verified
with cairo 1.5.3 from git), it does use cairo_text_path after
cairo_rotate and I do get rotated text out.

> 2) cairo is delivering multiple closed pathes per glyph. If for example one
> renders '#' the first path given describes the outer curve while the next
> closed path gives the inner square.

Cairo is just providing the glyph outlines exactly as they occur in
the font.

> Is there a way to detect the second outline being a hole in the glyph?

Yes, that's what cairo_fill does, for example. It uses a
scanline-based algorithm to evaluate the multiple paths and determine
which points are inside and outside the final shape.

But there's nothing to indicate that any particular sub-path is a
"hole", (and in fact, a single sub-path might be "subtracting" in one
part and "adding" in some other part---though that requires
intersecting sub-paths and hopefully fonts won't generally have

But anyway, the determination of "inside" and "outside" is a global
question by definition. No local examination of any individual subpath
can say anything about that.

What is it you are trying to do that isn't working here? Perhaps we
can help find some other answer for what you need.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071109/cfed1a96/attachment.pgp 

More information about the cairo mailing list