Text-on-path with cairo
Cairotwisted is the name a piece of code I wrote using pangocairo to lay text on a path. Over the years many people have found it useful, so here is a public post to make sure it's easier to find on the interwebs.
![cairotwisted](http://farm4.static.flickr.com/3153/3058628981_4e496299e0_m.jpg)
The code is shipped in Pango tarball under examples/cairotwisted.c and can be browsed
here. Click on the thumbnail to see the full size image output.
At the core of it there is a function to map one path
onto another one. This is done by parameterizing the second path and computing it's gradient (see
the code).
Parameterizing a Bezier curve uniformly is not easy though. I currently flatten curves to lines and use that, but that has its own down sides as the error introduced in the gradient can magnify out of bound. Any ideas?
Labels: cairo, cairotwisted, pango, pangocairo