public abstract class PDCIDFont extends Object implements COSObjectable, PDFontLike, PDVectorFont
It is not usually necessary to use this class directly, prefer PDType0Font
.
Modifier and Type | Field and Description |
---|---|
protected COSDictionary |
dict |
protected PDType0Font |
parent |
Modifier and Type | Method and Description |
---|---|
abstract int |
codeToCID(int code)
Returns the CID for the given character code.
|
abstract int |
codeToGID(int code)
Returns the GID for the given character code.
|
protected abstract byte[] |
encode(int unicode)
Encodes the given Unicode code point for use in a PDF content stream.
|
float |
getAverageFontWidth()
This will get the average font width for all characters.
|
String |
getBaseFont()
The PostScript name of the font.
|
abstract BoundingBox |
getBoundingBox()
Returns the font's bounding box.
|
PDCIDSystemInfo |
getCIDSystemInfo()
Returns the CIDSystemInfo, or null if it is missing (which isn't allowed but could happen).
|
COSDictionary |
getCOSObject()
Convert this standard java object to a COS object.
|
PDFontDescriptor |
getFontDescriptor()
Returns the font descriptor, may be null.
|
abstract Matrix |
getFontMatrix()
Returns the font matrix, which represents the transformation from glyph space to text space.
|
abstract float |
getHeight(int code)
Returns the height of the given character, in glyph space.
|
String |
getName()
Returns the name of this font, either the PostScript "BaseName" or the Type 3 "Name".
|
PDType0Font |
getParent()
Returns the Type 0 font which is the parent of this font.
|
Vector |
getPositionVector(int code)
Returns the position vector (v), in text space, for the given character.
|
float |
getVerticalDisplacementVectorY(int code)
Returns the y-component of the vertical displacement vector (w1).
|
float |
getWidth(int code)
Returns the advance width of the given character, in glyph space.
|
abstract float |
getWidthFromFont(int code)
Returns the width of a glyph in the embedded font file.
|
abstract boolean |
isEmbedded()
Returns true if the font file is embedded in the PDF.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isDamaged
getPath, hasGlyph
protected final PDType0Font parent
protected final COSDictionary dict
public COSDictionary getCOSObject()
COSObjectable
getCOSObject
in interface COSObjectable
public String getBaseFont()
public String getName()
PDFontLike
getName
in interface PDFontLike
public PDFontDescriptor getFontDescriptor()
PDFontLike
getFontDescriptor
in interface PDFontLike
public abstract Matrix getFontMatrix()
PDFontLike
getFontMatrix
in interface PDFontLike
public final PDType0Font getParent()
public abstract BoundingBox getBoundingBox() throws IOException
PDFontLike
getBoundingBox
in interface PDFontLike
IOException
public Vector getPositionVector(int code)
PDFontLike
getPositionVector
in interface PDFontLike
code
- character codepublic float getVerticalDisplacementVectorY(int code)
code
- character codepublic abstract float getHeight(int code) throws IOException
PDFontLike
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.getHeight
in interface PDFontLike
code
- character codeIOException
public float getWidth(int code) throws IOException
PDFontLike
getWidth
in interface PDFontLike
code
- character codeIOException
public abstract float getWidthFromFont(int code) throws IOException
PDFontLike
getWidthFromFont
in interface PDFontLike
code
- character codeIOException
- if the font could not be readpublic abstract boolean isEmbedded()
PDFontLike
isEmbedded
in interface PDFontLike
public float getAverageFontWidth()
PDFontLike
getAverageFontWidth
in interface PDFontLike
public PDCIDSystemInfo getCIDSystemInfo()
public abstract int codeToCID(int code)
code
- character codepublic abstract int codeToGID(int code) throws IOException
code
- character codeIOException
protected abstract byte[] encode(int unicode) throws IOException
This method is called when embedding text in PDFs and when filling in fields.
unicode
- Unicode code point.IOException
- If the text could not be encoded.Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.