org.apache.fontbox.cff
Class CFFFont

java.lang.Object
  extended by org.apache.fontbox.cff.CFFFont
Direct Known Subclasses:
CFFFontROS

public class CFFFont
extends Object

This class represents a CFF/Type2 Font.

Version:
$Revision$
Author:
Villu Ruusmann

Nested Class Summary
 class CFFFont.Mapping
          This class is used for the font mapping.
 
Constructor Summary
CFFFont()
           
 
Method Summary
 void addValueToPrivateDict(String name, Object value)
          Adds the given key/value pair to the private dictionary.
 void addValueToTopDict(String name, Object value)
          Adds the given key/value pair to the top dictionary.
 CharStringConverter createConverter()
          Creates a CharStringConverter for this font.
 CharStringRenderer createRenderer()
          Creates a CharStringRenderer for this font.
 CFFCharset getCharset()
          Returns the CFFCharset of the font.
 Map<String,byte[]> getCharStringsDict()
          Returns the character strings dictionary.
 CFFEncoding getEncoding()
          Returns the CFFEncoding of the font.
 IndexData getGlobalSubrIndex()
          Returns the global subroutine index data.
 IndexData getLocalSubrIndex()
          Returns the local subroutine index data.
 Collection<CFFFont.Mapping> getMappings()
          Get the mapping (code/SID/charname/bytes) for this font.
 String getName()
          The name of the font.
protected  int getNotDefWidth(int defaultWidth, int nominalWidth)
           
 Map<String,Object> getPrivateDict()
          Returns the private dictionary.
 Object getProperty(String name)
          Returns the value for the given name from the dictionary.
 Map<String,Object> getTopDict()
          Returns the top dictionary.
 int getWidth(int SID)
          Return the Width value of the given Glyph identifier
 void setCharset(CFFCharset charset)
          Sets the CFFCharset of the font.
 void setEncoding(CFFEncoding encoding)
          Sets the CFFEncoding of the font.
 void setGlobalSubrIndex(IndexData globalSubrIndex)
          Sets the global subroutine index data.
 void setLocalSubrIndex(IndexData localSubrIndex)
          Sets the local subroutine index data.
 void setName(String name)
          Sets the name of the font.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CFFFont

public CFFFont()
Method Detail

getName

public String getName()
The name of the font.

Returns:
the name of the font

setName

public void setName(String name)
Sets the name of the font.

Parameters:
name - the name of the font

getProperty

public Object getProperty(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(String name,
                              Object value)
Adds the given key/value pair to the top dictionary.

Parameters:
name - the given key
value - the given value

getTopDict

public Map<String,Object> getTopDict()
Returns the top dictionary.

Returns:
the dictionary

addValueToPrivateDict

public void addValueToPrivateDict(String name,
                                  Object value)
Adds the given key/value pair to the private dictionary.

Parameters:
name - the given key
value - the given value

getPrivateDict

public Map<String,Object> getPrivateDict()
Returns the private dictionary.

Returns:
the dictionary

getMappings

public 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 IOException
Return the Width value of the given Glyph identifier

Parameters:
SID -
Returns:
-1 if the SID is missing from the Font.
Throws:
IOException

getNotDefWidth

protected int getNotDefWidth(int defaultWidth,
                             int nominalWidth)
                      throws IOException
Throws:
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 Map<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 String toString()

Overrides:
toString in class 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