[cairo] cairo_text_path() questions

Behdad Esfahbod behdad at behdad.org
Fri Nov 9 12:01:18 PST 2007

On Fri, 2007-11-09 at 14:35 -0500, Carl Worth wrote:
> His approach is a set of heuristics. You do have a fairly constrained
> set of
> inputs, (since you're just taking paths from font files, not arbitrary
> paths), but it's still heuristics so I can't say how often it might
> fail.
> The "holes" will definitely be defined in the opposite direction as
> the filled portions. But I have no idea if fonts are generally
> consistent about which direction adds and which subtracts, (the fill
> algorithm doesn't care, and any given shape can choose either
> convention).
> So, give it a try and see if it doesn't work. (But also, don't be
> surprised if someone comes up with a font file that breaks it.)

I believe Type1 guarantee that.  I *think* FreeType guarantees it too.
Anyway, for the least the input is not self-intersecting, and definitely
has different orientations for holes and "lands".  And you can certainly
assume that the orientation of the holes is consistent across the glyphs
of a font.  Remains finding which orientation is a hole and which is a
land.  That's easy too, take the toppest-leftest point in the entire
glyph, that belongs to a land, not a hole.

> -Carl 

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list