[cairo] render text along path
Dirk Schönberger
dirk.schoenberger at sz-online.de
Tue Nov 25 01:38:40 PST 2008
> For what I was doing, I actually want the text to warp, so that's all to
> the
> good.
>
> The remaining challenge is warping text along b-splines or beziers.
> You'll
> note that in the warpedtext.py example, the paths that the text is warped
> along are simple little curves - a spiral and a circle. I want to warp
> text
> along a spline, and so need to parametrize it by arclength, which is not
> completely trivial, and generate a normal to the spline. I've found a
> couple useful references in this regard, but if anyone knows of some
> existing code that plays nice with cairo already, it would be greatly
> appreciated.
I don't have code ready, but I thingk the way to go is via
cairo_copy_path_flat ()
This function returns a copy of the original path where the "complex
parts", i.e. the arcs, bezier curves etc are "transformed" into line
segments.
Now what you have to do is to find the line segment which "belongs" to
your relative coordinate. Even if I don't know the actual algorithm,
calculating the normal vector from the given line segment should be rather
straight forward.
Regards
Dirk
More information about the cairo
mailing list