[cairo] cairo_text_path() questions
hans at breuer.org
hans at breuer.org
Fri Nov 9 11:02:32 PST 2007
>From: cworth at cworth.org
>Date: Nov 9, 2007 10:23
>To: "Hans Breuer"<hans at breuer.org>
>Cc: <cairo at cairographics.org>
>Subj: Re: [cairo] cairo_text_path() questions
To answer the last question first:
I'm implementing cairo based text outline rendering - with the ability
to fill - for Dia's renderer interface . The model is much less
capable than cairo's but at the moment it supports way more more output
formats including the ones of cairo  ;)
So I'm translating the text pathes given from cairo to DiaRenderer::
draw_bezier() and DiaRenderer::fill_bezier() calls.
It already works with Dia's current SVN but has the second issue from
below. Just filling the outlines as they come puts the fill color even
at places where holes are supposed to be.
>On Fri, 09 Nov 2007 17:46:21 +0100, Hans Breuer wrote:
>> Recently I've written a prototype for outline rendering with Dia
>> cairo_text_path(), see:
>Excellent. I hope cairo continues to work well for you.
>> 1) although there is a cario context required to call
>> transformation within it seems to be ignored (or I am doing
>> wrong:)) E.g. calling cairo_rotate() before cairo_text_path() does
>> the desired effect of delivering a rotated path.
>I suspect pilot error on this one.
I'll try Behdad's suggestions.
>> 2) cairo is delivering multiple closed pathes per glyph. If for
>> renders '#' the first path given describes the outer curve while
>> closed path gives the inner square.
>Cairo is just providing the glyph outlines exactly as they occur in
>> Is there a way to detect the second outline being a hole in the
>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
Again I'll try to follow Behdad's suggestion or do you think it wont
> (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
If the path is completely connected Dia's rendering should not have a
The thing I'm trying to solve is if I have the 'outer' outline or and
(unconnected) path just being a 'hole'.
>But anyway, the determination of "inside" and "outside" is a global
>question by definition. No local examination of any individual
>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.
More information about the cairo