|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.heml.image.text.SvgFontEmbedder
public class SvgFontEmbedder
Uses the Batik SVGGraphics2D environment to produce an svg:defs element
containing the smallest necessary font and glyph definitions. Call
registerFont(text, fontName) for each svg:text element in the document,
then get the defs with the getEmbeddedFonts() method The
web/xslt/util/svgEmbedFonts.xsl file from the Heml project
(http://www.heml.org) illustrates how to use this code within a Xalan
xslt envrionment to embed fonts in arbitrary SVG documents.
This code has been tested with Batik's 1.5b2 and 1.5b4 releases. Future releases may well
place the necessary svg:def element in a different place. This would require
a rewrite of this class' registerFont() method.
This class works in the following way. Each call to registerFont() draws a bogus text string on a Batik SVGGraphics2D environment which has been
set to use embedded fonts. The getEmbeddedFonts() method copies the svg:def element to which Batik writes its font definitions
| Constructor Summary | |
|---|---|
SvgFontEmbedder()
|
|
| Method Summary | |
|---|---|
Element |
getEmbeddedFonts()
|
static void |
main(String[] args)
A test of this class. |
void |
registerFont(String text,
String fontName)
Indicates the use of fontName on the string
text |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SvgFontEmbedder()
| Method Detail |
|---|
public void registerFont(String text,
String fontName)
fontName on the string
text
text - the String that will be displayedfontName - the name of the font that will display the textpublic Element getEmbeddedFonts()
svg:defs element containing the fonts and
glyphs necessary to display the texts which have been
specified through sucessive calls to fontNamepublic static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||