Package com.itextpdf.text.pdf
Class FontDetails
- java.lang.Object
-
- com.itextpdf.text.pdf.FontDetails
-
class FontDetails extends java.lang.ObjectEach font in the document will have an instance of this class where the characters used will be represented.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BaseFontbaseFontThe font(package private) CJKFontcjkFontThe font if it's an instance ofCJKFont(package private) IntHashtablecjkTagIntHashtable with CIDs of CJK glyphs that are used in the text.(package private) PdfNamefontNameThe font name that appears in the document body stream(package private) intfontTypeThe font type(package private) PdfIndirectReferenceindirectReferenceThe indirect reference to this font(package private) java.util.HashMap<java.lang.Integer,int[]>longTagThe map used with double byte encodings.(package private) byte[]shortTagThe array used with single byte encodingsprotected booleansubsetIndicates if only a subset of the glyphs and widths for that particular encoding should be included in the document.(package private) booleansymbolictrueif the font is symbolic(package private) TrueTypeFontUnicodettuThe font if it's an instance ofTrueTypeFontUnicode
-
Constructor Summary
Constructors Constructor Description FontDetails(PdfName fontName, PdfIndirectReference indirectReference, BaseFont baseFont)Each font used in a document has an instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleancanApplyGlyphSubstitution()(package private) byte[]convertToBytes(java.lang.String text)Converts the text into bytes to be placed in the document.private byte[]convertToBytesAfterGlyphSubstitution(java.lang.String text)(package private) java.lang.Object[]convertToBytesGid(java.lang.String gids)(package private) BaseFontgetBaseFont()Gets theBaseFontof this font.(package private) PdfNamegetFontName()Gets the font name as it appears in the document body.private GlyphRepositionergetGlyphRepositioner()(package private) PdfIndirectReferencegetIndirectReference()Gets the indirect reference to this font.booleanisSubset()Indicates if all the glyphs and widths for that particular encoding should be included in the document.voidsetSubset(boolean subset)Indicates if all the glyphs and widths for that particular encoding should be included in the document.voidwriteFont(PdfWriter writer)Writes the font definition to the document.
-
-
-
Field Detail
-
indirectReference
PdfIndirectReference indirectReference
The indirect reference to this font
-
fontName
PdfName fontName
The font name that appears in the document body stream
-
baseFont
BaseFont baseFont
The font
-
ttu
TrueTypeFontUnicode ttu
The font if it's an instance ofTrueTypeFontUnicode
-
cjkFont
CJKFont cjkFont
The font if it's an instance ofCJKFont
-
shortTag
byte[] shortTag
The array used with single byte encodings
-
longTag
java.util.HashMap<java.lang.Integer,int[]> longTag
The map used with double byte encodings. The key is Integer(glyph) and the value is int[]{glyph, width, Unicode code}
-
cjkTag
IntHashtable cjkTag
IntHashtable with CIDs of CJK glyphs that are used in the text.
-
fontType
int fontType
The font type
-
symbolic
boolean symbolic
trueif the font is symbolic
-
subset
protected boolean subset
Indicates if only a subset of the glyphs and widths for that particular encoding should be included in the document.
-
-
Constructor Detail
-
FontDetails
FontDetails(PdfName fontName, PdfIndirectReference indirectReference, BaseFont baseFont)
Each font used in a document has an instance of this class. This class stores the characters used in the document and other specifics unique to the current working document.- Parameters:
fontName- the font nameindirectReference- the indirect reference to the fontbaseFont- theBaseFont
-
-
Method Detail
-
getIndirectReference
PdfIndirectReference getIndirectReference()
Gets the indirect reference to this font.- Returns:
- the indirect reference to this font
-
getFontName
PdfName getFontName()
Gets the font name as it appears in the document body.- Returns:
- the font name
-
getBaseFont
BaseFont getBaseFont()
Gets theBaseFontof this font.- Returns:
- the
BaseFontof this font
-
convertToBytesGid
java.lang.Object[] convertToBytesGid(java.lang.String gids)
-
convertToBytes
byte[] convertToBytes(java.lang.String text)
Converts the text into bytes to be placed in the document. The conversion is done according to the font and the encoding and the characters used are stored.- Parameters:
text- the text to convert- Returns:
- the conversion
-
canApplyGlyphSubstitution
private boolean canApplyGlyphSubstitution()
-
convertToBytesAfterGlyphSubstitution
private byte[] convertToBytesAfterGlyphSubstitution(java.lang.String text) throws java.io.UnsupportedEncodingException- Throws:
java.io.UnsupportedEncodingException
-
getGlyphRepositioner
private GlyphRepositioner getGlyphRepositioner()
-
writeFont
public void writeFont(PdfWriter writer)
Writes the font definition to the document.- Parameters:
writer- thePdfWriterof this document
-
isSubset
public boolean isSubset()
Indicates if all the glyphs and widths for that particular encoding should be included in the document.- Returns:
falseto include all the glyphs and widths.
-
setSubset
public void setSubset(boolean subset)
Indicates if all the glyphs and widths for that particular encoding should be included in the document. Set tofalseto include all.- Parameters:
subset- new value of property subset
-
-