Package org.apache.fontbox.cff
Class CFFFont
- java.lang.Object
-
- org.apache.fontbox.cff.CFFFont
-
- All Implemented Interfaces:
FontBoxFont
- Direct Known Subclasses:
CFFCIDFont,CFFType1Font
public abstract class CFFFont extends java.lang.Object implements FontBoxFont
An Adobe Compact Font Format (CFF) font. Thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description private CFFCharsetcharsetprotected byte[][]charStringsprivate java.lang.StringfontNameprotected byte[][]globalSubrIndexprivate CFFParser.ByteSourcesourceprotected java.util.Map<java.lang.String,java.lang.Object>topDict
-
Constructor Summary
Constructors Constructor Description CFFFont()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddValueToTopDict(java.lang.String name, java.lang.Object value)Adds the given key/value pair to the top dictionary.CFFCharsetgetCharset()Returns the CFFCharset of the font.java.util.List<byte[]>getCharStringBytes()Returns the character strings dictionary.byte[]getData()Returns the CFF data.BoundingBoxgetFontBBox()Returns the FontBBox.java.util.List<java.lang.Number>getFontMatrix()Returns the FontMatrix.java.util.List<byte[]>getGlobalSubrIndex()Returns the list containing the global subroutines.java.lang.StringgetName()The name of the font.intgetNumCharStrings()Returns the number of charstrings in the font.java.util.Map<java.lang.String,java.lang.Object>getTopDict()Returns the top dictionary.abstract Type2CharStringgetType2CharString(int cidOrGid)Returns the Type 2 charstring for the given CID.(package private) voidsetCharset(CFFCharset charset)Sets the CFFCharset of the font.(package private) voidsetData(CFFParser.ByteSource source)Sets a byte source to re-read the CFF data in the future.(package private) voidsetGlobalSubrIndex(byte[][] globalSubrIndexValue)Sets the global subroutine index data.(package private) voidsetName(java.lang.String name)Sets the name of the font.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.fontbox.FontBoxFont
getPath, getWidth, hasGlyph
-
-
-
-
Field Detail
-
fontName
private java.lang.String fontName
-
charset
private CFFCharset charset
-
source
private CFFParser.ByteSource source
-
topDict
protected final java.util.Map<java.lang.String,java.lang.Object> topDict
-
charStrings
protected byte[][] charStrings
-
globalSubrIndex
protected byte[][] globalSubrIndex
-
-
Method Detail
-
getName
public java.lang.String getName()
The name of the font.- Specified by:
getNamein interfaceFontBoxFont- Returns:
- the name of the font
-
setName
void setName(java.lang.String name)
Sets the name of the font.- Parameters:
name- the name of the font
-
addValueToTopDict
public void addValueToTopDict(java.lang.String name, java.lang.Object value)Adds the given key/value pair to the top dictionary.- Parameters:
name- the given keyvalue- the given value
-
getTopDict
public java.util.Map<java.lang.String,java.lang.Object> getTopDict()
Returns the top dictionary.- Returns:
- the dictionary
-
getFontMatrix
public java.util.List<java.lang.Number> getFontMatrix()
Returns the FontMatrix.- Specified by:
getFontMatrixin interfaceFontBoxFont- Returns:
- the font matrix
-
getFontBBox
public BoundingBox getFontBBox() throws java.io.IOException
Returns the FontBBox.- Specified by:
getFontBBoxin interfaceFontBoxFont- Returns:
- the bounding box of the font
- Throws:
java.io.IOException- if there are less than 4 numbers
-
getCharset
public CFFCharset getCharset()
Returns the CFFCharset of the font.- Returns:
- the charset
-
setCharset
void setCharset(CFFCharset charset)
Sets the CFFCharset of the font.- Parameters:
charset- the given CFFCharset
-
getCharStringBytes
public final java.util.List<byte[]> getCharStringBytes()
Returns the character strings dictionary. For expert users only.- Returns:
- the character strings dictionary as a list of byte arrays.
-
setData
final void setData(CFFParser.ByteSource source)
Sets a byte source to re-read the CFF data in the future.
-
getData
public byte[] getData() throws java.io.IOExceptionReturns the CFF data.- Returns:
- the cff data as byte array
- Throws:
java.io.IOException- if the data could not be read
-
getNumCharStrings
public int getNumCharStrings()
Returns the number of charstrings in the font.- Returns:
- the number of charstrings
-
setGlobalSubrIndex
void setGlobalSubrIndex(byte[][] globalSubrIndexValue)
Sets the global subroutine index data.- Parameters:
globalSubrIndexValue- a list of the global subroutines.
-
getGlobalSubrIndex
public java.util.List<byte[]> getGlobalSubrIndex()
Returns the list containing the global subroutines.- Returns:
- a list of the global subroutines.
-
getType2CharString
public abstract Type2CharString getType2CharString(int cidOrGid) throws java.io.IOException
Returns the Type 2 charstring for the given CID.- Parameters:
cidOrGid- CID for CIFFont, or GID for Type 1 font- Returns:
- the Type2 charstring of the given cid/gid
- Throws:
java.io.IOException- if the charstring could not be read
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-