Thanks for the reply.

In the meantime I have installed the fonts, listFonts() does indeed
perform as required :o), and still see the same issue.

I have a test case which generates 500 PNGs from an SVG file.

The font (Arial) is now present in all exports, skewed or un-skewed.

If the SVG file does not incorporate any baseline-shift attributes
applied to text elements, then the PNGs are rendered correctly 500
times.

If the SVG file incorporates any baseline-shift attributes applied to
text elements, then the PNGs are rendered correctly for a number of
times and then the remainder of the 500 incorporate skewed text (IE the
baseline-shift attribute is not applied in the PNG). The number of
successful exports varies, (but may be related to the size of the
initial SVG, not sure). It's typically around 5 to 15.

All other attributes are recognized and correct, only baseline-shift
seems to cause this. Only text elements are affected.

This is not currently reproducible on my laptop (Windows XP). It occurs
only in a SunOS environment (I am unable to test if it is consistent in
differing installations of Sun OS).

I include my central PNG export method here, if anyone cares to look.
Extremely puzzled by this!

We are now implementing a work-around by ditching the baseline-shift
attribute and applying the value of baseline-shift to the Y of the text
element.

Thanks as ever,

Dylan.

        /**
         * Method to write an SVG input file into a given image type
         * 
         * @param width The width
         * @param height The height
         * @param inputFileName The input filename
         * @param outputFileName The output filename. The output will be
the current working directory
         */
        public synchronized void svgFileToImage(Float width, Float
height, String inputFileName, String outputFileName) {
                OutputStream ostream = null;
                TranscoderOutput output = null;
                InputStream fis = null;
                ByteArrayOutputStream imageOutputStream = null;
                FileOutputStream fos = null;
                String mimeType = ("image/" + imageType).toLowerCase();

                Long currentDate;
                Long lastDate;
                Long duration;

                // Create the transcoder
                ImageTranscoder t = null;
                if (mimeType.equalsIgnoreCase("image/jpeg")) {
                        t = new JPEGTranscoder();
                        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
new Float(1.0));
                } else if (mimeType.equalsIgnoreCase("image/png")) {
                        t = new PNGTranscoder();
                } else {
                        System.out.println("ERROR: A request to stream
an image was recieved with an unsupported mime type: " + mimeType);
                }

                // Set the width and height
                t.addTranscodingHint(ImageTranscoder.KEY_WIDTH, width);
                t.addTranscodingHint(ImageTranscoder.KEY_HEIGHT,
height);
                // Set the background to white
        
t.addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR, Color.white);

                byte[] imageBytes = null;
                try {
                        // Open the svg file on the hard disk
                        fis = new FileInputStream(new
File(this.currentDirectory + RESOURCE_ROOT + INPUT_ROOT +
inputFileName));
                        lastDate = new Date().getTime();
                        TranscoderInput input = new
TranscoderInput(fis);
                        ostream = new ByteArrayOutputStream();
                        output = new TranscoderOutput(ostream);
                        t.transcode(input, output);
                        imageOutputStream = ((ByteArrayOutputStream)
output.getOutputStream());
                        imageBytes = imageOutputStream.toByteArray();
                        currentDate = new Date().getTime();
                        duration = currentDate - lastDate;
                        System.out.println("Transcoder duration: " +
duration + " ms");
                } catch (Exception e) {
                        e.printStackTrace();
                } finally {
                        try {
                                fis.close();
                                ostream.flush();
                                ostream.close();
                                imageOutputStream.flush();
                                imageOutputStream.close();
                        } catch (Exception e) {
                                System.out.println("Error in transcoder
stream because " + e.getMessage());
                        }
                }

                try {
                        // Write to file
                        File outputImageFile = new
File(this.currentDirectory + RESOURCE_ROOT + OUTPUT_ROOT +
outputFileName + "." + imageType);
                        fos = new FileOutputStream(outputImageFile);
                        fos.write(imageBytes);
                } catch (Exception e) {
                        e.printStackTrace();
                } finally {
                        try {
                                fos.flush();
                                fos.close();
                        } catch (Exception e) {
                                System.out.println("Error in closing
stream when writing out image because " + e.getMessage());
                        }
                }
        }

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

Reply via email to