public class PDCIDFontType2 extends PDCIDFont
| Constructor and Description |
|---|
PDCIDFontType2(COSDictionary fontDictionary,
PDType0Font parent)
Constructor.
|
PDCIDFontType2(COSDictionary fontDictionary,
PDType0Font parent,
org.apache.fontbox.ttf.TrueTypeFont trueTypeFont)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
codeToCID(int code)
Returns the CID for the given character code.
|
int |
codeToGID(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.
|
byte[] |
encodeGlyphId(int glyphId) |
org.apache.fontbox.util.BoundingBox |
getBoundingBox()
Returns the font's bounding box.
|
Matrix |
getFontMatrix()
Returns the font matrix, which represents the transformation from glyph space to text space.
|
float |
getHeight(int code)
Returns the height of the given character, in glyph space.
|
GeneralPath |
getNormalizedPath(int code)
Returns the normalized glyph path for the given character code in a PDF.
|
GeneralPath |
getPath(int code)
Returns the glyph path for the given character code.
|
org.apache.fontbox.ttf.TrueTypeFont |
getTrueTypeFont()
Returns the embedded or substituted TrueType font.
|
float |
getWidthFromFont(int code)
Returns the width of a glyph in the embedded font file.
|
boolean |
hasGlyph(int code)
Returns true if this font contains a glyph for the given character code in a PDF.
|
boolean |
isDamaged()
Returns true if the embedded font file is damaged.
|
boolean |
isEmbedded()
Returns true if the font file is embedded in the PDF.
|
getAverageFontWidth, getBaseFont, getCIDSystemInfo, getCOSObject, getFontDescriptor, getName, getParent, getPositionVector, getVerticalDisplacementVectorY, getWidth, hasExplicitWidthpublic PDCIDFontType2(COSDictionary fontDictionary, PDType0Font parent) throws IOException
fontDictionary - The font dictionary according to the PDF specification.parent - The parent font.IOException - if the font could not be readpublic PDCIDFontType2(COSDictionary fontDictionary, PDType0Font parent, org.apache.fontbox.ttf.TrueTypeFont trueTypeFont) throws IOException
fontDictionary - The font dictionary according to the PDF specification.parent - The parent font.trueTypeFont - The true type font used to create the parent fontIOException - if the font could not be readpublic Matrix getFontMatrix()
PDFontLikepublic org.apache.fontbox.util.BoundingBox getBoundingBox()
throws IOException
PDFontLikeIOException - if the bounding box could not be readpublic int codeToCID(int code)
PDCIDFontpublic int codeToGID(int code)
throws IOException
codeToGID in class PDCIDFontcode - character codeIOException - if the mapping could not be readpublic float getHeight(int code)
throws IOException
PDFontLike
Warning: This method is deprecated in PDFBox 2.0 because there is no meaningful value which it can return. The
PDFontLike.getWidth(int) method returns the advance width of a glyph, but there is no corresponding advance height.
The logical height of a character is the same for every character in a font, so if you want that, retrieve the
font bbox's height. Otherwise if you want the visual bounds of the glyph then call getPath(..) on the appropriate
PDFont subclass to retrieve the glyph outline as a GeneralPath. See the cyan rectangles in the
DrawPrintTextLocations.java example to see this in action.
code - character codeIOException - if the height could not be readpublic float getWidthFromFont(int code)
throws IOException
PDFontLikecode - character codeIOException - if the font could not be readpublic byte[] encode(int unicode)
PDCIDFontThis method is called when embedding text in PDFs and when filling in fields.
public byte[] encodeGlyphId(int glyphId)
encodeGlyphId in class PDCIDFontpublic boolean isEmbedded()
PDFontLikepublic boolean isDamaged()
PDFontLikepublic org.apache.fontbox.ttf.TrueTypeFont getTrueTypeFont()
public GeneralPath getPath(int code) throws IOException
PDVectorFontcode - character code in a PDF. Not to be confused with unicode.IOException - if the font could not be readpublic GeneralPath getNormalizedPath(int code) throws IOException
PDVectorFontcode - character code in a PDF. Not to be confused with unicode.IOException - if the font could not be readpublic boolean hasGlyph(int code)
throws IOException
PDVectorFontcode - character code in a PDF. Not to be confused with unicode.IOException - if the font could not be readCopyright © 2002–2022 The Apache Software Foundation. All rights reserved.