org.apache.batik.svggen

Class SVGFont

public class SVGFont extends AbstractSVGConverter

Utility class that converts a Font object into a set of SVG font attributes
Field Summary
static floatBOLD
static floatDEMIBOLD
static floatDEMILIGHT
static floatEXTRABOLD
static floatEXTRA_LIGHT
static floatHEAVY
static floatLIGHT
static floatMEDIUM
static floatPOSTURE_OBLIQUE
static floatPOSTURE_REGULAR
static floatREGULAR
static floatSEMIBOLD
static floatULTRABOLD
Constructor Summary
SVGFont(SVGGeneratorContext generatorContext)
Method Summary
static StringfamilyToSVG(Font font)
voidrecordFontUsage(String string, Font font)
Records that the specified font has been used to draw the text string.
static StringstyleToSVG(Font font)
SVGDescriptortoSVG(GraphicContext gc)
Converts part or all of the input GraphicContext into a set of attribute/value pairs and related definitions
SVGFontDescriptortoSVG(Font font, FontRenderContext frc)
static StringweightToSVG(Font font)

Field Detail

BOLD

public static final float BOLD

DEMIBOLD

public static final float DEMIBOLD

DEMILIGHT

public static final float DEMILIGHT

EXTRABOLD

public static final float EXTRABOLD

EXTRA_LIGHT

public static final float EXTRA_LIGHT

HEAVY

public static final float HEAVY

LIGHT

public static final float LIGHT

MEDIUM

public static final float MEDIUM

POSTURE_OBLIQUE

public static final float POSTURE_OBLIQUE

POSTURE_REGULAR

public static final float POSTURE_REGULAR

REGULAR

public static final float REGULAR

SEMIBOLD

public static final float SEMIBOLD

ULTRABOLD

public static final float ULTRABOLD

Constructor Detail

SVGFont

public SVGFont(SVGGeneratorContext generatorContext)

Parameters: generatorContext used to build Elements

Method Detail

familyToSVG

public static String familyToSVG(Font font)

Parameters: font whose family should be converted to an SVG string value.

recordFontUsage

public void recordFontUsage(String string, Font font)
Records that the specified font has been used to draw the text string. This is so we can keep track of which glyphs are required for each SVG font that is generated.

styleToSVG

public static String styleToSVG(Font font)

Parameters: font whose style should be converted to an SVG string value.

toSVG

public SVGDescriptor toSVG(GraphicContext gc)
Converts part or all of the input GraphicContext into a set of attribute/value pairs and related definitions

Parameters: gc GraphicContext to be converted

Returns: descriptor of the attributes required to represent some or all of the GraphicContext state, along with the related definitions

See Also: SVGDescriptor

toSVG

public SVGFontDescriptor toSVG(Font font, FontRenderContext frc)

Parameters: font Font object which should be converted to a set of SVG attributes frc The FontRenderContext which will be used to generate glyph elements for the SVGFont definition element

Returns: description of attribute values that describe the font

weightToSVG

public static String weightToSVG(Font font)

Parameters: font whose weight should be converted to an SVG string value. Note that there is loss of precision for semibold and extrabold.

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.