Package com.itextpdf.kernel.font
Class PdfType0Font
java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.kernel.font.PdfFont
com.itextpdf.kernel.font.PdfType0Font
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intCIDFont Type0 (Type1 outlines).protected static final intCIDFont Type2 (TrueType outlines).protected intprotected CMapEncodingprotected char[]protected booleanFields inherited from class com.itextpdf.kernel.font.PdfFont
embedded, EMPTY_BYTES, fontProgram, newFont, notdefGlyphs, SIMPLE_FONT_MAX_CHAR_CODE_VALUE, subset, subsetRanges -
Method Summary
Modifier and TypeMethodDescriptionintappendAnyGlyph(String text, int from, List<Glyph> glyphs) Append any single glyph, even notdef.booleanappendDecodedCodesToGlyphsList(List<Glyph> list, PdfString characterCodes) Decodes sequence of character codes (e.g.intappendGlyphs(String text, int from, int to, List<Glyph> glyphs) Append all supported glyphs and return number of processed chars.booleancontainsGlyph(int unicode) Check whether font contains glyph with specified unicode.byte[]convertToBytes(Glyph glyph) byte[]convertToBytes(GlyphLine glyphLine) byte[]convertToBytes(String text) Converts the text into bytes to be placed in the document.createGlyphLine(String content) decodeIntoGlyphLine(PdfString characterCodes) Decodes sequence of character codes (e.g.voidflush()To manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e.protected PdfDictionarygetCidFont(PdfDictionary fontDescriptor, String fontName, boolean isType2) Generates the CIDFontType2 dictionary.getCmap()Gets CMAP associated with the Pdf Font.floatgetContentWidth(PdfString content) protected PdfDictionarygetFontDescriptor(String fontName) getGlyph(int unicode) Get glyph by unicodeCreates a ToUnicode CMap to allow copy and paste from Acrobat.static StringgetUniMapFromOrdering(String ordering, boolean horizontal) Get Unicode mapping name from ordering.booleanisBuiltWith(String fontProgram, String encoding) Checks whether thePdfFontwas built with corresponding fontProgram and encoding or CMAP.voidwriteText(GlyphLine text, int from, int to, PdfOutputStream stream) voidwriteText(String text, PdfOutputStream stream) Methods inherited from class com.itextpdf.kernel.font.PdfFont
addSubsetRange, getAscent, getAscent, getDescent, getDescent, getFontProgram, getPdfFontStream, getWidth, getWidth, getWidth, getWidth, isEmbedded, isSubset, isWrappedObjectMustBeIndirect, setSubset, splitString, toString, updateSubsetPrefixMethods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Field Details
-
CID_FONT_TYPE_0
protected static final int CID_FONT_TYPE_0CIDFont Type0 (Type1 outlines).- See Also:
-
CID_FONT_TYPE_2
protected static final int CID_FONT_TYPE_2CIDFont Type2 (TrueType outlines).- See Also:
-
vertical
protected boolean vertical -
cmapEncoding
-
usedGlyphs
-
cidFontType
protected int cidFontType -
specificUnicodeDifferences
protected char[] specificUnicodeDifferences
-
-
Method Details
-
getUniMapFromOrdering
Get Unicode mapping name from ordering.- Parameters:
-
ordering- the text ordering to base to unicode mapping on -
horizontal- identifies whether the encoding is horizontal or vertical - Returns:
- Unicode mapping name
-
getGlyph
Description copied from class:PdfFontGet glyph by unicode -
containsGlyph
public boolean containsGlyph(int unicode) Description copied from class:PdfFontCheck whether font contains glyph with specified unicode.- Overrides:
-
containsGlyphin classPdfFont - Parameters:
-
unicode- a unicode code point - Returns:
- true if font contains glyph, represented with the unicode code point, otherwise false.
-
convertToBytes
Description copied from class:PdfFontConverts 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.- Specified by:
-
convertToBytesin classPdfFont - Parameters:
-
text- the text to convert - Returns:
- the conversion
-
convertToBytes
- Specified by:
-
convertToBytesin classPdfFont
-
convertToBytes
- Specified by:
-
convertToBytesin classPdfFont
-
writeText
-
writeText
-
createGlyphLine
- Specified by:
-
createGlyphLinein classPdfFont
-
appendGlyphs
Description copied from class:PdfFontAppend all supported glyphs and return number of processed chars. Composite font supports surrogate pairs.- Specified by:
-
appendGlyphsin classPdfFont - Parameters:
-
text- String to convert to glyphs. -
from- from index of the text. -
to- to index of the text. -
glyphs- array for a new glyphs, shall not be null. - Returns:
- number of processed chars from text.
-
appendAnyGlyph
Description copied from class:PdfFontAppend any single glyph, even notdef. Returns number of processed chars: 2 in case surrogate pair, otherwise 1.- Specified by:
-
appendAnyGlyphin classPdfFont - Parameters:
-
text- String to convert to glyphs. -
from- from index of the text. -
glyphs- array for a new glyph, shall not be null. - Returns:
- number of processed chars: 2 in case surrogate pair, otherwise 1
-
decode
-
decodeIntoGlyphLine
Decodes sequence of character codes (e.g. from content stream) into aGlyphLine- Specified by:
-
decodeIntoGlyphLinein classPdfFont - Parameters:
-
characterCodes- the string which is interpreted as a sequence of character codes. Note, thatPdfStringacts as a storage for char code values specific to given font, therefore individual character codes must not be interpreted as code units of the UTF-16 encoding - Returns:
-
the
GlyphLinecontaining the glyphs encoded by the passed string
-
appendDecodedCodesToGlyphsList
Decodes sequence of character codes (e.g. from content stream) to sequence of glyphs and appends them to the passed list.- Overrides:
-
appendDecodedCodesToGlyphsListin classPdfFont - Parameters:
-
list- the list to the end of which decoded glyphs are to be added -
characterCodes- the string which is interpreted as a sequence of character codes. Note, thatPdfStringacts as a storage for char code values specific to given font, therefore individual character codes must not be interpreted as code units of the UTF-16 encoding - Returns:
- true if all codes where successfully decoded, false otherwise
-
getContentWidth
- Specified by:
-
getContentWidthin classPdfFont
-
isBuiltWith
Description copied from class:PdfFontChecks whether thePdfFontwas built with corresponding fontProgram and encoding or CMAP. Default value is false unless overridden.- Overrides:
-
isBuiltWithin classPdfFont - Parameters:
-
fontProgram- a font name or path to a font program -
encoding- an encoding or CMAP - Returns:
- true, if the PdfFont was built with the fontProgram and encoding. Otherwise false.
- See Also:
-
flush
public void flush()Description copied from class:PdfFontTo manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly callPdfObjectWrapper.makeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation. -
getCmap
Gets CMAP associated with the Pdf Font.- Returns:
- CMAP
- See Also:
-
getFontDescriptor
- Specified by:
-
getFontDescriptorin classPdfFont
-
getCidFont
Generates the CIDFontType2 dictionary.- Parameters:
-
fontDescriptor- the font descriptor dictionary -
fontName- a name of the font -
isType2- true, if the font is CIDFontType2 (TrueType glyphs), otherwise false, i.e. CIDFontType0 (Type1/CFF glyphs) - Returns:
- fully initialized CIDFont
-
getToUnicode
Creates a ToUnicode CMap to allow copy and paste from Acrobat.- Returns:
-
the stream representing this CMap or
null
-