public abstract class PDFFont
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
PDFFont(java.lang.String baseFont,
PDFFontDescriptor descriptor)
Create a PDFFont given the base font name and the font descriptor
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Compare two fonts base on the baseFont
|
java.lang.String |
getBaseFont()
Get the postscript name of this font
|
PDFGlyph |
getCachedGlyph(char src,
java.lang.String name)
Get a glyph for a given character code.
|
PDFFontDescriptor |
getDescriptor()
Get the descriptor for this font
|
PDFFontEncoding |
getEncoding()
Get the encoding for this font
|
static PDFFont |
getFont(PDFObject obj,
java.util.HashMap<java.lang.String,PDFObject> resources)
get the PDFFont corresponding to the font described in a PDFObject.
|
protected abstract PDFGlyph |
getGlyph(char src,
java.lang.String name)
Get the glyph for a given character code and name
The preferred method of getting the glyph should be by name.
|
java.util.List<PDFGlyph> |
getGlyphs(java.lang.String text)
Get the glyphs associated with a given String in this font
|
java.lang.String |
getSubtype()
Get the subtype of this font.
|
PDFCMap |
getUnicodeMap()
Get the CMap which maps the characters in this font to unicode names
|
int |
hashCode()
Hash a font based on its base font
|
void |
setBaseFont(java.lang.String baseFont)
Set the postscript name of this font
|
void |
setDescriptor(PDFFontDescriptor descriptor)
Set the descriptor font descriptor
|
void |
setEncoding(PDFFontEncoding encoding)
Set the encoding for this font
|
void |
setSubtype(java.lang.String subtype)
Set the font subtype
|
void |
setUnicodeMap(PDFCMap unicodeMap)
Set the CMap which maps the characters in this font to unicode names
|
java.lang.String |
toString()
Turn this font into a pretty String
|
protected PDFFont(java.lang.String baseFont, PDFFontDescriptor descriptor)
baseFont
- the postscript name of this fontdescriptor
- the descriptor for the fontpublic static PDFFont getFont(PDFObject obj, java.util.HashMap<java.lang.String,PDFObject> resources) throws java.io.IOException
For Type1 and TrueType fonts, the dictionary also contains:
BaseFont = (some name, or XXXXXX+Name as a subset of font Name)
For Type3 font, the dictionary contains:
FontBBox = (rectangle)
FontMatrix = (array, typically [0.001, 0, 0, 0.001, 0, 0])
CharProcs = (dictionary)
Resources = (dictionary)
java.io.IOException
public java.lang.String getSubtype()
public void setSubtype(java.lang.String subtype)
public java.lang.String getBaseFont()
public void setBaseFont(java.lang.String baseFont)
baseFont
- the postscript name of the fontpublic PDFFontEncoding getEncoding()
public void setEncoding(PDFFontEncoding encoding)
public PDFFontDescriptor getDescriptor()
public void setDescriptor(PDFFontDescriptor descriptor)
public PDFCMap getUnicodeMap()
public void setUnicodeMap(PDFCMap unicodeMap)
public java.util.List<PDFGlyph> getGlyphs(java.lang.String text)
text
- the text to translate into glyphspublic PDFGlyph getCachedGlyph(char src, java.lang.String name)
src
- the character code of this glyphname
- the name of the glyph, or null if the name is unknownprotected abstract PDFGlyph getGlyph(char src, java.lang.String name)
src
- the character code of this glyphname
- the name of this glyph or null if unknownpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object