Package com.helger.pdflayout.spec
Class FontSpec
- java.lang.Object
-
- com.helger.pdflayout.spec.FontSpec
-
- All Implemented Interfaces:
Serializable
@NotThreadSafe @MustImplementEqualsAndHashcode public class FontSpec extends Object implements Serializable
Defines a text font specification containing the font, the font size and the text color.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ColorDEFAULT_COLORThe default font color: black
-
Constructor Summary
Constructors Constructor Description FontSpec(PreloadFont aPreloadFont, float fFontSize)Constructor with aPreloadFontand a font size, using the default colorDEFAULT_COLOR.FontSpec(PreloadFont aPreloadFont, float fFontSize, Color aColor)Constructor with aPreloadFont, a font size and a custom color.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)FontSpecgetCloneWithDifferentColor(Color aNewColor)Return a clone of this object but with a different color.FontSpecgetCloneWithDifferentFont(PreloadFont aNewFont)Return a clone of this object but with a different font.FontSpecgetCloneWithDifferentFontSize(float fNewFontSize)Return a clone of this object but with a different font size.ColorgetColor()floatgetFontSize()PreloadFontgetPreloadFont()StringgetPreloadFontID()inthashCode()StringtoString()
-
-
-
Field Detail
-
DEFAULT_COLOR
public static final Color DEFAULT_COLOR
The default font color: black
-
-
Constructor Detail
-
FontSpec
public FontSpec(@Nonnull PreloadFont aPreloadFont, @Nonnegative float fFontSize)
Constructor with aPreloadFontand a font size, using the default colorDEFAULT_COLOR.- Parameters:
aPreloadFont- Preload font to use. May not benull.fFontSize- Font size to use. Must be > 0.
-
FontSpec
public FontSpec(@Nonnull PreloadFont aPreloadFont, @Nonnegative float fFontSize, @Nonnull Color aColor)
Constructor with aPreloadFont, a font size and a custom color.- Parameters:
aPreloadFont- Preload font to use. May not benull.fFontSize- Font size to use. Must be > 0.aColor- The color to use. May not benull.
-
-
Method Detail
-
getPreloadFont
@Nonnull public final PreloadFont getPreloadFont()
- Returns:
- The font to use. Never
null.
-
getPreloadFontID
@Nonnull @Nonempty public final String getPreloadFontID()
- Returns:
- The ID of the font to use. Never
null.
-
getFontSize
@Nonnegative public final float getFontSize()
- Returns:
- The font size in points. Always > 0.
-
getCloneWithDifferentFont
@Nonnull public FontSpec getCloneWithDifferentFont(@Nonnull PreloadFont aNewFont)
Return a clone of this object but with a different font.- Parameters:
aNewFont- The new font to use. Must not benull.- Returns:
- this if the fonts are equal - a new object otherwise.
-
getCloneWithDifferentFontSize
@Nonnull public FontSpec getCloneWithDifferentFontSize(float fNewFontSize)
Return a clone of this object but with a different font size.- Parameters:
fNewFontSize- The new font size to use. Must be > 0.- Returns:
- this if the font sizes are equal - a new object otherwise.
-
getCloneWithDifferentColor
@Nonnull public FontSpec getCloneWithDifferentColor(@Nonnull Color aNewColor)
Return a clone of this object but with a different color.- Parameters:
aNewColor- The new color to use. May not benull.- Returns:
- this if the colors are equal - a new object otherwise.
-
-