Hi Thomas. Bjoern pointed out to me that getExtentOfChar returns SVGRects with incorrect values. For example with this file:
<svg xmlns='http://www.w3.org/2000/svg' version='1.1'> <text font-size="50" x="50" y="50" id="t">x x</text> <script> alert(document.getElementById('t').getExtentOfChar(0).x); alert(document.getElementById('t').getExtentOfChar(1).x); alert(document.getElementById('t').getExtentOfChar(2).x); </script> </svg> the x value of the extent of the second character (the space) is 0. (In fact the returned rect is [0,0,0,0].) This seems to be because SVGTextElementBridge.getExtentOfChar gets the GVTGlyphVector from the font, which, for AWT fonts at least, gets the bounding box of the actual glyph shape. Since the space character has no shape, this empty bounding box is returned. The spec says: getExtentOfChar Returns a tightest rectangle which defines the minimum and maximum X and Y values in the user coordinate system for rendering the glyph(s) that correspond to the specified character. The calculations assume that all glyphs occupy the full standard glyph cell for the font. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs), then each of the inseparable characters will return the same extent. I think that this means it should be returning the a bounding box for the metrics of the glyph as specified in the font (e.g. the width of the returned SVGRect should be the advance of the glyph), rather than the actual shape. Do you agree? If so, we could use Font.getStringBounds for AWTGVTFonts (and look up the appropriate advance value from SVGGVTFonts). -- Cameron McCormack ICQ: 26955922 cam (at) mcc.id.au MSN: cam (at) mcc.id.au http://mcc.id.au/ JBR: heycam (at) jabber.org --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
