Class PDCIDFontType2
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.font.PDCIDFont
-
- com.tom_roush.pdfbox.pdmodel.font.PDCIDFontType2
-
- All Implemented Interfaces:
COSObjectable,PDFontLike,PDVectorFont
public class PDCIDFontType2 extends PDCIDFont
Type 2 CIDFont (TrueType).
-
-
Constructor Summary
Constructors Constructor Description PDCIDFontType2(COSDictionary fontDictionary, PDType0Font parent)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcodeToCID(int code)Returns the CID for the given character code.intcodeToGID(int code)Returns the GID for the given character code.byte[]encode(int unicode)Encodes the given Unicode code point for use in a PDF content stream.BoundingBoxgetBoundingBox()Returns the font's bounding box.MatrixgetFontMatrix()Returns the font matrix, which represents the transformation from glyph space to text space.floatgetHeight(int code)Returns the height of the given character, in glyph space.android.graphics.PathgetPath(int code)Returns the glyph path for the given character code.TrueTypeFontgetTrueTypeFont()Returns the embedded or substituted TrueType font.floatgetWidthFromFont(int code)Returns the width of a glyph in the embedded font file.booleanhasGlyph(int code)Returns true if this font contains a glyph for the given character code.booleanisDamaged()Returns true if the embedded font file is damaged.booleanisEmbedded()Returns true if the font file is embedded in the PDF.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class com.tom_roush.pdfbox.pdmodel.font.PDCIDFont
getAverageFontWidth, getBaseFont, getCIDSystemInfo, getCOSObject, getFontDescriptor, getName, getParent, getPositionVector, getVerticalDisplacementVectorY, getWidth
-
-
-
-
Constructor Detail
-
PDCIDFontType2
public PDCIDFontType2(COSDictionary fontDictionary, PDType0Font parent) throws IOException
Constructor.- Parameters:
fontDictionary- The font dictionary according to the PDF specification.- Throws:
IOException
-
-
Method Detail
-
getFontMatrix
public Matrix getFontMatrix()
Description copied from interface:PDFontLikeReturns the font matrix, which represents the transformation from glyph space to text space.- Specified by:
getFontMatrixin interfacePDFontLike- Specified by:
getFontMatrixin classPDCIDFont
-
getBoundingBox
public BoundingBox getBoundingBox() throws IOException
Description copied from interface:PDFontLikeReturns the font's bounding box.- Specified by:
getBoundingBoxin interfacePDFontLike- Specified by:
getBoundingBoxin classPDCIDFont- Throws:
IOException
-
codeToCID
public int codeToCID(int code)
Description copied from class:PDCIDFontReturns the CID for the given character code. If not found then CID 0 is returned.
-
codeToGID
public int codeToGID(int code) throws IOExceptionReturns the GID for the given character code.- Specified by:
codeToGIDin classPDCIDFont- Parameters:
code- character code- Returns:
- GID
- Throws:
IOException
-
getHeight
public float getHeight(int code) throws IOExceptionDescription copied from interface:PDFontLikeReturns the height of the given character, in glyph space. This can be expensive to calculate. Results are only approximate.- Specified by:
getHeightin interfacePDFontLike- Specified by:
getHeightin classPDCIDFont- Parameters:
code- character code- Throws:
IOException
-
getWidthFromFont
public float getWidthFromFont(int code) throws IOExceptionDescription copied from interface:PDFontLikeReturns the width of a glyph in the embedded font file.- Specified by:
getWidthFromFontin interfacePDFontLike- Specified by:
getWidthFromFontin classPDCIDFont- Parameters:
code- character code- Returns:
- width in glyph space
- Throws:
IOException- if the font could not be read
-
encode
public byte[] encode(int unicode)
Description copied from class:PDCIDFontEncodes the given Unicode code point for use in a PDF content stream. Content streams use a multi-byte encoding with 1 to 4 bytes.This method is called when embedding text in PDFs and when filling in fields.
-
isEmbedded
public boolean isEmbedded()
Description copied from interface:PDFontLikeReturns true if the font file is embedded in the PDF.- Specified by:
isEmbeddedin interfacePDFontLike- Specified by:
isEmbeddedin classPDCIDFont
-
isDamaged
public boolean isDamaged()
Description copied from interface:PDFontLikeReturns true if the embedded font file is damaged.
-
getTrueTypeFont
public TrueTypeFont getTrueTypeFont()
Returns the embedded or substituted TrueType font. May be an OpenType font if the font is not embedded.
-
getPath
public android.graphics.Path getPath(int code) throws IOExceptionDescription copied from interface:PDVectorFontReturns the glyph path for the given character code.- Parameters:
code- character code- Throws:
IOException- if the font could not be read
-
hasGlyph
public boolean hasGlyph(int code) throws IOExceptionDescription copied from interface:PDVectorFontReturns true if this font contains a glyph for the given character code.- Parameters:
code- character code- Throws:
IOException
-
-