Package org.apache.fop.fo.properties
Class CommonFont
- java.lang.Object
-
- org.apache.fop.fo.properties.CommonFont
-
public final class CommonFont extends java.lang.Object
Collection of CommonFont properties
-
-
Field Summary
Fields Modifier and Type Field Description private static PropertyCache<CommonFont>
CACHE
cache holding canonical CommonFont instances (only those with absolute font-size and font-size-adjust)private FontFamilyProperty
fontFamily
The "font-family" property.private EnumProperty
fontSelectionStrategy
The "font-selection-strategy" property.Length
fontSize
The "font-size" property.Numeric
fontSizeAdjust
The "font-size-adjust" property.private EnumProperty
fontStretch
The "font-stretch" property.private EnumProperty
fontStyle
The "font-style" property.private EnumProperty
fontVariant
The "font-variant" property.private EnumProperty
fontWeight
The "font-weight" property.private int
hash
hashcode of this instance
-
Constructor Summary
Constructors Modifier Constructor Description private
CommonFont(FontFamilyProperty fontFamily, EnumProperty fontSelectionStrategy, EnumProperty fontStretch, EnumProperty fontStyle, EnumProperty fontVariant, EnumProperty fontWeight, Length fontSize, Numeric fontSizeAdjust)
Construct a CommonFont instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getFirstFontFamily()
private java.lang.String[]
getFontFamily()
int
getFontSelectionStrategy()
Length
getFontSize()
Numeric
getFontSizeAdjust()
FontTriplet[]
getFontState(FontInfo fontInfo)
Create and return an array ofFontTriplets
based on the properties stored in the instance variables.int
getFontStretch()
int
getFontStyle()
int
getFontVariant()
int
getFontWeight()
static CommonFont
getInstance(PropertyList pList)
Returns a CommonFont instance for the given PropertyList If the font-size and font-size-adjust properties are absolute the entire instance will be cached.int
hashCode()
-
-
-
Field Detail
-
CACHE
private static final PropertyCache<CommonFont> CACHE
cache holding canonical CommonFont instances (only those with absolute font-size and font-size-adjust)
-
hash
private int hash
hashcode of this instance
-
fontFamily
private final FontFamilyProperty fontFamily
The "font-family" property.
-
fontSelectionStrategy
private final EnumProperty fontSelectionStrategy
The "font-selection-strategy" property.
-
fontStretch
private final EnumProperty fontStretch
The "font-stretch" property.
-
fontStyle
private final EnumProperty fontStyle
The "font-style" property.
-
fontVariant
private final EnumProperty fontVariant
The "font-variant" property.
-
fontWeight
private final EnumProperty fontWeight
The "font-weight" property.
-
fontSize
public final Length fontSize
The "font-size" property.
-
fontSizeAdjust
public final Numeric fontSizeAdjust
The "font-size-adjust" property.
-
-
Constructor Detail
-
CommonFont
private CommonFont(FontFamilyProperty fontFamily, EnumProperty fontSelectionStrategy, EnumProperty fontStretch, EnumProperty fontStyle, EnumProperty fontVariant, EnumProperty fontWeight, Length fontSize, Numeric fontSizeAdjust)
Construct a CommonFont instance- Parameters:
fontFamily
- the font-family propertyfontSelectionStrategy
- the font-selection-strategy propertyfontStretch
- the font-stretch propertyfontStyle
- the font-style propertyfontVariant
- the font-variant propertyfontWeight
- the font-weight propertyfontSize
- the font-size (possibly non-cached)fontSizeAdjust
- the font-size-adjust (possibly non-cached)
-
-
Method Detail
-
getInstance
public static CommonFont getInstance(PropertyList pList) throws PropertyException
Returns a CommonFont instance for the given PropertyList If the font-size and font-size-adjust properties are absolute the entire instance will be cached. If not, then a distinct instance will be returned, with as much cached information as possible.- Parameters:
pList
- the PropertyList to get the properties from- Returns:
- a CommonFont instance corresponding to the properties
- Throws:
PropertyException
- if there was a problem getting the properties
-
getFontFamily
private java.lang.String[] getFontFamily()
- Returns:
- an array with the font-family names
-
getFirstFontFamily
public java.lang.String getFirstFontFamily()
- Returns:
- the first font-family name in the list
-
getFontSelectionStrategy
public int getFontSelectionStrategy()
- Returns:
- the "font-selection-strategy" property
-
getFontStretch
public int getFontStretch()
- Returns:
- the "font-stretch" property
-
getFontStyle
public int getFontStyle()
- Returns:
- the "font-style" property
-
getFontVariant
public int getFontVariant()
- Returns:
- the "font-variant" property
-
getFontWeight
public int getFontWeight()
- Returns:
- the "font-weight" property
-
getFontSize
public Length getFontSize()
- Returns:
- the "font-size" property.
-
getFontSizeAdjust
public Numeric getFontSizeAdjust()
- Returns:
- the "font-size-adjust" property.
-
getFontState
public FontTriplet[] getFontState(FontInfo fontInfo)
Create and return an array ofFontTriplets
based on the properties stored in the instance variables.- Parameters:
fontInfo
- a font info object- Returns:
- a font triplet
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-