Hans Stoessel wrote:

Hi

I think I have found the right file. But how can I implement this?

I use the jar files from Batik to use the classes from Batik. How can I
overwrite a class or method from a class in Batik?

You need to do what they do in the PDF transcoder and replace the bridge class for text in the BridgeContext with the PDFTextBridge:

PDFTextElementBridge pdfTextElementBridge;
pdfTextElementBridge = new PDFTextElementBridge(graphics.getFontInfo());
ctx.putBridge(pdfTextElementBridge);


    You will likely need to modify the PDFTextBridge since you don't
the font info, but the part about drawing with drawString should
be mostly the same.

I use the following code to convert from SVG to WMF:

  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();
    GraphicsNode   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;
   }

I don't know how to solve my problem. Maybe you can give me a tip. Thanks.

Regards
Hans




-----Ursprungliche Nachricht-----
Von: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 4. Marz 2004 16:39
An: Batik Users
Betreff: Re: AW: Rendering text in SVG


Hans Stoessel wrote:



The problem is that you can't edit the text in PowerPoint f.e.

if it isn't a


text object. And so it should be a text object...

- Whats about this 'hack' in FOP? Where can I find that?

Check out http://xml.apache.org/fop


   The hack lives in src/java/org/apache/fop/svg.  It is the
replacement text bridge.


- Is it possible to use drawString instead of drawGlyphVector?

Maybe if I


use an own class to draw my SVG text derived from SVGGraphics2D? In this
derived class I would replace drawGlyphVector with drawString...

This is essentially what the FOP hack does.



Thanks for the help
Hans





-----Ursprungliche Nachricht-----
Von: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 4. Marz 2004 14:02
An: Batik Users
Betreff: Re: Rendering text in SVG


Hi Hans,


Hans Stoessel wrote:



I convert a SVG in a WMF document using the WMFWriter from Piet

Jonas and



Batik 1.5.

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>

It is drawn with Graphics2D.drawGlyphVector.




- Will the text be written with Graphics2D.drawString form the Batik
library?

No draw string isn't nearly powerful enough to handle SVG text.




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?

The PDFTranscoder from the FOP project has a 'hack' so very simple text is drawn using 'drawString'. You might look into using that.



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






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




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






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



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



Reply via email to