OS: Windows 2000
JDK: 1.4.1
Batik: 1.5.0

Hi

I convert a SVG in a WMF document using the WMFWriter from Piet Jonas and
Batik 1.5.

To convert the format I use the following code:

public boolean saveAsWMF() {
  boolean          bOK = true;
  FileOutputStream oStream = null;
  SVGDocument      svgDoc = null;
  BridgeContext    ctx = null;
  UserAgent        userAgent = new UserAgentAdapter();
  DocumentLoader   loader = new DocumentLoader(userAgent);
  GVTBuilder       builder = new GVTBuilder();
  raphicsNode      gvtRoot = null;

  try {
    ctx = new BridgeContext(userAgent, loader);
    ctx.setDynamic(true);
    svgDoc = (SVGDocument) loader.loadDocument("C:\\Temp\\Test.svg");
    gvtRoot = builder.build(ctx, svgDoc);

    WMF wmf = new WMF();
    WMFGraphics2D wmfGenerator = new WMFGraphics2D(wmf, 300, 200);
    wmfGenerator.setGDIPenDrawing(false);

    oStream = new FileOutputStream(new File("C:\\Temp\\Test.wmf"));
    gvtRoot.paint(wmfGenerator);
    wmf.writePlaceableWMF(oStream, 0, 0, 300, 200, 72);
    oStream.close();
  }
  catch (FileNotFoundException e) {
    bOK = false;
  }
  catch (IOException e) {
    bOK = false;
  }
  return bOK;
}

Now I have problems with the text rendering. The rendered text in the WMF
file is not a text object. It is graphic and the result on the screen is
really bad.

- How is the text in the following SVG row rendered?
            <text x="11.1230469" y="387.1083984" style="stroke:none;"
xml:space="preserve">0</text>

- Will the text be written with Graphics2D.drawString form the Batik
library? Or is another Graphics2D method used? The developer of the WMF
library says, the Graphics2D methods of his library will be used instead of
the Graphics2D methods from Batik. And if the Batik library use drawString
the result would be OK.

- Can I do something, that the text will be drawn with
Graphics2D.drawString?

Thanks for the help.

Regards
Hans

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to