in reply to GD::Text::Arc

Neato! A job well done! Congratulations!

xenchu

Update: I forgot to ask. Will it do spirals as well?


The Needs of the World and my Talents run parallel to infinity.

Replies are listed 'Best First'.
Re: Re: GD::Text::Arc
by da (Friar) on Jan 24, 2004 at 10:22 UTC
    Hey, spirals. That would be neat. But no, it doesn't currently. If somebody can suggest an algorythm that works with my code, I could make it do spirals. I was getting a headache even trying to figure out how to make it do ovals (*)...

    Other items on my wish-list:

    • ovals;
    • left-aligned and right-aligned to a specific point, instead of centered;
    • specifying the (center/left/right) anchor point at some angle other than 12 o'clock and 6 o'clock;
    • maybe even some arbitrary spline-curve, given some points? (bearing in mind that I have no idea how splines work).

    (*) The complication giving me trouble is that I need to recalculate the position (or drawing-angle) for each letter, to account for the fact that GD draws TrueType characters from the lower-left corner, not the center.

    I could easily set a separate scaling factor for X and Y coordinates (to make ovals), just like I could vary the radius on-the-fly (to make a spiral) but the problem is that the letters will be angled oddly (as if they were supposed to be in a circle). Too much for this bear of little brain! But, if you have suggestions, I'm all ears.

    ___ -DA $_='daniel@coder.com 519-575-3733 /Prescient Code Solutions/ coder.c +om ';s/-/ /g;s/([.@])/ $1/g;@y=(42*1476312054+7*3,14120504e4,-42*330261-3 +3, 42*5436+3,42*2886+10,42*434987+5);s/(.)/ord(uc($1))/ge;for(@x=split/32 +/; @y; map{print chr} split /(..)/, shift(@x) + shift(@y)) {perlmonk.da.r +u}
      I suppose the thing to research is the notion of 'path'---i.e. a continuous curve where on each character could be drawn perpendicular to a point of tangency. This is the idea supported in postscript and elsewhere...

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."