Hello !
 
I think I have found two bugs in the "transcoder.wmf.tosvg" package  package (last version Batik 1.5).
 
All my examples can be reproduced with the attached WMF file (generated by PPT, on WINDOWS Me).
 
1) First problem :
 
When transcoding from a WMF file to SVG, the viewport size is correct but there is nothing in it. After checking for the reason of this problem, I found that some of the records are not read. In fact, the last record has a false size (very big), because two bytes are not read at the end of the record in WMFRecordStore for the META_CREATEPENINDIRECT case :
 
           case WMFConstants.META_CREATEPENINDIRECT:
                {
                    ...
                    /** PATCH HGIROD
                     * change from Short to Int

                     **/
                    // int height = readshort( is );
                   
int height = readInt( is );
 
After changing readShort by readInt, no records are forgotten.
 
1) Second problem :
 
There is sometimes a null pointer exception in SVGGeneratorContext (for my example, it is when trying to paint the Ellipse), in the doubleString method.
 
The reason of this problem is that the WMFTranscoder class doesn't set the Precision parameter (DecimalFormat) of the context (this problem wasn't there in previous Batik versions, because the conversion didn't use this parameter).
 
It is easy to fix this problem by setting this precision explicitly in the WMFTranscoder class after creating the SVGGraphics2D object :
 
        SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
        /** PATCH H GIROD
         ** otherwise Ellipses aren't working (for example) (because of Decimal format
         * modifications ins SVGGenerator Context)
         */
        svgGenerator.getGeneratorContext().setPrecision(4);
 
But may be a new transcoding hint key could be used in this case (and may be it exists, I haven't checked it, although in that case it is not used by the WMFTranscoder class).
 
Hervé Girod
 
 
 

Attachment: test.wmf
Description: Binary data

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

Reply via email to