Package org.apache.fontbox.cff
Class CFFFont
- java.lang.Object
-
- org.apache.fontbox.cff.CFFFont
-
- Direct Known Subclasses:
CFFFontROS
public class CFFFont extends java.lang.ObjectThis class represents a CFF/Type2 Font.- Version:
- $Revision$
- Author:
- Villu Ruusmann
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCFFFont.MappingThis class is used for the font mapping.
-
Constructor Summary
Constructors Constructor Description CFFFont()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValueToPrivateDict(java.lang.String name, java.lang.Object value)Adds the given key/value pair to the private dictionary.voidaddValueToTopDict(java.lang.String name, java.lang.Object value)Adds the given key/value pair to the top dictionary.CharStringConvertercreateConverter()Creates a CharStringConverter for this font.CharStringRenderercreateRenderer()Creates a CharStringRenderer for this font.CFFCharsetgetCharset()Returns the CFFCharset of the font.java.util.Map<java.lang.String,byte[]>getCharStringsDict()Returns the character strings dictionary.CFFEncodinggetEncoding()Returns the CFFEncoding of the font.IndexDatagetGlobalSubrIndex()Returns the global subroutine index data.IndexDatagetLocalSubrIndex()Returns the local subroutine index data.java.util.Collection<CFFFont.Mapping>getMappings()Get the mapping (code/SID/charname/bytes) for this font.java.lang.StringgetName()The name of the font.protected intgetNotDefWidth(int defaultWidth, int nominalWidth)java.util.Map<java.lang.String,java.lang.Object>getPrivateDict()Returns the private dictionary.java.lang.ObjectgetProperty(java.lang.String name)Returns the value for the given name from the dictionary.java.util.Map<java.lang.String,java.lang.Object>getTopDict()Returns the top dictionary.intgetWidth(int SID)Return the Width value of the given Glyph identifiervoidsetCharset(CFFCharset charset)Sets the CFFCharset of the font.voidsetEncoding(CFFEncoding encoding)Sets the CFFEncoding of the font.voidsetGlobalSubrIndex(IndexData globalSubrIndex)Sets the global subroutine index data.voidsetLocalSubrIndex(IndexData localSubrIndex)Sets the local subroutine index data.voidsetName(java.lang.String name)Sets the name of the font.java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
The name of the font.- Returns:
- the name of the font
-
setName
public void setName(java.lang.String name)
Sets the name of the font.- Parameters:
name- the name of the font
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
Returns the value for the given name from the dictionary.- Parameters:
name- the name of the value- Returns:
- the value of the name if available
-
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
-
addValueToPrivateDict
public void addValueToPrivateDict(java.lang.String name, java.lang.Object value)Adds the given key/value pair to the private dictionary.- Parameters:
name- the given keyvalue- the given value
-
getPrivateDict
public java.util.Map<java.lang.String,java.lang.Object> getPrivateDict()
Returns the private dictionary.- Returns:
- the dictionary
-
getMappings
public java.util.Collection<CFFFont.Mapping> getMappings()
Get the mapping (code/SID/charname/bytes) for this font.- Returns:
- mappings for codes < 256 and for codes >= 256
-
getWidth
public int getWidth(int SID) throws java.io.IOExceptionReturn the Width value of the given Glyph identifier- Parameters:
SID-- Returns:
- -1 if the SID is missing from the Font.
- Throws:
java.io.IOException
-
getNotDefWidth
protected int getNotDefWidth(int defaultWidth, int nominalWidth) throws java.io.IOException- Throws:
java.io.IOException
-
getEncoding
public CFFEncoding getEncoding()
Returns the CFFEncoding of the font.- Returns:
- the encoding
-
setEncoding
public void setEncoding(CFFEncoding encoding)
Sets the CFFEncoding of the font.- Parameters:
encoding- the given CFFEncoding
-
getCharset
public CFFCharset getCharset()
Returns the CFFCharset of the font.- Returns:
- the charset
-
setCharset
public void setCharset(CFFCharset charset)
Sets the CFFCharset of the font.- Parameters:
charset- the given CFFCharset
-
getCharStringsDict
public java.util.Map<java.lang.String,byte[]> getCharStringsDict()
Returns the character strings dictionary.- Returns:
- the dictionary
-
createConverter
public CharStringConverter createConverter()
Creates a CharStringConverter for this font.- Returns:
- the new CharStringConverter
-
createRenderer
public CharStringRenderer createRenderer()
Creates a CharStringRenderer for this font.- Returns:
- the new CharStringRenderer
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setGlobalSubrIndex
public void setGlobalSubrIndex(IndexData globalSubrIndex)
Sets the global subroutine index data.- Parameters:
globalSubrIndex- the IndexData object containing the global subroutines
-
getGlobalSubrIndex
public IndexData getGlobalSubrIndex()
Returns the global subroutine index data.- Returns:
- the dictionary
-
getLocalSubrIndex
public IndexData getLocalSubrIndex()
Returns the local subroutine index data.- Returns:
- the dictionary
-
setLocalSubrIndex
public void setLocalSubrIndex(IndexData localSubrIndex)
Sets the local subroutine index data.- Parameters:
localSubrIndex- the IndexData object containing the local subroutines
-
-