Package org.apache.pdfbox.pdmodel.font
Class PDCIDFont
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.font.PDFont
-
- org.apache.pdfbox.pdmodel.font.PDSimpleFont
-
- org.apache.pdfbox.pdmodel.font.PDCIDFont
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDCIDFontType0Font,PDCIDFontType2Font
public abstract class PDCIDFont extends PDSimpleFont
This is implementation for the CIDFontType0/CIDFontType2 Fonts.- Version:
- $Revision: 1.11 $
- Author:
- Ben Litchfield
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.pdmodel.font.PDFont
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP, toUnicodeCmap
-
-
Constructor Summary
Constructors Constructor Description PDCIDFont()Constructor.PDCIDFont(COSDictionary fontDictionary)Constructor.
-
Method Summary
All 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.floatgetAverageFontWidth()This will get the average font width for all characters.longgetDefaultWidth()This will get the default width.PDRectanglegetFontBoundingBox()This will get the fonts bouding 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.voidsetDefaultWidth(long dw)This will set the default width for the glyphs of this font.-
Methods inherited from class org.apache.pdfbox.pdmodel.font.PDSimpleFont
drawString, getawtFont, getSpaceWidth, getToUnicode, isFontSubstituted, setIsFontSubstituted, setToUnicode, writeFont
-
Methods 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 Detail
-
PDCIDFont
public PDCIDFont()
Constructor.
-
PDCIDFont
public PDCIDFont(COSDictionary fontDictionary)
Constructor.- Parameters:
fontDictionary- The font dictionary according to the PDF specification.
-
-
Method Detail
-
getFontBoundingBox
public PDRectangle getFontBoundingBox() throws java.io.IOException
This will get the fonts bouding box.- Overrides:
getFontBoundingBoxin classPDSimpleFont- Returns:
- The fonts bouding box.
- Throws:
java.io.IOException- If there is an error getting the font bounding box.
-
getDefaultWidth
public long getDefaultWidth()
This will get the default width. The default value for the default width is 1000.- Returns:
- The default width for the glyphs in this font.
-
setDefaultWidth
public void setDefaultWidth(long dw)
This will set the default width for the glyphs of this font.- Parameters:
dw- The default width.
-
getFontWidth
public float getFontWidth(byte[] c, int offset, int length) throws java.io.IOExceptionThis 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:
java.io.IOException- If an error occurs while parsing.
-
getFontHeight
public float getFontHeight(byte[] c, int offset, int length) throws java.io.IOExceptionThis 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:
java.io.IOException- If an error occurs while parsing.
-
getAverageFontWidth
public float getAverageFontWidth() throws java.io.IOExceptionThis 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:
java.io.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
-
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.IOExceptionDescription copied from class:PDFontThis will perform the encoding of a character if needed.
-
-