SVG Font Converter


If you want your SVG documents to be as portable as possible, you’ll run into the issue of fonts. If you’re going to generate SVG documents that will be displayed in an environment where the fonts in the document aren’t available, you must embed the font characters you use in the SVG document. Batik provides the ttf2svg application to help you to do this. You run ttf2svg by executing

java –jar batik-ttf2svg.jar <ttf-path> [options]

The jar file batik-ttf2svg.jar must be in the current directory for this command to work. If it isn’t, then you need to supply the full path to the jar file.

ttf2svg takes several options:

  • -l <range-begin>—Specifies the low value of the range of characters to be converted.

  • -h <range-end>—Specifies the high value of the range of characters to be converted.

  • -ascii—Forces usage of the ASCII character map.

  • -id <id>—Attaches an emphasis">id>" attribute to the generated <font> element.

  • -o <output file>—Specifies the destination file for the SVG font information. If this is omitted, output goes to the standard output.

  • -testcard—Generates an SVG <text> element that uses the characters in the font as a test for the conversion.

Here’s the test card generated by converting the Windows Arial font:

click to expand




Professional XML Development with Apache Tools. Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice (Wrox Professional Guides)
ISBN: 0764543555
EAN: 2147483647
Year: 2003
Pages: 95

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net