Thank you very a lot for your help.
ps: > Hi Peruzzi, Peruzzi is my surname. My name is Alessandro ;-) I have another problem but i write another message with a different subject text. Alessandro Peruzzi --- In [email protected], Thomas DeWeese <[EMAIL PROTECTED]> wrote: > Hi Peruzzi, > > Peruzzi Alessandro wrote: > > > now when i calculate for example... width > > with this code: > > > > Rectangle rect = ctx.getGraphicsNode(t1).getBounds().getBounds(); > > int width = (int)(ctx.getGraphicsNode(t1).getBounds().getWidth ()); > > > > I have a different result > > rect.width no equals to width > > Why? > > This is because the position and width of the > text is calculated as a float. So given > > // The "real" float bounds > Rectangle2D r2d = ctx.getGraphicsNode(t1).getBounds(); > > double x0 = r2d.getX(); > double x1 = x0 + r2d.getWidth(); > > int intWidth = ceil(x1)-floor(x0); > > This is not the same as floor(r2d.getWidth()) > for obvious reasons. > > > How is the correct width of t1 textElement ? > > Neither the correct width of t1 is the > double precision value returned by r2d.getWidth(); > the rect.width() is a 'safe' width but may be > off by up to 2! counts. ----- 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/

