Package org.apache.fontbox.cff
Class CFFCIDFont
- java.lang.Object
-
- org.apache.fontbox.cff.CFFFont
-
- org.apache.fontbox.cff.CFFCIDFont
-
- All Implemented Interfaces:
FontBoxFont
public class CFFCIDFont extends CFFFont
A Type 0 CIDFont represented in a CFF file. Thread safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classCFFCIDFont.PrivateType1CharStringReaderPrivate implementation of Type1CharStringReader, because only CFFType1Font can expose this publicly, as CIDFonts only support this for legacy 'seac' commands.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,CIDKeyedType2CharString>charStringCacheprivate Type2CharStringParsercharStringParserprivate FDSelectfdSelectprivate java.util.List<java.util.Map<java.lang.String,java.lang.Object>>fontDictionariesprivate java.lang.Stringorderingprivate java.util.List<java.util.Map<java.lang.String,java.lang.Object>>privateDictionariesprivate CFFCIDFont.PrivateType1CharStringReaderreaderprivate java.lang.Stringregistryprivate intsupplement-
Fields inherited from class org.apache.fontbox.cff.CFFFont
charStrings, globalSubrIndex, topDict
-
-
Constructor Summary
Constructors Constructor Description CFFCIDFont()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private intgetDefaultWidthX(int gid)Returns the defaultWidthX for the given GID.FDSelectgetFdSelect()Returns the fdSelect value.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>getFontDicts()Returns the font dictionaries.private byte[][]getLocalSubrIndex(int gid)Returns the LocalSubrIndex for the given GID.private intgetNominalWidthX(int gid)Returns the nominalWidthX for the given GID.java.lang.StringgetOrdering()Returns the ordering value.private Type2CharStringParsergetParser()java.awt.geom.GeneralPathgetPath(java.lang.String selector)Returns the path for the character with the given name.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>getPrivDicts()Returns the private dictionary.java.lang.StringgetRegistry()Returns the registry value.intgetSupplement()Returns the supplement value.CIDKeyedType2CharStringgetType2CharString(int cid)Returns the Type 2 charstring for the given CID.floatgetWidth(java.lang.String selector)Returns the advance width for the character with the given name.booleanhasGlyph(java.lang.String selector)Returns true if the font contains the given glyph.private intselectorToCID(java.lang.String selector)Parses a CID selector of the form \ddddd.(package private) voidsetFdSelect(FDSelect fdSelect)Sets the fdSelect value.(package private) voidsetFontDict(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> fontDict)Sets the font dictionaries.(package private) voidsetOrdering(java.lang.String ordering)Sets the ordering value.(package private) voidsetPrivDict(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> privDict)Sets the private dictionary.(package private) voidsetRegistry(java.lang.String registry)Sets the registry value.(package private) voidsetSupplement(int supplement)Sets the supplement value.-
Methods inherited from class org.apache.fontbox.cff.CFFFont
addValueToTopDict, getCharset, getCharStringBytes, getData, getFontBBox, getFontMatrix, getGlobalSubrIndex, getName, getNumCharStrings, getTopDict, setCharset, setData, setGlobalSubrIndex, setName, toString
-
-
-
-
Field Detail
-
registry
private java.lang.String registry
-
ordering
private java.lang.String ordering
-
supplement
private int supplement
-
fontDictionaries
private java.util.List<java.util.Map<java.lang.String,java.lang.Object>> fontDictionaries
-
privateDictionaries
private java.util.List<java.util.Map<java.lang.String,java.lang.Object>> privateDictionaries
-
fdSelect
private FDSelect fdSelect
-
charStringCache
private final java.util.Map<java.lang.Integer,CIDKeyedType2CharString> charStringCache
-
charStringParser
private Type2CharStringParser charStringParser
-
reader
private final CFFCIDFont.PrivateType1CharStringReader reader
-
-
Method Detail
-
getRegistry
public java.lang.String getRegistry()
Returns the registry value.- Returns:
- the registry
-
setRegistry
void setRegistry(java.lang.String registry)
Sets the registry value.- Parameters:
registry- the registry to set
-
getOrdering
public java.lang.String getOrdering()
Returns the ordering value.- Returns:
- the ordering
-
setOrdering
void setOrdering(java.lang.String ordering)
Sets the ordering value.- Parameters:
ordering- the ordering to set
-
getSupplement
public int getSupplement()
Returns the supplement value.- Returns:
- the supplement
-
setSupplement
void setSupplement(int supplement)
Sets the supplement value.- Parameters:
supplement- the supplement to set
-
getFontDicts
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getFontDicts()
Returns the font dictionaries.- Returns:
- the fontDict
-
setFontDict
void setFontDict(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> fontDict)
Sets the font dictionaries.- Parameters:
fontDict- the fontDict to set
-
getPrivDicts
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getPrivDicts()
Returns the private dictionary.- Returns:
- the privDict
-
setPrivDict
void setPrivDict(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> privDict)
Sets the private dictionary.- Parameters:
privDict- the privDict to set
-
getFdSelect
public FDSelect getFdSelect()
Returns the fdSelect value.- Returns:
- the fdSelect
-
setFdSelect
void setFdSelect(FDSelect fdSelect)
Sets the fdSelect value.- Parameters:
fdSelect- the fdSelect to set
-
getDefaultWidthX
private int getDefaultWidthX(int gid)
Returns the defaultWidthX for the given GID.- Parameters:
gid- GID
-
getNominalWidthX
private int getNominalWidthX(int gid)
Returns the nominalWidthX for the given GID.- Parameters:
gid- GID
-
getLocalSubrIndex
private byte[][] getLocalSubrIndex(int gid)
Returns the LocalSubrIndex for the given GID.- Parameters:
gid- GID
-
getType2CharString
public CIDKeyedType2CharString getType2CharString(int cid) throws java.io.IOException
Returns the Type 2 charstring for the given CID.- Specified by:
getType2CharStringin classCFFFont- Parameters:
cid- CID- Returns:
- the Type2 charstring of the given cid/gid
- Throws:
java.io.IOException- if the charstring could not be read
-
getParser
private Type2CharStringParser getParser()
-
getPath
public java.awt.geom.GeneralPath getPath(java.lang.String selector) throws java.io.IOExceptionDescription copied from interface:FontBoxFontReturns the path for the character with the given name.- Parameters:
selector- PostScript glyph name- Returns:
- glyph path
- Throws:
java.io.IOException- if the path could not be read
-
getWidth
public float getWidth(java.lang.String selector) throws java.io.IOExceptionDescription copied from interface:FontBoxFontReturns the advance width for the character with the given name.- Parameters:
selector- PostScript glyph name- Returns:
- glyph advance width
- Throws:
java.io.IOException- if the path could not be read
-
hasGlyph
public boolean hasGlyph(java.lang.String selector) throws java.io.IOExceptionDescription copied from interface:FontBoxFontReturns true if the font contains the given glyph.- Parameters:
selector- PostScript glyph name- Returns:
- true if the font contains a glyph with the given name, otherwise false
- Throws:
java.io.IOException- if something went wrong when accessing the font data
-
selectorToCID
private int selectorToCID(java.lang.String selector)
Parses a CID selector of the form \ddddd.
-
-