- java.lang.Object
-
- org.jfree.svg.StandardFontFunction
-
- All Implemented Interfaces:
java.util.function.Function<java.lang.String,java.lang.String>
public class StandardFontFunction extends java.lang.Object implements java.util.function.Function<java.lang.String,java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>alternatesA map of substitute font family names.
-
Constructor Summary
Constructors Constructor Description StandardFontFunction()Creates a new instance with mappings for the Java logical fonts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringapply(java.lang.String family)Returns the SVG font reference for the supplied (Java) font family name.java.lang.Stringget(java.lang.String family)Returns the (substitute) SVG font family name for the specified Java font family name, ornullif there is no substitute.voidput(java.lang.String family, java.lang.String substitute)Adds a substitute font family name (to be used in the SVG output) for the given Java font family name.
-
-
-
Method Detail
-
get
public java.lang.String get(java.lang.String family)
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
public void put(java.lang.String family, java.lang.String substitute)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
public java.lang.String apply(java.lang.String family)
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.- Specified by:
applyin interfacejava.util.function.Function<java.lang.String,java.lang.String>- Parameters:
family- the font family name (nullnot permitted).- Returns:
- The SVG font reference (never
null).
-
-