public interface PDFontLike
| Modifier and Type | Method and Description |
|---|---|
float |
getAverageFontWidth()
This will get the average font width for all characters.
|
org.apache.fontbox.util.BoundingBox |
getBoundingBox()
Returns the font's bounding box.
|
PDFontDescriptor |
getFontDescriptor()
Returns the font descriptor, may be null.
|
Matrix |
getFontMatrix()
Returns the font matrix, which represents the transformation from glyph space to text space.
|
float |
getHeight(int code)
Deprecated.
Use
getBoundingBox().getHeight() instead. |
String |
getName()
Returns the name of this font, either the PostScript "BaseName" or the Type 3 "Name".
|
Vector |
getPositionVector(int code)
Returns the position vector (v), in text space, for the given character.
|
float |
getWidth(int code)
Returns the advance width of the given character, in glyph space.
|
float |
getWidthFromFont(int code)
Returns the width of a glyph in the embedded font file.
|
boolean |
hasExplicitWidth(int code)
Returns true if the Font dictionary specifies an explicit width for the given glyph.
|
boolean |
isDamaged()
Returns true if the embedded font file is damaged.
|
boolean |
isEmbedded()
Returns true if the font file is embedded in the PDF.
|
String getName()
PDFontDescriptor getFontDescriptor()
Matrix getFontMatrix()
org.apache.fontbox.util.BoundingBox getBoundingBox()
throws IOException
IOException - if the bounding box could not be readVector getPositionVector(int code)
code - character code@Deprecated float getHeight(int code) throws IOException
getBoundingBox().getHeight() instead.
Warning: This method is deprecated in PDFBox 2.0 because there is no meaningful value which it can return. The
getWidth(int) method returns the advance width of a glyph, but there is no corresponding advance height.
The logical height of a character is the same for every character in a font, so if you want that, retrieve the
font bbox's height. Otherwise 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. See the cyan rectangles in the
DrawPrintTextLocations.java example to see this in action.
code - character codeIOException - if the height could not be readfloat getWidth(int code)
throws IOException
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.
code - character codeIOException - if the width could not be readboolean hasExplicitWidth(int code)
throws IOException
code - character codeIOException - if the font could not be readfloat getWidthFromFont(int code)
throws IOException
code - character codeIOException - if the font could not be readboolean isEmbedded()
boolean isDamaged()
float getAverageFontWidth()
Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.