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 String
apply(String family)
Returns the SVG font reference for the supplied (Java) font family name.String
get(String family)
Returns the (substitute) SVG font family name for the specified Java font family name, ornull
if there is no substitute.void
put(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, ornull
if there is no substitute.- Parameters:
family
- the Java font family name (null
not 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 isnull
it has the effect of clearing any existing substitution.- Parameters:
family
- the Java font family name (null
not permitted).substitute
- the font family name to substitute in the SVG output (null
permitted).
-
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.
-