java.lang.Object
org.jfree.svg.StandardFontFunction
public class StandardFontFunction extends Object implements Function<String,String>
The standard function used in JFreeSVG to create font references for the
SVG output. This implementation will substitute SVG generic font names
for the Java logical fonts. Methods are provided for adding more font
substitutions if you require them. This function will also surround the
font name with single-quotes, which addresses issue #27.
- Since:
- 5.0
-
Constructor Summary
Constructors Constructor Description StandardFontFunction()Creates a new instance with mappings for the Java logical fonts. -
Method Summary
Modifier and Type Method Description Stringapply(String family)Returns the SVG font reference for the supplied (Java) font family name.Stringget(String family)Returns the (substitute) SVG font family name for the specified Java font family name, ornullif there is no substitute.voidput(String family, String substitute)Adds a substitute font family name (to be used in the SVG output) for the given Java font family name.
-
Constructor Details
-
StandardFontFunction
public StandardFontFunction()Creates a new instance with mappings for the Java logical fonts.
-
-
Method Details
-
get
Returns the (substitute) SVG font family name for the specified Java font family name, ornullif there is no substitute.- Parameters:
family- the Java font family name (nullnot permitted).- Returns:
- The substitute SVG font family name, or
null.
-
put
Adds a substitute font family name (to be used in the SVG output) for the given Java font family name. If the specified alternate isnullit has the effect of clearing any existing substitution.- Parameters:
family- the Java font family name (nullnot permitted).substitute- the font family name to substitute in the SVG output (nullpermitted).
-
apply
Returns the SVG font reference for the supplied (Java) font family name. This implementation provides substitute names for the Java logical fonts. Other Java font family names are not changed, but all font family names are surrounded in single quotes for the SVG output.
-