Package org.verapdf.pd.font.cff
Class CFFType1FontProgram
java.lang.Object
org.verapdf.pd.font.cff.CFFType1FontProgram
- All Implemented Interfaces:
FontProgram
Instance of this class represent a Type1 font from FontSet of
CFF file.
- Author:
- Sergey Shemyakov
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected long
protected CFFIndex
protected long
protected int
protected static final float[]
protected int
protected CFFIndex
protected float[]
protected CFFIndex
protected boolean
protected int
protected int
protected long
protected long
protected SeekableInputStream
protected long
protected boolean
protected long
protected long
protected String
protected CharStringsWidths
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsCID
(int cid) Method works only for fonts where cid notation is used.boolean
containsCode
(int code) Checks if font contains character with given code.boolean
containsGID
(int gid) boolean
containsGlyph
(String glyphName) Checks if this font program has glyph for given glyph name.static CFFType1FontProgram
getCFFType1
(FontProgram fontProgram) Gets CFF Type 1 font program for given font program (CFF font program with inner CFF Type 1 or CFF Type 1).String[]
getGlyphName
(int code) Returns glyph name for glyph with given code.int
protected String
getStringBySID
(int sid) float
getWidth
(int charCode) Returns width of glyph for given character code.float
Returns width of glyph for given glyph name.float
getWidthFromGID
(int gid) boolean
boolean
void
This method does parsing of font, after it all the data needed should be extracted.protected int
protected int
protected void
protected void
protected CFFIndex
protected CFFNumber
protected void
protected void
readTopDictOneByteOps
(int lastRead) protected void
readTopDictTwoByteOps
(int lastRead) protected void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.verapdf.pd.font.FontProgram
getFontProgramResource, getWeight
-
Field Details
-
attemptedParsing
protected boolean attemptedParsing -
successfullyParsed
protected boolean successfullyParsed -
DEFAULT_FONT_MATRIX
protected static final float[] DEFAULT_FONT_MATRIX -
stack
-
globalSubrs
-
isSubset
protected boolean isSubset -
privateDictOffset
protected long privateDictOffset -
privateDictSize
protected long privateDictSize -
topDictBeginOffset
protected long topDictBeginOffset -
topDictEndOffset
protected long topDictEndOffset -
fontMatrix
protected float[] fontMatrix -
charStringsOffset
protected long charStringsOffset -
charSetOffset
protected long charSetOffset -
charStringType
protected int charStringType -
weight
-
nGlyphs
protected int nGlyphs -
charStrings
-
widths
-
defaultWidthX
protected int defaultWidthX -
nominalWidthX
protected int nominalWidthX -
subrsOffset
protected long subrsOffset -
source
-
definedNames
-
-
Method Details
-
parseFont
This method does parsing of font, after it all the data needed should be extracted.- Specified by:
parseFont
in interfaceFontProgram
- Throws:
IOException
- if error in font parsing occurs.
-
readTopDictOneByteOps
protected void readTopDictOneByteOps(int lastRead) -
getGlyphName
Description copied from interface:FontProgram
Returns glyph name for glyph with given code.- Specified by:
getGlyphName
in interfaceFontProgram
- Parameters:
code
- is code of glyph.- Returns:
- glyph name.
-
getAscent
- Specified by:
getAscent
in interfaceFontProgram
-
getDescent
- Specified by:
getDescent
in interfaceFontProgram
-
getWidth
public float getWidth(int charCode) Returns width of glyph for given character code.- Specified by:
getWidth
in interfaceFontProgram
- Parameters:
charCode
- is code for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
getWidthFromGID
public float getWidthFromGID(int gid) -
containsGID
public boolean containsGID(int gid) -
containsGlyph
Description copied from interface:FontProgram
Checks if this font program has glyph for given glyph name.- Specified by:
containsGlyph
in interfaceFontProgram
- Parameters:
glyphName
- is the name of glyph.- Returns:
- true if this font program has glyph for given name.
-
getWidth
Returns width of glyph for given glyph name.- Specified by:
getWidth
in interfaceFontProgram
- Parameters:
charName
- is name for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
containsCode
public boolean containsCode(int code) Checks if font contains character with given code.- Specified by:
containsCode
in interfaceFontProgram
- Parameters:
code
- is character code.- Returns:
- true if font contains character with given code.
-
containsCID
public boolean containsCID(int cid) Description copied from interface:FontProgram
Method works only for fonts where cid notation is used.- Specified by:
containsCID
in interfaceFontProgram
- Returns:
- true if font a is cid font and contains given cid.
-
getEncoding
-
getCharSet
- Returns:
- list of names for all glyphs in this font.
-
isAttemptedParsing
public boolean isAttemptedParsing()- Specified by:
isAttemptedParsing
in interfaceFontProgram
- Returns:
- true if font parsing has been attempted.
-
isSuccessfulParsing
public boolean isSuccessfulParsing()- Specified by:
isSuccessfulParsing
in interfaceFontProgram
- Returns:
- true if font was successfully parsed.
-
getCFFType1
Gets CFF Type 1 font program for given font program (CFF font program with inner CFF Type 1 or CFF Type 1).- Returns:
- CFF Type 1 font program or null if no CFF Type 1 font program can be obtained.
-
getCIDList
- Specified by:
getCIDList
in interfaceFontProgram
-
readTopDictUnit
- Throws:
IOException
-
readTopDictTwoByteOps
- Throws:
IOException
-
readCharStrings
- Throws:
IOException
-
readPrivateDictUnit
- Throws:
IOException
-
getNGlyphs
public int getNGlyphs()- Returns:
- amount of glyphs in the font.
-
getFontProgramResource
-
getWeight
-
readCard8
- Throws:
IOException
-
readCard16
- Throws:
IOException
-
readIndex
- Throws:
IOException
-
readHeader
- Throws:
IOException
-
readNumber
- Throws:
IOException
-
getStringBySID
- Throws:
IOException
-