开发者

How to render (fast) text on path?

How to render (开发者_C百科to image) text on path with any renderer working on linux?

Like this: text on path.

Performance is important.


Short answer:

I'm on a Debian Squeeze system with the python-cairo package installed. If I run the warped text example it provides (85 lines of Python):

python /usr/share/doc/python-cairo/examples/warpedtext.py

it produces a warpedtext.png file like this:

How to render (fast) text on path?

I imagine it'd be fairly easy to modify/adapt/port the example.

Long answer:

There are two things you need to do this.

  1. The ability to generate the transforms which will place individual letters with the correct position and orientation along the path. This is basic 2D transform geometry.
  2. The ability to render transformed characters/font glyphs with a decent level of quality (sub-pixel precision, antialiasing etc).

For the latter, I'd be looking at one of

  • Qt's QPainterPath (this example seems to be exactly what you want, but see also this one).
  • Cairo (another example).
  • Anti-Grain Geometry.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜