xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cgrafena <cgraf...@gmail.com>
Subject Wrong bounding box calculation when using SVG fonts
Date Thu, 10 May 2012 07:20:54 GMT
Hi guys,

I need to position multiple text elements on the canvas (ALWAYS_DYNAMIC)
dependend on their size (width and height). The text elements are using a
font-family which is NOT installed locally on my system (external SVG font
which is embedded in the <defs> section of the SVG document).

When i try to get the bounding box of a text element using

the calculated width and height is wrong (in most cases too large).

But if I position the text elements a second time (by using an upate-Button
in my application) the bounding box is correct ?

Interesting observations: wrong bounding box calculations only happens when
using embedded SVG fonts, so when i use system fonts, the bounding box is
calculated always correct immediately (without pressing the update-button

The procedure of my applications is as follows:

ActionListener on Update-Button does following:

Then remove all elements of the SVG DOM by removing all children of document
Then paintTextElements(): create SVGTextElement, add it to the SVG DOM, get
elements boundaries (code see above) and finally position it by setting
attributes "X", "Y" dependend on its boundaries.

So why is the size of the bounding box of the text element using a svg font
incorrect ? 


View this message in context: http://batik.2283329.n4.nabble.com/Wrong-bounding-box-calculation-when-using-SVG-fonts-tp4622715.html
Sent from the Batik - Users mailing list archive at Nabble.com.

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message