Package org.apache.fop.fonts
Class Typeface
- java.lang.Object
-
- org.apache.fop.fonts.Typeface
-
- All Implemented Interfaces:
FontMetrics
- Direct Known Subclasses:
AFPFont
,Base14Font
,CustomFont
,CustomFontMetricsMapper
,LazyFont
,SystemFontMetricsMapper
public abstract class Typeface extends java.lang.Object implements FontMetrics
Base class for font classes
-
-
Field Summary
Fields Modifier and Type Field Description private long
charMapOps
Used to identify whether a font has been used (a character map operation is used as the trigger).protected FontEventListener
eventListener
An optional event listener that receives events such as missing glyphs etc.private static org.apache.commons.logging.Log
log
loggerstatic char
NOT_FOUND
Code point that is used if no code point for a specific character has been found.private java.util.Set<java.lang.Character>
warnedChars
-
Constructor Summary
Constructors Constructor Description Typeface()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String
getEncodingName()
Get the encoding of the font.int
getMaxAscent(int size)
Returns the maximum ascent of the font described by this FontMetrics object.boolean
hadMappingOperations()
Indicates whether this font had to do any character mapping operations.abstract boolean
hasChar(char c)
Determines whether this font contains a particular character/glyph.boolean
hasFeature(int tableType, java.lang.String script, java.lang.String language, java.lang.String feature)
Determine if metrics supports specific feature in specified font table.boolean
isCID()
boolean
isMultiByte()
Determines whether the font is a multibyte font.abstract char
mapChar(char c)
Map a Unicode character to a code point in the font.protected void
notifyMapOperation()
Used for keeping track of character mapping operations in order to determine if a font was used at all or not.void
setEventListener(FontEventListener listener)
Sets the font event listener that can be used to receive events about particular events in this class.java.lang.String
toString()
protected void
warnMissingGlyph(char c)
Provide proper warning if a glyph is not available.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.fop.fonts.FontMetrics
getAscender, getBoundingBox, getCapHeight, getDescender, getEmbedFontName, getFamilyNames, getFontName, getFontType, getFontURI, getFullName, getKerningInfo, getStrikeoutPosition, getStrikeoutThickness, getUnderlinePosition, getUnderlineThickness, getWidth, getWidths, getXHeight, hasKerningInfo
-
-
-
-
Field Detail
-
NOT_FOUND
public static final char NOT_FOUND
Code point that is used if no code point for a specific character has been found.- See Also:
- Constant Field Values
-
log
private static org.apache.commons.logging.Log log
logger
-
charMapOps
private long charMapOps
Used to identify whether a font has been used (a character map operation is used as the trigger). This could just as well be a boolean but is a long out of statistical interest.
-
eventListener
protected FontEventListener eventListener
An optional event listener that receives events such as missing glyphs etc.
-
warnedChars
private java.util.Set<java.lang.Character> warnedChars
-
-
Method Detail
-
getEncodingName
public abstract java.lang.String getEncodingName()
Get the encoding of the font.- Returns:
- the encoding
-
mapChar
public abstract char mapChar(char c)
Map a Unicode character to a code point in the font.- Parameters:
c
- character to map- Returns:
- the mapped character
-
notifyMapOperation
protected void notifyMapOperation()
Used for keeping track of character mapping operations in order to determine if a font was used at all or not.
-
hadMappingOperations
public boolean hadMappingOperations()
Indicates whether this font had to do any character mapping operations. If that was not the case, it's an indication that the font has never actually been used.- Returns:
- true if the font had to do any character mapping operations
-
hasChar
public abstract boolean hasChar(char c)
Determines whether this font contains a particular character/glyph.- Parameters:
c
- character to check- Returns:
- True if the character is supported, Falso otherwise
-
isMultiByte
public boolean isMultiByte()
Determines whether the font is a multibyte font.- Specified by:
isMultiByte
in interfaceFontMetrics
- Returns:
- True if it is multibyte
-
isCID
public boolean isCID()
-
getMaxAscent
public int getMaxAscent(int size)
Returns the maximum ascent of the font described by this FontMetrics object. Note: This is not the same as getAscender().- Specified by:
getMaxAscent
in interfaceFontMetrics
- Parameters:
size
- font size- Returns:
- ascent in milliponts
-
hasFeature
public boolean hasFeature(int tableType, java.lang.String script, java.lang.String language, java.lang.String feature)
Determine if metrics supports specific feature in specified font table.- Specified by:
hasFeature
in interfaceFontMetrics
- Parameters:
tableType
- type of table (GSUB, GPOS, ...), see GlyphTable.GLYPH_TABLE_TYPE_*script
- to qualify feature lookuplanguage
- to qualify feature lookupfeature
- to test- Returns:
- true if feature supported (and has at least one lookup)
-
setEventListener
public void setEventListener(FontEventListener listener)
Sets the font event listener that can be used to receive events about particular events in this class.- Parameters:
listener
- the font event listener
-
warnMissingGlyph
protected void warnMissingGlyph(char c)
Provide proper warning if a glyph is not available.- Parameters:
c
- the character which is missing.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-