Package com.itextpdf.kernel.font
Class PdfTrueTypeFont
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.font.PdfFont
-
- com.itextpdf.kernel.font.PdfSimpleFont<TrueTypeFont>
-
- com.itextpdf.kernel.font.PdfTrueTypeFont
-
public class PdfTrueTypeFont extends PdfSimpleFont<TrueTypeFont>
Note. For TrueType FontNames.getStyle() is the same to Subfamily(). So, we shouldn't add style to /BaseFont.
-
-
Field Summary
-
Fields inherited from class com.itextpdf.kernel.font.PdfSimpleFont
fontEncoding, forceWidthsOutput, toUnicode, usedGlyphs
-
Fields inherited from class com.itextpdf.kernel.font.PdfFont
embedded, EMPTY_BYTES, fontProgram, newFont, notdefGlyphs, SIMPLE_FONT_MAX_CHAR_CODE_VALUE, subset, subsetRanges
-
-
Constructor Summary
Constructors Constructor Description PdfTrueTypeFont(TrueTypeFont ttf, java.lang.String encoding, boolean embedded)
PdfTrueTypeFont(PdfDictionary fontDictionary)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addFontStream(PdfDictionary fontDescriptor)
boolean
containsGlyph(int unicode)
Check whether font contains glyph with specified unicode.void
flush()
To manually flush aPdfObject
behind this wrapper, you have to ensure that this object is added to the document, i.e.Glyph
getGlyph(int unicode)
Get glyph by unicodeprotected boolean
isBuiltInFont()
Indicates that the font is built in, i.e.boolean
isBuiltWith(java.lang.String fontProgram, java.lang.String encoding)
Checks whether thePdfFont
was built with corresponding fontProgram and encoding or CMAP.-
Methods inherited from class com.itextpdf.kernel.font.PdfSimpleFont
appendAnyGlyph, appendDecodedCodesToGlyphsList, appendGlyphs, buildWidthsArray, convertToBytes, convertToBytes, convertToBytes, createGlyphLine, decode, decodeIntoGlyphLine, flushFontData, getContentWidth, getFontDescriptor, getFontEncoding, getToUnicode, isForceWidthsOutput, setFontProgram, setForceWidthsOutput, writeText, writeText
-
Methods inherited from class com.itextpdf.kernel.font.PdfFont
addSubsetRange, getAscent, getAscent, getDescent, getDescent, getFontProgram, getPdfFontStream, getWidth, getWidth, getWidth, getWidth, isEmbedded, isSubset, isWrappedObjectMustBeIndirect, makeObjectIndirect, setSubset, splitString, toString, updateSubsetPrefix
-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
Constructor Detail
-
PdfTrueTypeFont
PdfTrueTypeFont(TrueTypeFont ttf, java.lang.String encoding, boolean embedded)
-
PdfTrueTypeFont
PdfTrueTypeFont(PdfDictionary fontDictionary)
-
-
Method Detail
-
getGlyph
public Glyph getGlyph(int unicode)
Description copied from class:PdfFont
Get glyph by unicode
-
containsGlyph
public boolean containsGlyph(int unicode)
Description copied from class:PdfFont
Check whether font contains glyph with specified unicode.- Overrides:
containsGlyph
in classPdfFont
- Parameters:
unicode
- a unicode code point- Returns:
- true if font contains glyph, represented with the unicode code point, otherwise false.
-
flush
public void flush()
Description copied from class:PdfFont
To manually flush aPdfObject
behind 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.
-
isBuiltWith
public boolean isBuiltWith(java.lang.String fontProgram, java.lang.String encoding)
Description copied from class:PdfFont
Checks whether thePdfFont
was built with corresponding fontProgram and encoding or CMAP. Default value is false unless overridden.- Overrides:
isBuiltWith
in classPdfSimpleFont<TrueTypeFont>
- Parameters:
fontProgram
- a font name or path to a font programencoding
- an encoding or CMAP- Returns:
- true, if the PdfFont was built with the fontProgram and encoding. Otherwise false.
- See Also:
PdfDocument.findFont(String, String)
,FontProgram.isBuiltWith(String)
,FontEncoding.isBuiltWith(String)
,CMapEncoding.isBuiltWith(String)
-
addFontStream
protected void addFontStream(PdfDictionary fontDescriptor)
- Specified by:
addFontStream
in classPdfSimpleFont<TrueTypeFont>
-
isBuiltInFont
protected boolean isBuiltInFont()
Indicates that the font is built in, i.e. it is one of the 14 Standard fonts- Overrides:
isBuiltInFont
in classPdfSimpleFont<TrueTypeFont>
- Returns:
true
in case the font is a Standard font andfalse
otherwise
-
-