freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] Question about FT_Outline


From: Patrick Baggett
Subject: Re: [ft] Question about FT_Outline
Date: Sat, 5 Mar 2011 06:19:19 -0600



On Fri, Mar 4, 2011 at 11:15 PM, Werner LEMBERG <address@hidden> wrote:

> According the the manual, there is an implicit FT_CURVE_TAG_ON
> between the two FT_CURVE_TAG_CONIC's by a simple average and the
> outline code looks decent so far, but without an ending
> FT_CURVE_TAG_ON, I'm not sure what to do with the last
> FT_CURVE_TAG_CONIC in the outline. How should I handle this?

There are three possibilities around the start of the contour how
conic points can be located.  Let's assume that we have P points in an
outline.  Uninteresting points are marked with `x' (these points could
be conic also).

. Point 0 and point 1 are conic.

     P-1   P    0    1
  ----x----x----o----o----

. Point P and point 0 are conic.

     P-1   P    0    1
  ----x----o----o----x----

. Point P-1 and point P are conic.

     P-1   P    0    1
  ----o----o----x----x----

In all cases, there is an implicit on point between the two conic
points.  Note that the sequence `on - conic -on' is invalid.

If you use FT_Outline_Decompose, FreeType handles this automatically
for you.

Does this answer your question?


   Werner

Thanks for the response. It doesn't answer my question. My question was how to deal with a sequence that ends in  a way that would make it invalid according to FreeType2 manual. For brevity, I'm going to use C for a conic point and O for an on point. Right now, my code handles these cases

O-O -- single line segment
O-O-O-O -- series of line segments
O-C-O     --    conic curve
O-C-C-C-C- ... -C-O    -- series of conic curves

My question was, in the end of a contour there are cases that aren't covered by the documents. For example, suppose the following diagrams represent the last 2-3 points in a contour. How does one treat this case:

...-O-C-C  -- Doesn't end with an ON point.
...-O-C -- Doesn't end with an ON point

I've found that implicitly using the first point in the contour as the last point produces results that look correct. This makes some kind of sense, after all, a contour is a closed shape and the best way to close a shape is to connect the last point with the first point. Still, this isn't mentioned at all on "FreeType Glyph Conventions" (http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-6.html). I'm not using FT_Outline_Decompose() as I didn't know it existed. Would have saved some time I guess, but it is hard to find documentation/tutorials on how to handle outlines in FreeType.

In other words, unless anyone can tell me that I'm doing something horribly wrong, I think I've solved my problem.

Patrick

reply via email to

[Prev in Thread] Current Thread [Next in Thread]