|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pdfbox.pdmodel.font.PDFont
org.apache.pdfbox.pdmodel.font.PDSimpleFont
public abstract class PDSimpleFont
This class contains implementation details of the simple pdf fonts.
Field Summary |
---|
Fields inherited from class org.apache.pdfbox.pdmodel.font.PDFont |
---|
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP |
Constructor Summary | |
---|---|
PDSimpleFont()
Constructor. |
|
PDSimpleFont(COSDictionary fontDictionary)
Constructor. |
Method Summary | |
---|---|
protected void |
determineEncoding()
Determines the encoding for the font. |
void |
drawString(String string,
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. |
COSBase |
getToUnicode()
This will get the ToUnicode object. |
void |
setToUnicode(COSBase unicode)
This will set the ToUnicode object. |
protected void |
writeFont(Graphics2D g2d,
AffineTransform at,
Font awtFont,
float x,
float y,
String string)
This will draw a string on a canvas using the font. |
Methods inherited from class org.apache.pdfbox.pdmodel.font.PDFont |
---|
clearResources, cmapEncoding, createString, encode, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontDescriptor, getFontEncoding, getFontMatrix, getFontWidth, getFontWidthFromAFMFile, getLastChar, getStringWidth, getSubType, getType, getWidths, hashCode, hasToUnicode, isType1Font, parseCmap, setBaseFont, setEncoding, setFirstChar, setFontDescriptor, setFontEncoding, setHasToUnicode, setLastChar, setWidths |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PDSimpleFont()
public PDSimpleFont(COSDictionary fontDictionary)
fontDictionary
- The font dictionary according to the PDF specification.Method Detail |
---|
public Font getawtFont() throws IOException
IOException
public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException
drawString
in class PDFont
string
- The string to draw.g
- The graphics to draw onto.fontSize
- The size of the font to draw.at
- The transformation matrix with all infos 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, Font awtFont, float x, float y, String string)
g2d
- The graphics to draw onto.at
- The transformation matrix with all infos for scaling and shearing of the font.awtFont
- The font to draw.x
- The x coordinate to draw at.y
- The y coordinate to draw at.string
- The string to draw.protected void determineEncoding()
determineEncoding
in class PDFont
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |