Package org.apache.pdfbox.pdmodel.font
Class PDType0Font
java.lang.Object
org.apache.pdfbox.pdmodel.font.PDFont
org.apache.pdfbox.pdmodel.font.PDSimpleFont
org.apache.pdfbox.pdmodel.font.PDType0Font
- All Implemented Interfaces:
COSObjectable
This is implementation of the Type0 Font. See PDFBOX-605
for the related improvement issue.
- Version:
- $Revision: 1.9 $
- Author:
- Ben Litchfield
-
Field Summary
Fields inherited from class org.apache.pdfbox.pdmodel.font.PDFont
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP, toUnicodeCmap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Calling this will release all cached information.encode(byte[] c, int offset, int length) This will perform the encoding of a character if needed.floatThis will get the average font width for all characters.Looks up, creates, returns the AWT Font.Provides the descendant font.This will get the fonts bounding box.floatgetFontHeight(byte[] c, int offset, int length) This will get the font height for a character.floatgetFontWidth(byte[] c, int offset, int length) This will get the font width for a character.floatgetFontWidth(int charCode) Determines the width of the given character.Methods inherited from class org.apache.pdfbox.pdmodel.font.PDSimpleFont
determineEncoding, drawString, getSpaceWidth, getToUnicode, isFontSubstituted, setIsFontSubstituted, setToUnicode, writeFontMethods inherited from class org.apache.pdfbox.pdmodel.font.PDFont
clearResources, cmapEncoding, drawString, encodeToCID, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontDescriptor, getFontEncoding, getFontMatrix, getFontWidthFromAFMFile, getLastChar, getStringFromArray, getStringWidth, getSubType, getToUnicodeCMap, getType, getWidths, hashCode, hasToUnicode, isSymbolicFont, isType0Font, isType1Font, isType3Font, parseCmap, setBaseFont, setEncoding, setFirstChar, setFontDescriptor, setFontEncoding, setHasToUnicode, setLastChar, setWidths
-
Constructor Details
-
PDType0Font
public PDType0Font()Constructor. -
PDType0Font
Constructor.- Parameters:
fontDictionary- The font dictionary according to the PDF specification.
-
-
Method Details
-
getawtFont
Looks up, creates, returns the AWT Font.- Overrides:
getawtFontin classPDSimpleFont- Returns:
- returns the awt font to bes used for rendering
- Throws:
IOException- if something went wrong.
-
getFontBoundingBox
This will get the fonts bounding box.- Overrides:
getFontBoundingBoxin classPDSimpleFont- Returns:
- The fonts bounding box.
- Throws:
IOException- If there is an error getting the bounding box.
-
getFontWidth
This will get the font width for a character.- Overrides:
getFontWidthin classPDSimpleFont- Parameters:
c- The character code to get the width for.offset- The offset into the array.length- The length of the data.- Returns:
- The width is in 1000 unit of text space, ie 333 or 777
- Throws:
IOException- If an error occurs while parsing.
-
getFontHeight
This will get the font height for a character.- Overrides:
getFontHeightin classPDSimpleFont- Parameters:
c- The character code to get the height for.offset- The offset into the array.length- The length of the data.- Returns:
- The width is in 1000 unit of text space, ie 333 or 777
- Throws:
IOException- If an error occurs while parsing.
-
getAverageFontWidth
This will get the average font width for all characters.- Overrides:
getAverageFontWidthin classPDSimpleFont- Returns:
- The width is in 1000 unit of text space, ie 333 or 777
- Throws:
IOException- If an error occurs while parsing.
-
getFontWidth
public float getFontWidth(int charCode) Determines the width of the given character.- Overrides:
getFontWidthin classPDFont- Parameters:
charCode- the code of the given character- Returns:
- the width of the character
-
encode
Description copied from class:PDFontThis will perform the encoding of a character if needed.- Overrides:
encodein classPDFont- Parameters:
c- The character to encode.offset- The offset into the array to get the datalength- The number of bytes to read.- Returns:
- The value of the encoded character.
- Throws:
IOException- If there is an error during the encoding.
-
getDescendantFont
Provides the descendant font.- Returns:
- the descendant font.
-
clear
public void clear()Description copied from class:PDFontCalling this will release all cached information.
-