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.
|
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.
|
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.
|
boolean |
hasExplicitWidth(int code)
Returns true if the Font dictionary specifies an explicit width for the given glyph.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBoundingBox, getFontMatrix, getHeight, getWidthFromFont, isDamaged, isEmbedded
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 final PDType0Font getParent()
public boolean hasExplicitWidth(int code) throws IOException
PDFontLike
hasExplicitWidth
in interface PDFontLike
code
- character codeIOException
- if the font could not be readpublic Vector getPositionVector(int code)
PDFontLike
getPositionVector
in interface PDFontLike
code
- character codepublic float getVerticalDisplacementVectorY(int code)
code
- character codepublic float getWidth(int code) throws IOException
PDFontLike
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 instead. See the cyan rectangles in the DrawPrintTextLocations.java example to see this in action.
getWidth
in interface PDFontLike
code
- character codeIOException
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–2023 The Apache Software Foundation. All rights reserved.