Hi Julien,

Thomas DeWeese | CDG Advanced Development | 
Eastman Kodak Company | 343 State Street | Rochester, NY 14650-0128 | 
thomas.dewe...@kodak.com | 585 724-0294 | 
www.kodak.com 

Julien Beghin <minimoi1...@hotmail.com> wrote on 05/19/2010 11:37:19 AM:

> The getBBox method always return null, maybe because the tesxt 
> element is location under the group tag (G) and in the définition part,
> The text is not under a use tag...

    Spot on, elements in the defs section do not have an associated
GraphicsNode, so there is no bounds to provide.  The main issue here
is that when an element is 'use'd it actually get's it's CSS properties
from the use element, so important things like font-size and font-family 
could be different. 

> Any other idea ? 

        You need to copy/put the text element into part of the rendering
tree (probably with visibility=hidden).

> From: jonathanshaww...@gmail.com
> Date: Wed, 19 May 2010 11:24:11 -0400
> Subject: Re: Getting a bounded box
> To: batik-users@xmlgraphics.apache.org
> 
> 
> I've always used:
> 
> SVGRedt bbox = ((SVGLocatable)element).getBBox();
> 
> you may need to account for the transforms also....use 
> SVGLocatable.getTransformToElement() and SVGPoint.matrixTransform() if 
needed
> 
> 
> 
> 

> On Wed, May 19, 2010 at 10:14 AM, Julien Beghin <minimoi1...@hotmail.com
> > wrote:
> Hi there,
> 
> We are dealing with a matter of bounded box :
> 
> First of all, we are defining a link  via the "use" tag like following : 

> 
> <use transform="translate(180,-325)" xmlns:xlink="
http://www.w3.org/1999/xlink
> " xlink:href="#6b0e597d-917e-4534-bb96-178a151a146c" 
> xlink:type="simple" xlink:actuate="onLoad" 
> id="INSTANCE_6b0e597d-917e-4534-bb96-178a151a146c" 
> xlink:show="embed" pointer-events="stroke"/>
> 
> This link points towrds a group in the definition part : 
> 
> <g id="6b0e597d-917e-4534-bb96-178a151a146c" cursor="pointer" 
> transform="scale(1.00,-1.00)" stroke-linejoin="round" 
stroke-linecap="round">
> <desc>0LHT026VE</desc>
> <text style="text-anchor:middle;font-size:2.50000pt;font-
> family:monotxt" transform="translate(0.00000,-2.50000) scale(1,-1) 
> rotate(-0.00000) scale(1.00000,1)">
> <tspan dx="0" dy="2.5" fill="rgb(0,0,0)" x="0" xml:space="preserve" 
> stroke="rgb(0,0,0)">026VE</tspan>
> </text>
> <path fill="none" d="M -2.5 -1.5 L -2.5 1.5 L 2.5 -1.5 L 2.5 1.5" 
> stroke-dasharray="1.00000,1.00000" stroke-width="0.600000" 
> stroke="rgb(0,0,0)"/>
> <path fill="none" stroke-width="0.800000" stroke-dasharray="1.00000,
> 1.00000" d="M -2.9 1.25 A 0.4 0.4 0.0 1 1 -2.1 1.25 A 0.4 0.4 0.0 1 
> 1 -2.9 1.25" stroke="rgb(0,0,0)"/>
> </g>
> 
> What we are wanting to do is to get the bounded box of the text 
> element, in this group.
> There is no problem with getting the bounded box of the whole group,
> but curiously, I can't find a way to only the "text"'s bounded box
> 
> Can someone help ?
> 
> Regards, 
> 
> Julien 
> 
> De nouvelles Emoticones sur Messenger ? Téléchargez les Emoticones 
> pâte à modeler !
> 
> 
> Envie de plus d'originalité dans vos conversations ? Téléchargez 
> gratuitement les Emoch'ticones !

Reply via email to