In fact, it is easy to keep the hexadecimal formatting by modifying the writeXml(Text text, IndentWriter out) method. For example :
...
} else if (c == '&') { // not legal in char data
out.write (data, start, last - start);
start = last + 1;
out.write ("&");
/* Code added here to convert to Hexadecimal formatting if necessary */
} else if (c > 0x00FF) {
String hex = "0000"+Integer.toHexString(c);
out.write("&#x"+hex.substring(hex.length()-4)+';');
}

I think that when the content is written these characters should be encoded using UTF-8/16 depending on the output stream. The problem is that the decision to encode with hex is a bit more complex than just is the char > 0xFF (for UTF-8 the break point is actually 0x7F).

   You may need to setup the output stream differently to get the
desired behavior.  Take a look at OutputStreamWriter.


(I did this in the previous 1.5 version of XmlWriter, but I'm pretty sure this will work in the last 1.5.1 RC2 version too).


And happy new year !

Yes, happy new year!


----- Original Message -----
From: "Thomas DeWeese" < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
To: < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
Sent: Thursday, November 06, 2003 2:45 AM
Subject: Re: Fonts use in SVGGraphics2D


Hervé Girod wrote:

> I'm currently using Batik to convert some vector graphic images in a
> proprietary format in SVG images. This format also defines vector Fonts
> in a specific way.
> > In order to convert the proprietary data, i parse the file to produce a
> Java drawing in a SVGGraphics2D graphics. All is working fine, but I
> have a problem with my Fonts. There is no SVG Font deriving from the
> Java Font class, so I'm not able to render correctly the Fonts without
> specific XML manipulations in the file.
> > My question is :
>
> * do I have to subclass the SVGGraphics2D class in order to be able
> to set and get SVGFonts, and code the specific rendering of these
> font
> * or is it better (and possible) to derive a new type of Font form
> the AWT Font class, that is for example AWTSVGFont, and use it
> like any other AWT Font ?


Hi Hervé,

    Well it would probably be best to do this. If you look there
is a class 'batik.svggen.SVGFont'  Which is actually a 'font converter'
that converts a font to SVG.  So you could create a subclass of Font
and then subclass SVGFont to recognise your special font and generate
the SVGFont definition (this would avoid the need to implement the
complete Font interface for the proprietary font).

> * or is there an alternative better solution ?





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




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



Reply via email to