xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jared Davis" <jar...@davisprogramming.com>
Subject RE: Newbie: Svg -> PDF Text producing Huge Files
Date Tue, 05 Apr 2005 14:31:47 GMT
Update:

Extending PrintTranscoder to set the TextPainter to PDFTextPainter works -
sort of. The StrokingTextPainter class is still used on svg files referenced
by image tags.

Why does SVGImageElementBridge createSVGImageNode ignore the current
TextPainter?


   protected GraphicsNode createSVGImageNode(BridgeContext ctx,
                                              Element e,
                                              SVGDocument imgDocument) {
        CSSEngine eng = ((SVGOMDocument)imgDocument).getCSSEngine();
        if (eng != null) {
            subCtx = (BridgeContext)eng.getCSSContext();
        } else {
            subCtx = new BridgeContext(ctx.getUserAgent(), 
                                       ctx.getDocumentLoader());
            subCtx.setGVTBuilder(ctx.getGVTBuilder());
//
            subCtx.setTextPainter(ctx.getTextPainter());  // Added Test Code
//
            subCtx.setDocument(imgDocument);
            subCtx.initializeDocument(imgDocument);
        }

...


 public class PrintTranscoderWithRealFonts extends PrintTranscoder {
    
    /** Creates a new instance of PrintTranscoderWithRealFonts */
    public PrintTranscoderWithRealFonts() {
    }
       protected BridgeContext createBridgeContext() {
        BridgeContext ctx = new BridgeContext(userAgent);
        System.out.println("setting new font painter");
        TextPainter textPainter = null;
        
         FontInfo fontInfo = new FontInfo();
         try {
           FontSetup.setup(fontInfo);
         } catch (Exception e) {
           e.printStackTrace();
         }
         System.out.println("is setupValid " + fontInfo.isSetupValid());
        
        textPainter = new PDFTextPainter(fontInfo);
        ctx.setTextPainter(textPainter);
        
        return ctx;
    }
}



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message