[cairo] render text along path
Behdad Esfahbod
behdad at behdad.org
Wed Nov 26 10:05:42 PST 2008
Bobby Salazar wrote:
> Thanks for the screenshot. I have been able to get this code to work now and it's pretty cool. Thanks Behdad! You never cease to amaze me.
Glad you liked it :).
> The code seems to work great for paths that are just connected lines and curves. However, it looks like this code does not treat "close path" operations properly because it does not map the text path back to the beginning point of the current sub path. It also seems to treat "move to" operations as if they were "line to" operations, at least in the resulting mapped path (i.e. it does not insert a "move to" in the correct place to break the text path nicely).
>
> Fixing the handling of "close path" seems not too bad, given a good hint on where to start (I don't understand the math involved in this example code). But after giving further thought to the "move to" problem, it seems harder than it first appears because you would have to figure out how to properly close the shape. If anyone can help suggest where in the code I should look, I would be interested in at least making an attempt at fixing this and sharing the results.
I fixed the close_path issue. Check pango trunk or refresh the viewvc page.
The move_to issue, there's not much to do about it. What do you want it to do?
Cheers,
behdad
>> -----Original Message-----
>> From: behdad at behdad.org
>> Sent: Tue, 25 Nov 2008 13:08:56 -0500
>> To: bobby8934 at inbox.com
>> Subject: Re: [cairo] render text along path
>>
>> Bobby Salazar wrote:
>>> Does anyone have a screenshot of what this is supposed to look like? I
>>> am trying to get it to work without pango, but I don't think it's
>>> working right. If anyone has a picture it would be much appreciated!
>> http://www.flickr.com/photos/behdad/3058628981/sizes/o/
>>
>>
>>>> -----Original Message-----
>>>> From: behdad at behdad.org
>>>> Sent: Tue, 25 Nov 2008 10:34:13 -0500
>>>> To: kevin.atkinson at gmail.com
>>>> Subject: Re: [cairo] render text along path
>>>>
>>>> Kevin Atkinson wrote:
>>>>> 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.
>>>> My cairotwisted code that I posted earlier does exactly that:
>>>>
>>>> http://svn.gnome.org/viewvc/pango/trunk/examples/cairotwisted.c?view=markup
>>>>
>>>> behdad
>>>>
>>>>> Cheers,
>>>>>
>>>>> Kevin
>>>>>
>>>>> On Tue, Nov 25, 2008 at 3:34 AM, Dirk Schönberger
>>>>> <dirk.schoenberger at sz-online.de
>>>>> <mailto:dirk.schoenberger at sz-online.de>>
>>>>> wrote:
>>>>>
>>>>>
>>>>> > Pycairo comes with the example examples/warpedtext.py which
>>>>> draws
>>>>> text
>>>>> > along a path.
>>>>> >
>>>>>
>>>>> The example looks interesting.
>>>>> The only problem I see is that this method warps the actual
>>>>> glyphs.
>>>>> In a pure text on path I think the glyphs should be only rotated,
>>>>> transformed or scaled, while the actual "point data" (outlines)
>>>>> are
>>>>> not
>>>>> changed.
>>>>>
>>>>> Regards
>>>>> Dirk
>>>>>
>>>>> _______________________________________________
>>>>> cairo mailing list
>>>>> cairo at cairographics.org <mailto:cairo at cairographics.org>
>>>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> cairo mailing list
>>>>> cairo at cairographics.org
>>>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>>> _______________________________________________
>>>> cairo mailing list
>>>> cairo at cairographics.org
>>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>> _______________________________________________
>>> cairo mailing list
>>> cairo at cairographics.org
>>> http://lists.cairographics.org/mailman/listinfo/cairo
>
> ____________________________________________________________
> GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
> Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list