Philippe Lhoste wrote:
>> Any ideas for direction on how to accomplish this? Am I going to have 
>> to write my own function that warps the text into the shapes they  
>> want? I can't seem to find any sort of envelope or morphing 
>> capabilities built into SVG 1.1.
> 
> I fear no. You may have to do matrix transformations on each letter.
> Or perhaps even more complex transformation, if each node of the letter 
> path need a specific transformation, like deforming the initial 
> rectangle bound by moving each corner in arbitrary location, eg. to do a 
> pyramid.
> I am not good enough in geometry to see if that can be done in native 
> SVG 1.1.

Well, the geometry seems to be quite simple after all. I make yesterday 
the needed maths, I just have to put this in a script to see if it works...

Caveat: The needed transformations can be done only on path elements. 
Ie. with my method, you can't transform shapes like circle, rect or even 
plain text.
That mean that you must put all your drawing into path. This is simple 
for most basic shapes, but harder for text.

You have to transform your TrueType font to SVG font (I know a couple of 
Java programs that can do that), but then you have to transform again 
the generated glyphs to plain SVG (they are upside down and they use 
their own viewbox) as we must apply the transform to each letter, 
relative to its position (ie. a T on the left may have a different 
transform that a T on the right).

That done, my little math is quite simple to apply if you do only a 
simple rectangle deforming, eg. to a trapezoid.
If you need more complex transformations, like applying a grid on a 
graphics, and deforming this grid to make, say, a flag, a concave or 
convex cushion, etc., we need to compute also the intersection of the 
graphics with the grid, otherwise the results wouldn't be good (long 
stripe not following curvature, etc.).
I can do that using Kevin Lindsey's intersection algorithms, but it will 
take some time.

I believe I will first do a proof of concept script, doing a static 
transformation of path using static grid deformation data.

Ideally, one should write a SVG file where a grid would be overlaid on a 
graphics, allowing to move grid nodes around with some constraints, and 
computing transformation either when clicking on a button, or if speed 
allows, in real time (or on button up).

I have to improve my JS/Dom knowledge before doing such thing...

Funny that nobody I know did such a thing before. I visited a lot of 
SVG-related sites (not all existing!) and this seems to be an unexplored 
field.

-- 
Philippe Lhoste
--  (near) Paris -- France
--  Professional programmer and amateur artist
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --


------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to