| Modifier and Type | Field and Description |
|---|---|
| private static final Map | |
| private final Map | codeToBytesMap
to improve encoding speed. |
| private BoundingBox | |
| private Matrix | |
| private final AffineTransform | |
| private final FontBoxFont | genericFont
embedded or system font for rendering. |
| private final boolean | |
| private final boolean | |
| private static final Log | |
| private static final int | |
| private final Type1Font | type1font
embedded font. |
| Access | Constructor and Description |
|---|---|
| public | PDType1Font(Standard14Fonts.
One of the standard 14 PostScript names, e.g. baseFontFontName#HELVETICA_BOLD.Creates a Type 1 standard 14 font for embedding. |
| public | PDType1Font(PDDocument
PDF document to write to doc, InputStream PFB file stream pfbIn)Creates a new Type 1 font for embedding. |
| public | PDType1Font(PDDocument
PDF document to write to doc, InputStream PFB file stream pfbIn, Encoding encoding to be used for the font encoding)Creates a new Type 1 font for embedding. |
| public | PDType1Font(COSDictionary
font dictionary. fontDictionary)Creates a Type 1 font from a Font dictionary in a PDF. |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| protected byte[] | encode(int
Unicode code point. unicode)Implements abstract org. Encodes the given Unicode code point for use in a PDF content stream. |
| private static int | |
| private BoundingBox | |
| public float | getAverageFontWidth()
Overrides org. Implements org. This will get the average font width for all characters. |
| public final String | |
| public BoundingBox | getBoundingBox()
Implements org. Returns the font's bounding box. |
| public FontBoxFont | getFontBoxFont()
Implements abstract org. Returns the embedded or system font used for rendering. |
| public final Matrix | getFontMatrix()
Overrides org. Implements org. Returns the font matrix, which represents the transformation from glyph space to text space. |
| public float | getHeight(int
character code code)Implements org. Returns the height of the given character, in glyph space. |
| public String | getName()
Implements org. Returns the name of this font, either the PostScript "BaseName" or the Type 3 "Name". |
| private String | getNameInFont(String name)
Maps a PostScript glyph name to the name in the underlying font, for example when using a TTF font we might map "W" to "uni0057". |
| public GeneralPath | getNormalizedPath(int
character code in a PDF. Not to be confused with unicode. code)Implements org. Returns the normalized glyph path for the given character code in a PDF. |
| public GeneralPath | getPath(String
glyph name name)Implements abstract org. Returns the path for the character with the given name. |
| public GeneralPath | getPath(int
character code in a PDF. Not to be confused with unicode. code)Implements org. Returns the glyph path for the given character code. |
| public Type1Font | Returns: the embedded or substituted Type 1 font or nullReturns the embedded or substituted Type 1 font, or null if there is none. |
| public float | getWidthFromFont(int
character code code)Implements org. Returns the width of a glyph in the embedded font file. |
| public boolean | hasGlyph(String
glyph name name)Implements abstract org. Returns true if the font contains the character with the given name. |
| public boolean | hasGlyph(int
character code in a PDF. Not to be confused with unicode. code)Implements org. Returns true if this font contains a glyph for the given character code in a PDF. |
| public boolean | isDamaged()
Implements org. Returns true if the embedded font file is damaged. |
| public boolean | isEmbedded()
Implements org. Returns true if the font file is embedded in the PDF. |
| public int | readCode(InputStream
string stream in)Implements abstract org. Reads a character code from a content stream string. |
| protected Encoding | readEncodingFromFont()
Implements abstract org. Called by readEncoding() if the encoding needs to be extracted from the font file. |
| private int | Returns: repaired Length1 valueType 1 stream bytes bytes, int Length1 from the Type 1 stream length1)Some Type 1 fonts have an invalid Length1, which causes the binary segment of the font to be truncated, see PDFBOX-2350, PDFBOX-3677. |
| private int | Returns: repaired Length2 valueType 1 stream bytes bytes, int Length1 from the Type 1 stream length1, int Length2 from the Type 1 stream length2)Some Type 1 fonts have an invalid Length2, see PDFBOX-3475. |
| ALT_NAMES | back to summary |
|---|---|
| private static final Map<String, String> ALT_NAMES | |
| codeToBytesMap | back to summary |
|---|---|
| private final Map<Integer, byte[]> codeToBytesMap to improve encoding speed. | |
| fontBBox | back to summary |
|---|---|
| private BoundingBox fontBBox | |
| fontMatrix | back to summary |
|---|---|
| private Matrix fontMatrix | |
| fontMatrixTransform | back to summary |
|---|---|
| private final AffineTransform fontMatrixTransform | |
| genericFont | back to summary |
|---|---|
| private final FontBoxFont genericFont embedded or system font for rendering. | |
| isDamaged | back to summary |
|---|---|
| private final boolean isDamaged | |
| isEmbedded | back to summary |
|---|---|
| private final boolean isEmbedded | |
| LOG | back to summary |
|---|---|
| private static final Log LOG | |
| PFB_START_MARKER | back to summary |
|---|---|
| private static final int PFB_START_MARKER | |
| type1font | back to summary |
|---|---|
| private final Type1Font type1font embedded font. | |
| PDType1Font | back to summary |
|---|---|
| public PDType1Font(Standard14Fonts. Creates a Type 1 standard 14 font for embedding.
| |
| PDType1Font | back to summary |
|---|---|
| public PDType1Font(PDDocument doc, InputStream pfbIn) throws IOException Creates a new Type 1 font for embedding.
| |
| PDType1Font | back to summary |
|---|---|
| public PDType1Font(PDDocument doc, InputStream pfbIn, Encoding encoding) throws IOException Creates a new Type 1 font for embedding.
| |
| PDType1Font | back to summary |
|---|---|
| public PDType1Font(COSDictionary fontDictionary) throws IOException Creates a Type 1 font from a Font dictionary in a PDF.
| |
| codeToName | back to summary |
|---|---|
| public String codeToName(int code) throws IOException | |
| encode | back to summary |
|---|---|
| protected byte[] encode(int unicode) throws IOException Implements abstract org. Doc from org. Encodes the given Unicode code point for use in a PDF content stream. Content streams use a multi-byte encoding with 1 to 4 bytes. This method is called when embedding text in PDFs and when filling in fields.
| |
| findBinaryOffsetAfterExec | back to summary |
|---|---|
| private static int findBinaryOffsetAfterExec(byte[] bytes, int startOffset) | |
| generateBoundingBox | back to summary |
|---|---|
| private BoundingBox generateBoundingBox() throws IOException | |
| getAverageFontWidth | back to summary |
|---|---|
| public float getAverageFontWidth() Overrides org. Implements org. Doc from org. This will get the average font width for all characters.
| |
| getBaseFont | back to summary |
|---|---|
| public final String getBaseFont() Returns the PostScript name of the font.
| |
| getBoundingBox | back to summary |
|---|---|
| public BoundingBox getBoundingBox() throws IOException Implements org. Doc from org. Returns the font's bounding box.
| |
| getFontBoxFont | back to summary |
|---|---|
| public FontBoxFont getFontBoxFont() Implements abstract org. Doc from org. Returns the embedded or system font used for rendering. This is never null.
| |
| getFontMatrix | back to summary |
|---|---|
| public final Matrix getFontMatrix() Overrides org. Implements org. Doc from org. Returns the font matrix, which represents the transformation from glyph space to text space. | |
| getHeight | back to summary |
|---|---|
| public float getHeight(int code) throws IOException Implements org. Doc from org. Returns the height of the given character, in glyph space. This can be expensive to calculate. Results are only approximate. Warning This method is deprecated in PDFBox 2.0 because there is no meaningful value which it can return. The
| |
| getName | back to summary |
|---|---|
| public String getName() Implements org. Doc from org. Returns the name of this font, either the PostScript "BaseName" or the Type 3 "Name". | |
| getNameInFont | back to summary |
|---|---|
| private String getNameInFont(String name) throws IOException Maps a PostScript glyph name to the name in the underlying font, for example when using a TTF font we might map "W" to "uni0057". | |
| getNormalizedPath | back to summary |
|---|---|
| public GeneralPath getNormalizedPath(int code) throws IOException Implements org. Doc from org. Returns the normalized glyph path for the given character code in a PDF. The resulting path is normalized to the PostScript 1000 unit square, and fallback glyphs are returned where appropriate, e.g. for missing glyphs.
| |
| getPath | back to summary |
|---|---|
| public GeneralPath getPath(String name) throws IOException Implements abstract org. Doc from org. Returns the path for the character with the given name. For some fonts, GIDs may be used instead of names when calling this method. *
| |
| getPath | back to summary |
|---|---|
| public GeneralPath getPath(int code) throws IOException Implements org. Doc from org. Returns the glyph path for the given character code.
| |
| getType1Font | back to summary |
|---|---|
| public Type1Font getType1Font() Returns the embedded or substituted Type 1 font, or null if there is none.
| |
| getWidthFromFont | back to summary |
|---|---|
| public float getWidthFromFont(int code) throws IOException Implements org. Doc from org. Returns the width of a glyph in the embedded font file.
| |
| hasGlyph | back to summary |
|---|---|
| public boolean hasGlyph(String name) throws IOException Implements abstract org. Doc from org. Returns true if the font contains the character with the given name.
| |
| hasGlyph | back to summary |
|---|---|
| public boolean hasGlyph(int code) throws IOException Implements org. Doc from org. Returns true if this font contains a glyph for the given character code in a PDF.
| |
| isDamaged | back to summary |
|---|---|
| public boolean isDamaged() Implements org. Doc from org. Returns true if the embedded font file is damaged.
| |
| isEmbedded | back to summary |
|---|---|
| public boolean isEmbedded() Implements org. Doc from org. Returns true if the font file is embedded in the PDF.
| |
| readCode | back to summary |
|---|---|
| public int readCode(InputStream in) throws IOException Implements abstract org. Doc from org. Reads a character code from a content stream string. Codes may be up to 4 bytes long.
| |
| readEncodingFromFont | back to summary |
|---|---|
| protected Encoding readEncodingFromFont() throws IOException Implements abstract org. Doc from org. Called by readEncoding() if the encoding needs to be extracted from the font file.
| |
| repairLength1 | back to summary |
|---|---|
| private int repairLength1(byte[] bytes, int length1) Some Type 1 fonts have an invalid Length1, which causes the binary segment of the font to be truncated, see PDFBOX-2350, PDFBOX-3677.
| |
| repairLength2 | back to summary |
|---|---|
| private int repairLength2(byte[] bytes, int length1, int length2) Some Type 1 fonts have an invalid Length2, see PDFBOX-3475. A negative /Length2 brings an IllegalArgumentException in Arrays.copyOfRange(), a huge value eats up memory because of padding.
| |