xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hervé Girod <herve.gi...@club-internet.fr>
Subject Retriveing TextNodes Characteristics
Date Fri, 13 Jun 2003 01:10:03 GMT
Hello,

I'm currently trying to use Batik with an EMFGraphics2D (coming from FreeHep package) in order
to generate a windows Metafile corresponding with a SVG document.

In fact, I have developped a new transcoder, which inherits from the SVGAbstractTranscoder
class.

The main method i use iterates in the GVT Tree (using GVTTreeWalker), beginning by the root
GraphicsNode. For each node in the iteration, I set the AffineTransform of this node, and
then I paint using the appropriate painter. By example :
    if (node instanceof ShapeNode) {
        ShapePainter painter = ((ShapeNode)node).getShapePainter();
        if (painter != null) painter.paint(graphics2d);
  ...
My problem is that I would like to paint the TextNodes I encounter, not by using Batik default
TextPainters, but by directly drawing the associated String in the EMFGraphics2D - with the
classic drawString method (if I use a default TextPainter, texts are represented by bits of
lines, but I want to obtain vector EMF text instead) : and although I'm able to retrieve the
GVTFont (and its proper size), I'm not able to retrieve the text color in a TextNode =>

Example :
        java.util.List runlist = node.getTextRuns();
        Iterator it = runlist.iterator();
        while (it.hasNext()) {
            StrokingTextPainter.TextRun run = (StrokingTextPainter.TextRun)(it.next());
            AttributedCharacterIterator aci = run.getACI();
            aci.first();            
            Paint paint = (Paint)aci.getAttribute(STROKE_PAINT); <= always null !!

I'm surely completely forgetting something basic, but what ?...

Thanks !

Mime
View raw message