Package org.apache.fontbox.cff
Class CFFType1Font
java.lang.Object
org.apache.fontbox.cff.CFFFont
org.apache.fontbox.cff.CFFType1Font
- All Implemented Interfaces:
EncodedFont,FontBoxFont
A Type 1-equivalent font program represented in a CFF file. Thread safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classPrivate implementation of Type1CharStringReader, because only CFFType1Font can expose this publicly, as CIDFonts only support this for legacy 'seac' commands. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Integer, Type2CharString> private Type2CharStringParserprivate intprivate CFFEncodingprivate byte[][]private intprivate final CFFType1Font.PrivateType1CharStringReaderFields inherited from class org.apache.fontbox.cff.CFFFont
charStrings, globalSubrIndex, topDict -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddToPrivateDict(String name, Object value) Adds the given key/value pair to the private dictionary.private intReturns the CFFEncoding of the font.private byte[][]private intprivate Type2CharStringParserReturns the path for the character with the given name.Returns the private dictionary.private ObjectgetProperty(String name) getType1CharString(String name) Returns the Type 1 charstring for the given PostScript glyph name.getType2CharString(int gid) Returns the Type 1 charstring for the given GID.private Type2CharStringgetType2CharString(int gid, String name) floatReturns the advance width for the character with the given name.booleanReturns true if the font contains the given glyph.intReturns the GID for the given PostScript glyph name.(package private) voidsetEncoding(CFFEncoding encoding) Sets the CFFEncoding of the font.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 Details
-
privateDict
-
encoding
-
charStringCache
-
reader
-
charStringParser
-
defaultWidthX
private int defaultWidthX -
nominalWidthX
private int nominalWidthX -
localSubrIndex
private byte[][] localSubrIndex
-
-
Constructor Details
-
CFFType1Font
public CFFType1Font()
-
-
Method Details
-
getPath
Description copied from interface:FontBoxFontReturns the path for the character with the given name.- Specified by:
getPathin interfaceFontBoxFont- Parameters:
name- PostScript glyph name- Returns:
- glyph path
- Throws:
IOException- if the path could not be read
-
getWidth
Description copied from interface:FontBoxFontReturns the advance width for the character with the given name.- Specified by:
getWidthin interfaceFontBoxFont- Parameters:
name- PostScript glyph name- Returns:
- glyph advance width
- Throws:
IOException- if the path could not be read
-
hasGlyph
Description copied from interface:FontBoxFontReturns true if the font contains the given glyph.- Specified by:
hasGlyphin interfaceFontBoxFont- Parameters:
name- PostScript glyph name- Returns:
- true if the font contains a glyph with the given name, otherwise false
-
getType1CharString
Returns the Type 1 charstring for the given PostScript glyph name.- Parameters:
name- PostScript glyph name- Returns:
- Type1 charstring of the given PostScript glyph name
- Throws:
IOException- if the charstring could not be read
-
nameToGID
Returns the GID for the given PostScript glyph name.- Parameters:
name- a PostScript glyph name.- Returns:
- GID
-
getType2CharString
Returns the Type 1 charstring for the given GID.- Specified by:
getType2CharStringin classCFFFont- Parameters:
gid- GID- Returns:
- the Type2 charstring of the given cid/gid
- Throws:
IOException- if the charstring could not be read
-
getType2CharString
- Throws:
IOException
-
getParser
-
getPrivateDict
Returns the private dictionary.- Returns:
- the dictionary
-
addToPrivateDict
Adds the given key/value pair to the private dictionary.- Parameters:
name- the given keyvalue- the given value
-
getEncoding
Returns the CFFEncoding of the font.- Specified by:
getEncodingin interfaceEncodedFont- Returns:
- the encoding
-
setEncoding
Sets the CFFEncoding of the font.- Parameters:
encoding- the given CFFEncoding
-
getLocalSubrIndex
private byte[][] getLocalSubrIndex() -
getProperty
-
getDefaultWidthX
private int getDefaultWidthX() -
getNominalWidthX
private int getNominalWidthX()
-