Possible Duplicate:
SVG Scaling Text to fit container
I have an text of unknown length (say the caption of an element) and I have a container with fixed dimensions that should display the text without clipping. Instead the text should be scaled to fit the container completely.
Example:
<svg>
<rect width="100px" height="100px" fill="none" stroke="blue" />
<svg width="100px" height="100px" style="border:black">
<text dx="1ex" dy="1.5em" >Some Unknown Caption</text>
</svg>
</svg>
I thought this should be easy with svg but I cannot find out how to do it. I know I can do it with Javascript by calculating the scaling factor but I believe that for this common case some kind of autoscaling must exist. I have experimented with the viewbox attribute but it seems that you must know the dimensions of the content which I don't.