| java.lang.Object org.pdfbox.pdmodel.font.PDFont
All known Subclasses: org.pdfbox.pdmodel.font.PDType0Font, org.pdfbox.pdmodel.font.PDCIDFont, org.pdfbox.pdmodel.font.PDSimpleFont,
Method Summary | |
public static void | clearResources() This will clear AFM resources that are stored statically.
This is usually not a problem unless you want to reclaim
resources for a long running process.
SPECIAL NOTE: The font calculations are currently in COSObject, which
is where they will reside until PDFont is mature enough to take them over.
PDFont is the appropriate place for them and not in COSObject but we need font
calculations for text extractaion. | abstract public void | drawString(String string, Graphics g, float fontSize, float xScale, float yScale, float x, float y) This will draw a string on a canvas using the font. | public String | encode(byte[] c, int offset, int length) This will perform the encoding of a character if needed.
Parameters: c - The character to encode. Parameters: offset - The offset into the array to get the data Parameters: length - The number of bytes to read. | public boolean | equals(Object other) | protected FontMetric | getAFM() This will get an AFM object if one exists. | abstract public float | getAverageFontWidth() This will get the average font width for all characters. | protected float | getAverageFontWidthFromAFMFile() This will attempt to get the average font width from an AFM file. | public String | getBaseFont() The PostScript name of the font. | public COSBase | getCOSObject() | protected int | getCodeFromArray(byte[] data, int offset, int length) Used for multibyte encodings.
Parameters: data - The array of data. Parameters: offset - The offset into the array. Parameters: length - The number of bytes to use. | public Encoding | getEncoding() This will get or create the encoder. | public int | getFirstChar() The code for the first char or -1 if there is none. | abstract public PDRectangle | getFontBoundingBox() This will get the fonts bouding box. | abstract public float | getFontHeight(byte[] c, int offset, int length) This will get the font width for a character.
Parameters: c - The character code to get the width for. Parameters: offset - The offset into the array. Parameters: length - The length of the data. | public PDMatrix | getFontMatrix() This will get the matrix that is used to transform glyph space to
text space. | abstract public float | getFontWidth(byte[] c, int offset, int length) This will get the font width for a character.
Parameters: c - The character code to get the width for. Parameters: offset - The offset into the array. Parameters: length - The length of the data. | protected float | getFontWidthFromAFMFile(int code) This will attempt to get the font width from an AFM file.
Parameters: code - The character code we are trying to get. | public int | getLastChar() The code for the last char or -1 if there is none. | public float | getStringWidth(String string) This will get the width of this string for this font.
Parameters: string - The string to get the width of. | public String | getSubType() This will get the subtype of font, Type1, Type3, ... | public String | getType() This will always return "Font" for fonts. | public List | getWidths() The widths of the characters. | public int | hashCode() | public void | setBaseFont(String baseFont) Set the PostScript name of the font. | public void | setEncoding(Encoding enc) The will set the encoding for this font. | public void | setFirstChar(int firstChar) Set the first character this font supports. | public void | setLastChar(int lastChar) Set the last character this font supports. | public void | setWidths(List widths) Set the widths of the characters code. |
PDFont | public PDFont()(Code) | | Constructor.
|
PDFont | public PDFont(COSDictionary fontDictionary)(Code) | | Constructor.
Parameters: fontDictionary - The font dictionary according to the PDF specification. |
clearResources | public static void clearResources()(Code) | | This will clear AFM resources that are stored statically.
This is usually not a problem unless you want to reclaim
resources for a long running process.
SPECIAL NOTE: The font calculations are currently in COSObject, which
is where they will reside until PDFont is mature enough to take them over.
PDFont is the appropriate place for them and not in COSObject but we need font
calculations for text extractaion. THIS METHOD WILL BE MOVED OR REMOVED
TO ANOTHER LOCATION IN A FUTURE VERSION OF PDFBOX.
|
drawString | abstract public void drawString(String string, Graphics g, float fontSize, float xScale, float yScale, float x, float y) throws IOException(Code) | | This will draw a string on a canvas using the font.
Parameters: string - The string to draw. Parameters: g - The graphics to draw onto. Parameters: fontSize - The size of the font to draw. Parameters: xScale - The x scaling percent. Parameters: yScale - The y scaling percent. Parameters: x - The x coordinate to draw at. Parameters: y - The y coordinate to draw at. throws: IOException - If there is an error drawing the specific string. |
encode | public String encode(byte[] c, int offset, int length) throws IOException(Code) | | This will perform the encoding of a character if needed.
Parameters: c - The character to encode. Parameters: offset - The offset into the array to get the data Parameters: length - The number of bytes to read. The value of the encoded character. throws: IOException - If there is an error during the encoding. |
getAFM | protected FontMetric getAFM() throws IOException(Code) | | This will get an AFM object if one exists.
The afm object from the name. throws: IOException - If there is an error getting the AFM object. |
getAverageFontWidth | abstract public float getAverageFontWidth() throws IOException(Code) | | This will get the average font width for all characters.
The width is in 1000 unit of text space, ie 333 or 777 throws: IOException - If an error occurs while parsing. |
getAverageFontWidthFromAFMFile | protected float getAverageFontWidthFromAFMFile() throws IOException(Code) | | This will attempt to get the average font width from an AFM file.
The average font width from the AFM file. throws: IOException - if we cannot find the width. |
getBaseFont | public String getBaseFont()(Code) | | The PostScript name of the font.
The postscript name of the font. |
getCodeFromArray | protected int getCodeFromArray(byte[] data, int offset, int length)(Code) | | Used for multibyte encodings.
Parameters: data - The array of data. Parameters: offset - The offset into the array. Parameters: length - The number of bytes to use. The int value of data from the array. |
getEncoding | public Encoding getEncoding() throws IOException(Code) | | This will get or create the encoder.
modified by Christophe Huault : DGBS Strasbourg huault@free.fr october 2004
The encoding to use. throws: IOException - If there is an error getting the encoding. |
getFirstChar | public int getFirstChar()(Code) | | The code for the first char or -1 if there is none.
The code for the first character. |
getFontBoundingBox | abstract public PDRectangle getFontBoundingBox() throws IOException(Code) | | This will get the fonts bouding box.
The fonts bouding box. throws: IOException - If there is an error getting the bounding box. |
getFontHeight | abstract public float getFontHeight(byte[] c, int offset, int length) throws IOException(Code) | | This will get the font width for a character.
Parameters: c - The character code to get the width for. Parameters: offset - The offset into the array. Parameters: length - The length of the data. The width is in 1000 unit of text space, ie 333 or 777 throws: IOException - If an error occurs while parsing. |
getFontMatrix | public PDMatrix getFontMatrix()(Code) | | This will get the matrix that is used to transform glyph space to
text space. By default there are 1000 glyph units to 1 text space
unit, but type3 fonts can use any value.
Note:If this is a type3 font then it can be modified via the PDType3Font.setFontMatrix, otherwise this
is a read-only property.
The matrix to transform from glyph space to text space. |
getFontWidth | abstract public float getFontWidth(byte[] c, int offset, int length) throws IOException(Code) | | This will get the font width for a character.
Parameters: c - The character code to get the width for. Parameters: offset - The offset into the array. Parameters: length - The length of the data. The width is in 1000 unit of text space, ie 333 or 777 throws: IOException - If an error occurs while parsing. |
getFontWidthFromAFMFile | protected float getFontWidthFromAFMFile(int code) throws IOException(Code) | | This will attempt to get the font width from an AFM file.
Parameters: code - The character code we are trying to get. The font width from the AFM file. throws: IOException - if we cannot find the width. |
getLastChar | public int getLastChar()(Code) | | The code for the last char or -1 if there is none.
The code for the last character. |
getStringWidth | public float getStringWidth(String string) throws IOException(Code) | | This will get the width of this string for this font.
Parameters: string - The string to get the width of. The width of the string in 1000 units of text space, ie 333 567... throws: IOException - If there is an error getting the width information. |
getSubType | public String getSubType()(Code) | | This will get the subtype of font, Type1, Type3, ...
The type of font that this is. |
getType | public String getType()(Code) | | This will always return "Font" for fonts.
The type of object that this is. |
getWidths | public List getWidths()(Code) | | The widths of the characters. This will be null for the standard 14 fonts.
The widths of the characters. |
hashCode | public int hashCode()(Code) | | |
setBaseFont | public void setBaseFont(String baseFont)(Code) | | Set the PostScript name of the font.
Parameters: baseFont - The postscript name for the font. |
setEncoding | public void setEncoding(Encoding enc)(Code) | | The will set the encoding for this font.
Parameters: enc - The font encoding. |
setFirstChar | public void setFirstChar(int firstChar)(Code) | | Set the first character this font supports.
Parameters: firstChar - The first character. |
setLastChar | public void setLastChar(int lastChar)(Code) | | Set the last character this font supports.
Parameters: lastChar - The last character. |
setWidths | public void setWidths(List widths)(Code) | | Set the widths of the characters code.
Parameters: widths - The widths of the character codes. |
|
|