Package org.apache.pdfbox.pdmodel.font
Class PDType1Font
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.font.PDFont
-
- org.apache.pdfbox.pdmodel.font.PDSimpleFont
-
- org.apache.pdfbox.pdmodel.font.PDType1Font
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDMMType1Font,PDType1AfmPfbFont
public class PDType1Font extends PDSimpleFont
This is implementation of the Type1 Font.- Version:
- $Revision: 1.11 $
- Author:
- Ben Litchfield
-
-
Field Summary
Fields Modifier and Type Field Description static PDType1FontCOURIERStandard Base 14 Font.static PDType1FontCOURIER_BOLDStandard Base 14 Font.static PDType1FontCOURIER_BOLD_OBLIQUEStandard Base 14 Font.static PDType1FontCOURIER_OBLIQUEStandard Base 14 Font.static PDType1FontHELVETICAStandard Base 14 Font.static PDType1FontHELVETICA_BOLDStandard Base 14 Font.static PDType1FontHELVETICA_BOLD_OBLIQUEStandard Base 14 Font.static PDType1FontHELVETICA_OBLIQUEStandard Base 14 Font.static PDType1FontSYMBOLStandard Base 14 Font.static PDType1FontTIMES_BOLDStandard Base 14 Font.static PDType1FontTIMES_BOLD_ITALICStandard Base 14 Font.static PDType1FontTIMES_ITALICStandard Base 14 Font.static PDType1FontTIMES_ROMANStandard Base 14 Font.static PDType1FontZAPF_DINGBATSStandard Base 14 Font.-
Fields inherited from class org.apache.pdfbox.pdmodel.font.PDFont
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP, toUnicodeCmap
-
-
Constructor Summary
Constructors Constructor Description PDType1Font()Constructor.PDType1Font(java.lang.String baseFont)Constructor.PDType1Font(COSDictionary fontDictionary)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Calling this will release all cached information.protected voiddetermineEncoding()Determines the encoding for the font.java.lang.Stringencode(byte[] c, int offset, int length)This will perform the encoding of a character if needed.intencodeToCID(byte[] c, int offset, int length)java.awt.FontgetawtFont()Looks up, creates, returns the AWT Font.PDMatrixgetFontMatrix()This will get the matrix that is used to transform glyph space to text space.static java.lang.String[]getStandard14Names()This will get the names of the standard 14 fonts.static PDType1FontgetStandardFont(java.lang.String name)A convenience method to get one of the standard 14 font from name.-
Methods inherited from class org.apache.pdfbox.pdmodel.font.PDSimpleFont
drawString, getAverageFontWidth, getFontBoundingBox, getFontHeight, getFontWidth, getSpaceWidth, getToUnicode, isFontSubstituted, setIsFontSubstituted, setToUnicode, writeFont
-
Methods inherited from class org.apache.pdfbox.pdmodel.font.PDFont
clearResources, cmapEncoding, drawString, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontDescriptor, getFontEncoding, getFontWidth, getFontWidthFromAFMFile, getLastChar, getStringFromArray, getStringWidth, getSubType, getToUnicodeCMap, getType, getWidths, hashCode, hasToUnicode, isSymbolicFont, isType0Font, isType1Font, isType3Font, parseCmap, setBaseFont, setEncoding, setFirstChar, setFontDescriptor, setFontEncoding, setHasToUnicode, setLastChar, setWidths
-
-
-
-
Field Detail
-
TIMES_ROMAN
public static final PDType1Font TIMES_ROMAN
Standard Base 14 Font.
-
TIMES_BOLD
public static final PDType1Font TIMES_BOLD
Standard Base 14 Font.
-
TIMES_ITALIC
public static final PDType1Font TIMES_ITALIC
Standard Base 14 Font.
-
TIMES_BOLD_ITALIC
public static final PDType1Font TIMES_BOLD_ITALIC
Standard Base 14 Font.
-
HELVETICA
public static final PDType1Font HELVETICA
Standard Base 14 Font.
-
HELVETICA_BOLD
public static final PDType1Font HELVETICA_BOLD
Standard Base 14 Font.
-
HELVETICA_OBLIQUE
public static final PDType1Font HELVETICA_OBLIQUE
Standard Base 14 Font.
-
HELVETICA_BOLD_OBLIQUE
public static final PDType1Font HELVETICA_BOLD_OBLIQUE
Standard Base 14 Font.
-
COURIER
public static final PDType1Font COURIER
Standard Base 14 Font.
-
COURIER_BOLD
public static final PDType1Font COURIER_BOLD
Standard Base 14 Font.
-
COURIER_OBLIQUE
public static final PDType1Font COURIER_OBLIQUE
Standard Base 14 Font.
-
COURIER_BOLD_OBLIQUE
public static final PDType1Font COURIER_BOLD_OBLIQUE
Standard Base 14 Font.
-
SYMBOL
public static final PDType1Font SYMBOL
Standard Base 14 Font.
-
ZAPF_DINGBATS
public static final PDType1Font ZAPF_DINGBATS
Standard Base 14 Font.
-
-
Constructor Detail
-
PDType1Font
public PDType1Font()
Constructor.
-
PDType1Font
public PDType1Font(COSDictionary fontDictionary)
Constructor.- Parameters:
fontDictionary- The font dictionary according to the PDF specification.
-
PDType1Font
public PDType1Font(java.lang.String baseFont)
Constructor.- Parameters:
baseFont- The base font for this font.
-
-
Method Detail
-
getStandardFont
public static PDType1Font getStandardFont(java.lang.String name)
A convenience method to get one of the standard 14 font from name.- Parameters:
name- The name of the font to get.- Returns:
- The font that matches the name or null if it does not exist.
-
getStandard14Names
public static java.lang.String[] getStandard14Names()
This will get the names of the standard 14 fonts.- Returns:
- An array of the names of the standard 14 fonts.
-
getawtFont
public java.awt.Font getawtFont() throws java.io.IOExceptionLooks up, creates, returns the AWT Font.- Overrides:
getawtFontin classPDSimpleFont- Returns:
- returns the awt font to bes used for rendering
- Throws:
java.io.IOException- if something went wrong.
-
determineEncoding
protected void determineEncoding()
Description copied from class:PDSimpleFontDetermines the encoding for the font. This method as to be overwritten, as there are different possibilities to define a mapping.- Overrides:
determineEncodingin classPDSimpleFont
-
encode
public java.lang.String encode(byte[] c, int offset, int length) throws java.io.IOExceptionThis will perform the encoding of a character if needed.
-
encodeToCID
public int encodeToCID(byte[] c, int offset, int length) throws java.io.IOException- Overrides:
encodeToCIDin classPDFont- Throws:
java.io.IOException
-
getFontMatrix
public PDMatrix getFontMatrix()
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.- Overrides:
getFontMatrixin classPDFont- Returns:
- The matrix to transform from glyph space to text space.
-
-