Package com.sun.pdfview.font
Class CIDFontType2
- java.lang.Object
-
- com.sun.pdfview.font.PDFFont
-
- com.sun.pdfview.font.OutlineFont
-
- com.sun.pdfview.font.TTFFont
-
- com.sun.pdfview.font.CIDFontType2
-
public class CIDFontType2 extends TTFFont
a font object derived from a CID font.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.pdfview.font.TTFFont
TTFFont.PointRec, TTFFont.RenderState
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBuffer
cidToGidMap
the CIDtoGID map, if anyprivate int
defaultWidth
private int
defaultWidthVertical
private java.util.Map<java.lang.Character,java.lang.Float>
widths
The width of each glyph from the DW and W arraysprivate java.util.Map<java.lang.Character,java.lang.Float>
widthsVertical
The vertical width of each glyph from the DW2 and W2 arrays
-
Constructor Summary
Constructors Constructor Description CIDFontType2(java.lang.String baseName, PDFObject fontObj, PDFFontDescriptor descriptor)
create a new CIDFontType2 object based on the name of a built-in font and the font descriptor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDefaultWidth()
Get the default width in text spaceint
getDefaultWidthVertical()
Get the default vertical width in text spaceprotected java.awt.geom.GeneralPath
getOutline(char src, float width)
Get the outline of a character given the character code.float
getWidth(char code, java.lang.String name)
Get the width of a given characterfloat
getWidthVertical(char code, java.lang.String name)
Get the vertical width of a given characterprivate void
parseWidths(PDFObject fontObj)
Parse the Widths array and DW object-
Methods inherited from class com.sun.pdfview.font.TTFFont
getOutline, getOutline, getOutlineFromCMaps, renderCompoundGlyph, renderSimpleGlyph
-
Methods inherited from class com.sun.pdfview.font.OutlineFont
getCharCount, getFirstChar, getGlyph, getLastChar
-
Methods inherited from class com.sun.pdfview.font.PDFFont
equals, getBaseFont, getCachedGlyph, getDescriptor, getEncoding, getFont, getGlyphs, getSubtype, getUnicodeMap, hashCode, setBaseFont, setDescriptor, setEncoding, setSubtype, setUnicodeMap, toString
-
-
-
-
Field Detail
-
widths
private java.util.Map<java.lang.Character,java.lang.Float> widths
The width of each glyph from the DW and W arrays
-
widthsVertical
private java.util.Map<java.lang.Character,java.lang.Float> widthsVertical
The vertical width of each glyph from the DW2 and W2 arrays
-
defaultWidth
private int defaultWidth
-
defaultWidthVertical
private int defaultWidthVertical
-
cidToGidMap
private java.nio.ByteBuffer cidToGidMap
the CIDtoGID map, if any
-
-
Constructor Detail
-
CIDFontType2
public CIDFontType2(java.lang.String baseName, PDFObject fontObj, PDFFontDescriptor descriptor) throws java.io.IOException
create a new CIDFontType2 object based on the name of a built-in font and the font descriptor- Parameters:
baseName
- the name of the font, from the PDF filefontObj
- a dictionary that contains the DW (defaultWidth) and W (width) parametersdescriptor
- a descriptor for the font- Throws:
java.io.IOException
-
-
Method Detail
-
parseWidths
private void parseWidths(PDFObject fontObj) throws java.io.IOException
Parse the Widths array and DW object- Throws:
java.io.IOException
-
getDefaultWidth
public int getDefaultWidth()
Get the default width in text space- Overrides:
getDefaultWidth
in classOutlineFont
-
getWidth
public float getWidth(char code, java.lang.String name)
Get the width of a given character- Overrides:
getWidth
in classOutlineFont
-
getDefaultWidthVertical
public int getDefaultWidthVertical()
Get the default vertical width in text space
-
getWidthVertical
public float getWidthVertical(char code, java.lang.String name)
Get the vertical width of a given character
-
getOutline
protected java.awt.geom.GeneralPath getOutline(char src, float width)
Get the outline of a character given the character code. We interpose here in order to avoid using the CMap of the font in a CID mapped font.- Overrides:
getOutline
in classTTFFont
- Parameters:
src
- the character code of the desired glyph- Returns:
- the glyph outline
-
-