Thanks for the replies.

The example with the rectangle was just to illustrate my point. What I need is 
in general knowledge of the size of text strings in order to adjust all kinds 
of objects on the canvas and the general layout based on the actual text 
strings.

The library I was planning to add a SVG backend to has a lot of text 
manipulation where the layout engine absolutely needs to find out the size of 
the text strings. For example to determine things like minium column width 
(when the texts are put in columns).

I'm still so surprised about this omission since it basically renders SVG 
useless for anything involving graphics with TTF fonts and texts (without 
resorting to things like a fixed font where one could calculate an 
approximate bounding box outside the viewer used and hope for the best). 

One of the replies to my original posting mention that there are no plans to 
add anything like this to the upcoming 1.2 specs.

Can anyone share any light why this humungus omission has come to be?

Rgds
Johan

On Sunday 28 May 2006 18:19, Andreas Neumann wrote:
>  Hi,
>
>  there is a probably ugly workaround:
>
>  some elements accept "objectBoundingBox" as units. This includes pattern,
> clipPath, mask and filters.
>
>  You could e.g. use a filter to add such a background rectangle to a text
> element.
>
>  See example at:
>  http://www.carto.net/neumann/temp/floodFilterExample.svg
>
>  or with a pattern example:
>  http://www.carto.net/neumann/operasvgbugs/patternCrashExample.svg
>
>  In the last example the pattern is clipped to the text, however.
>
>  I know, its an ugly workaround, also because the relative units mean that
> the wider your text is, the wider will be the offsets. One would have to
> compensate by using different offsetx/width than offsety/height values for
> the filter regions.
>
>  Andreas
>
>  --- In [email protected], "ljp_aditus" <[EMAIL PROTECTED]> 
> wrote:
>  > Having studied the SVG specs in order to start the dssign of a SVG
>  > output backend for a graphic library I have drawn the (possible
>  > erronous - I hope!) conclusion that there is an oversight in the SVG
>  > specs that will make it impossible for me to implement this backend.
>  >
>  > The problem is that there seems to be no way to statically find out
>  > the bounding box of text string with a chosen font, size and style.
>  >
>  > This would make such a simple thing as drawing the minimum reactngle
>  > around a text almost impossible.
>  >
>  > Sidenote: I'm aware that it would be possible to create a filter to
>  > achieve this as an effect or use the DOM interface with some
>  > Javascript but the filter is just a special case and the DOM
>  > scrtipting is not static.
>  >
>  > Have I overlooked something really fundamental ?
>  >
>  > Just to explain what I would like to do. In SVG I would like to be
>  > able to do something like this (in Pseudo-SVG) to draw the rectangle
>  > around a text. To illustrate my point I have "invented" a new SVG
>  > element "boundingbox". (To the XML experts out there I apologize for
>  > this - but this is just to get my point across)
>  >
>  > <def>
>  >   <boundingbox id="bb1" text="This is a text" style="font-size:12pt;" />
>  > </def>
>  > <rect x="50+#bb1.x1-10" y="50+#bb1.y1-10"
>  >       width="#bb1.width+20" height="#bb1.height+10" />
>  > <text x="50" y="50" >
>  >   <tref xlink:href="#bb1" />
>  > </text>
>  >
>  > The above pseudo-SVG script defines the text string to be used in the
>  > def sectiion which is then erferenced in the script for stroking where
>  > it is also possible to refer to the texts bounding box parameters in
>  > order to adjust the other graphical element in the scene.
>  >
>  > Without this functionality it would be simply impossible to adjust an
>  > SVG image based on the size of text strings since this would be
>  > impossible to determine outside the SVG-viewer.
>  >
>  > It seems like such a big oversight that I'm sure that I must have
>  > fundamentally misunderstood something.
>  >
>  > Comments?
>
>  -----
>  To unsubscribe send a message to:
> [EMAIL PROTECTED] -or-
>  visit http://groups.yahoo.com/group/svg-developers and click "edit my
> membership" ----
>
>
>
>
> SPONSORED LINKS
> Xml format   Svg   Format
>   Data
>
>
> YAHOO! GROUPS LINKS
>
>
>  Visit your group "svg-developers" on the web.
>  
>  To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

-- 

---------------------------------------------------------------------------------------------------
Aditus Consulting is a Swedish company with registered address: 
Emagatan 16, SE-128 46 Stockholm, Sweden. 
VAT No: SE661128485901


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/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