public abstract class PDSimpleFont extends PDFont
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP, toUnicodeCmap
Constructor and Description |
---|
PDSimpleFont()
Constructor.
|
PDSimpleFont(COSDictionary fontDictionary)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
determineEncoding()
Determines the encoding for the font.
|
void |
drawString(String string,
int[] codePoints,
Graphics g,
float fontSize,
AffineTransform at,
float x,
float y)
This will draw a string on a canvas using the font.
|
float |
getAverageFontWidth()
This will get the average font width for all characters.
|
Font |
getawtFont()
Looks up, creates, returns the AWT Font.
|
PDRectangle |
getFontBoundingBox()
This will get the fonts bounding box.
|
float |
getFontHeight(byte[] c,
int offset,
int length)
This will get the font height for a character.
|
float |
getFontWidth(byte[] c,
int offset,
int length)
This will get the font width for a character.
|
float |
getSpaceWidth()
Determines the width of the space character.
|
COSBase |
getToUnicode()
This will get the ToUnicode object.
|
protected boolean |
isFontSubstituted()
This will get the value for isFontSubstituted, which indicates
if the font was substituted due to a problem with the embedded one.
|
protected void |
setIsFontSubstituted(boolean isSubstituted)
This will set the value for isFontSubstituted.
|
void |
setToUnicode(COSBase unicode)
This will set the ToUnicode object.
|
protected void |
writeFont(Graphics2D g2d,
AffineTransform at,
float x,
float y,
GlyphVector glyphs)
This will draw a string on a canvas using the font.
|
clear, clearResources, cmapEncoding, drawString, encode, encodeToCID, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontDescriptor, getFontEncoding, getFontMatrix, getFontWidth, getFontWidthFromAFMFile, getLastChar, getStringFromArray, getStringWidth, getSubType, getToUnicodeCMap, getType, getWidths, hashCode, hasToUnicode, isSymbolicFont, isType0Font, isType1Font, isType3Font, parseCmap, setBaseFont, setEncoding, setFirstChar, setFontDescriptor, setFontEncoding, setHasToUnicode, setLastChar, setWidths
public PDSimpleFont()
public PDSimpleFont(COSDictionary fontDictionary)
fontDictionary
- The font dictionary according to the PDF specification.public Font getawtFont() throws IOException
IOException
- if something went wrong.public void drawString(String string, int[] codePoints, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException
drawString
in class PDFont
string
- The string to draw.codePoints
- The codePoints of the given string.g
- The graphics to draw onto.fontSize
- The size of the font to draw.at
- The transformation matrix with all information for scaling and shearing of the font.x
- The x coordinate to draw at.y
- The y coordinate to draw at.IOException
- If there is an error drawing the specific string.public float getFontHeight(byte[] c, int offset, int length) throws IOException
getFontHeight
in class PDFont
c
- The character code to get the width for.offset
- The offset into the array.length
- The length of the data.IOException
- If an error occurs while parsing.public float getFontWidth(byte[] c, int offset, int length) throws IOException
getFontWidth
in class PDFont
c
- The character code to get the width for.offset
- The offset into the array.length
- The length of the data.IOException
- If an error occurs while parsing.public float getAverageFontWidth() throws IOException
getAverageFontWidth
in class PDFont
IOException
- If an error occurs while parsing.public COSBase getToUnicode()
public void setToUnicode(COSBase unicode)
unicode
- The unicode object.public PDRectangle getFontBoundingBox() throws IOException
getFontBoundingBox
in class PDFont
IOException
- If there is an error getting the bounding box.protected void writeFont(Graphics2D g2d, AffineTransform at, float x, float y, GlyphVector glyphs)
g2d
- The graphics to draw onto.at
- The transformation matrix with all information for scaling and shearing of the font.x
- The x coordinate to draw at.y
- The y coordinate to draw at.glyphs
- The GlyphVector containing the glyphs to be drawn.protected void determineEncoding()
determineEncoding
in class PDFont
protected boolean isFontSubstituted()
protected void setIsFontSubstituted(boolean isSubstituted)
isSubstituted
- true if the font was substitutedpublic float getSpaceWidth()
getSpaceWidth
in class PDFont
Copyright © 2002-2015 The Apache Software Foundation. All Rights Reserved.