(unknown)
Eugene Ogryzlo <[email protected]> Tue, 26 Feb 2013 10:44:25 +0200
| Newsgroups | gmane.text.xml.batik.user |
|---|---|
| Message-ID | <CAHJh-v492g7EhKR5CLa+xy0MM_pEmKorvmL1BVhMnPa=F8yumg@mail.gmail.com> |
Hi, I need to paint caret for editing text on JSVGCanvas. I haven't found method getCaretShape() in batik, so I'm using java.awt.font.TextLayout. It is how I do it: // family, style, size I get from DOM Font font = new Font(family, style, size); TextLayout textLayout = new TextLayout(text, font, new FontRenderContext(new AffineTransform(), true, false)); // Mark is calculated correctly by TextPainter.selectAt Shape caret = textLayout.getCaretShapes(mark.getCharIndex())[0]; // x and y are textnode's coordinates AffineTransform at = new AffineTransform(); at.translate(x, y); caret = at.createTransformedShape(shape); Caret is calculated incorrectly. It has some error. I'm sure batik has another solution. How can I solve this problem?