Good day!
 
I have a problem synchronizing text in Java Swing text components (JTextPane) with the the text in SVG document.
My text component is positioned on the top of JSVCanvas and the idea is to allow user edit text and then copy it to SVGDocument to be rendered. The problem is that text kerning in Java components and SVG is different. When text inserted to SVGDocument using SVG text element it has position and height like in JTextPane (after User-space to SVG-space transform), but distance between characters is different. Does anyone know how add text to SVG document exactly how it appears in Java (JTextPane or JTextField) component?
 
I tried:
* Disable kerning in SVG and position each glyph individually using Java GlyphVector and SVG <text x="..." y="...">. Doesn't work.
* Use AWTGVTFont to create GVTGlyphVector and get glyph positions Batik. Doesn't work, all glyph info is null in AWTGVTFont, probably it can't be used individually.
* Create text graphics node to let it render text in custom java component. I created own SVGOMText element and when I try to convert it to text graphics node using GVTBuilder it throws exception telling that visibility info can't be converted. It seems to work only in document context.
 
Thank you!

Reply via email to