Last post Apr 23, 2012 09:56 AM by FerdyHoefakker
Apr 23, 2012 06:00 AM|FerdyHoefakker|LINK
Okay, I have seen several other threads about this, but I have not seen anything that could lead me to an answer.
For a project we are currently doing, we need the ability to draw text. So far good. I managed to figure that out and build a function for this. I even managed to get a function so that we can rotate the entire text from it's center in exactly the correct
amount of degrees. No problem there. Now however, the request has come to make a function to allow us to "curve" the text so that it follows an arc.
Now this just leaves me completely baffled. I have found some examples, but nothing I could understand. There are two main solutions to this problem in my opinion. First is to draw each letter individually. I tried this, but it turned out horrendous when
not arcing the text. It seems to completely ignore spaces (could write correction for that of course). But not just the spaces are terrible, it's the letter spacing it self as well.
Which is just a complete mess. I could probably correct it somehow for my test font... But that changes depending on your font and it's size. I might be wrong of course (probably am), but my tests just show a completely random letter spacing for each individual
letter. Maybe it's possible to check this somehow and thus write a universal correction formula somehow, but I'm not seeing it.
The other option, is to use bezier curves. Which seems like the more clean solution, but also the hardest. I found http://www.planetclegg.com/projects/WarpingTextToSplines.html and tried my best in following along. But at some point the pseudo code there
just leaves me going "what the hell is supposed to be done here code wise?"
I managed to draw some text this way, as well as draw a nice arc. But I have been unable to have the text follow said arc. At first I thought I had to connect the text to the arc, but upon further inspection, it seems like I have to use some math formula's
in a loop to recalculate the points of the text. But my math is just not up to par as I have no idea what's going on there.
If someone here could be so kind as to just point me in the right direction or clarify what's going on in the "warping text to splines" page that would be amazing.
Thanks in advance!
Apr 23, 2012 06:15 AM|DarrellNorton|LINK
This article shows how to display text on a Path in GD+I:
Apr 23, 2012 09:56 AM|FerdyHoefakker|LINK
Okay, I don't know how I managed to miss that one. It's all still a little abra kadabra to me, but I got it working! Thanks!