Package generic.theme
Class FontModifier
java.lang.Object
generic.theme.FontModifier
Class that can transform one font into another. For example if want a font that is the same
basic font as some other font, but is just a different size,style, or family, you use a
FontModifier
-
Constructor Summary
ConstructorsConstructorDescriptionFontModifier(String family, Integer style, Integer size) Creates a new FontModifier that can change a given font by one or more font properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFamilyModifier(String newFamily) Sets the family for modifying a fontvoidaddSizeModfier(int newSize) Sets the font size modifiervoidaddStyleModifier(int newStyle) Sets the font style modifier.Returns a string that can be parsed by theparse(String)method of this classReturns a modified font for the given font.static FontModifierParses the given string as one or more font modifierstoString()
-
Constructor Details
-
FontModifier
Creates a new FontModifier that can change a given font by one or more font properties.- Parameters:
family- if non-null, modifies a font to use this familystyle- if non-null, modifies a font to use this stylesize- if non-null, modifies a font to be this size
-
-
Method Details
-
addFamilyModifier
Sets the family for modifying a font- Parameters:
newFamily- the font family to use when modifying fonts
-
addSizeModfier
public void addSizeModfier(int newSize) Sets the font size modifier- Parameters:
newSize- the size to use when modifying fonts
-
addStyleModifier
public void addStyleModifier(int newStyle) Sets the font style modifier. This can be called multiple times to bold and italicize.- Parameters:
newStyle- the style to use for the font.
-
modify
Returns a modified font for the given font.- Parameters:
font- the font to be modified- Returns:
- a new modified font
-
getSerializationString
Returns a string that can be parsed by theparse(String)method of this class- Returns:
- a string that can be parsed by the
parse(String)method of this class
-
toString
-
parse
Parses the given string as one or more font modifiers- Parameters:
value- the string to parse as modifiers- Returns:
- a FontModifier as specified by the given string
- Throws:
ParseException- if The value can't be parsed
-