Right, if your paths can be defined by an admin, rather than by the user, then draw them in Inkscape and get Inkscape to do your rendering on the server. This is easy to achieve on the command line, though of course you'll need admin access to your server to install Inkscape. Then, where a path needs to support text, give it a special id
that you can recognise in your application, then rewrite the SVG file using one of PHP's XML writers, and convert using Inkscape to PNG output.
If you get text input from users then you'll need to do a certain amount of cleaning (swapping angle-brackets to their htmlentities etc) but otherwise it's quite easy. Files take around 0.7 sec to process on my dev machine, and if you expect much in the way of load, you can do it on a queue.
Edit: it's not as quick as Raphael, but it's much more reliable in terms of browser support. I've not looked into Raphael much, but I'm pretty sure the text flow stuff I'm doing just doesn't have good support client-side (yet, anyway).
Edit 2: this is what my current work looks like. The item on the left is an SVG template, rendered in-browser as a low-res PNG image, and the input boxes on the right are editing boxes (the last one containing symbols is using a home-made markup syntax, in case you're wondering). Now, the red outlines are bounding boxes that are retrieved using the Inkscape CLI. So, since we can detect an outline, in your case, you could determine by what percentage some text has overrun, and reduce the font-size
inside a tspan
element accordingly. (When you say "transform", I presume you mean "reduce in size").
That would be in effect a poor man's auto-fit feature. It would be nice if there was direct support in SVG for that, but I am not aware that there is. But, it does sound like the above suggestion would work for your case.