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: