Hello !
 
Thank you for your advice, my "proprietary" font conversion is now working.
 
By the way, I encountered a minor problem when generating a SVG file out of a DOM tree, coming from the org.apache.batik.svgen.XmlWriter class :
 
I embed my fonts in the SVG file, but as some characters are not in the ASCII range, I use Unicode definition as in the fontArabic.svg sample. However, when I write the corresponding DOM document to a File, the Unicode hexadecimal definition "&#x..." is converted to a String.
 
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 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 !
 
----- Original Message -----
From: "Thomas DeWeese" <[EMAIL PROTECTED]>
To: <[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]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to