Package com.itextpdf.io.font
Class TrueTypeFont
java.lang.Object
com.itextpdf.io.font.FontProgram
com.itextpdf.io.font.TrueTypeFont
- Direct Known Subclasses:
-
DocTrueTypeFont
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[][]protected booleanprotected com.itextpdf.io.util.IntHashtableThe map containing the kerning information.Fields inherited from class com.itextpdf.io.font.FontProgram
avgWidth, codeToGlyph, DEFAULT_WIDTH, encodingScheme, fontIdentification, fontMetrics, fontNames, HORIZONTAL_SCALING_FACTOR, isFontSpecific, registry, unicodeToGlyph, UNITS_NORMALIZATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()String[]Gets the code pages supported by the font.intThe offset from the start of the file to the table directory.byte[]intgetKerning(Glyph first, Glyph second) Gets the kerning between two glyphs.intGets the number of the “cmap” subtables for the currentTrueTypeFontprogram.intbyte[]booleanbooleanisBuiltWith(String fontProgram) Checks whether theFontProgramwas built with corresponding fontName.booleanisCff()booleanisCmapPresent(int platformID, int encodingID) Checks whether currentTrueTypeFontprogram contains the “cmap” subtable with provided platform ID and encoding ID.mapGlyphsCidsToGids(Set<Integer> glyphs) Maps a set of glyph CIDs (as used in PDF file) to corresponding GID values (as a glyph primary identifier in the font file).protected voidprotected voidprotected voidvoidupdateUsedGlyphs(SortedSet<Integer> usedGlyphs, boolean subset, List subsetRanges) The method will update usedGlyphs with additional range or with all glyphs if there is no subset.Methods inherited from class com.itextpdf.io.font.FontProgram
convertGlyphSpaceToTextSpace, convertGlyphSpaceToTextSpace, convertGlyphSpaceToTextSpace, convertTextSpaceToGlyphSpace, countOfGlyphs, fixSpaceIssue, getAvgWidth, getCharBBox, getFontIdentification, getFontMetrics, getFontNames, getGlyph, getGlyphByCode, getKerning, getRegistry, getWidth, isFontSpecific, setBbox, setBold, setCapHeight, setFixedPitch, setFontFamily, setFontName, setFontStretch, setFontWeight, setItalicAngle, setRegistry, setStemH, setStemV, setTypoAscender, setTypoDescender, setXHeight, toString
-
Field Details
-
bBoxes
protected int[][] bBoxes -
isVertical
protected boolean isVertical -
kerning
protected com.itextpdf.io.util.IntHashtable kerningThe map containing the kerning information. It represents the content of table 'kern'. The key is anIntegerwhere the top 16 bits are the glyph number for the first character and the lower 16 bits are the glyph number for the second character. The value is the amount of kerning in normalized 1000 units as anInteger. This value is usually negative.
-
-
Constructor Details
-
TrueTypeFont
protected TrueTypeFont() -
TrueTypeFont
- Throws:
-
IOException
-
TrueTypeFont
- Throws:
-
IOException
-
-
Method Details
-
hasKernPairs
public boolean hasKernPairs()- Overrides:
-
hasKernPairsin classFontProgram
-
getKerning
Gets the kerning between two glyphs.- Specified by:
-
getKerningin classFontProgram - Parameters:
-
first- the first glyph -
second- the second glyph - Returns:
- the kerning to be applied
-
isCff
public boolean isCff() -
getActiveCmap
-
getFontStreamBytes
public byte[] getFontStreamBytes() -
getPdfFontFlags
public int getPdfFontFlags()- Specified by:
-
getPdfFontFlagsin classFontProgram
-
getDirectoryOffset
public int getDirectoryOffset()The offset from the start of the file to the table directory. It is 0 for TTF and may vary for TTC depending on the chosen font.- Returns:
- directory Offset
-
getGsubTable
-
getGposTable
-
getGdefTable
-
getSubset
-
mapGlyphsCidsToGids
Maps a set of glyph CIDs (as used in PDF file) to corresponding GID values (as a glyph primary identifier in the font file). This call is only meaningful for fonts that return true forisCff(). For other types of fonts, GID and CID are always the same, so that call would essentially return a set of the same values.- Parameters:
-
glyphs- a set of glyph CIDs - Returns:
- a set of glyph ids corresponding to the passed glyph CIDs
-
isCmapPresent
public boolean isCmapPresent(int platformID, int encodingID) Checks whether currentTrueTypeFontprogram contains the “cmap” subtable with provided platform ID and encoding ID.- Parameters:
-
platformID- platform ID -
encodingID- encoding ID - Returns:
-
trueif “cmap” subtable with provided platform ID and encoding ID is present in the font program,falseotherwise
-
getNumberOfCmaps
public int getNumberOfCmaps()Gets the number of the “cmap” subtables for the currentTrueTypeFontprogram.- Returns:
- the number of the “cmap” subtables
-
readGdefTable
- Throws:
-
IOException
-
readGsubTable
- Throws:
-
IOException
-
readGposTable
- Throws:
-
IOException
-
getCodePagesSupported
Gets the code pages supported by the font.- Returns:
- the code pages supported by the font
-
isBuiltWith
Description copied from class:FontProgramChecks whether theFontProgramwas built with corresponding fontName. Default value is false unless overridden.- Overrides:
-
isBuiltWithin classFontProgram - Parameters:
-
fontProgram- a font name or path to a font program - Returns:
- true, if the FontProgram was built with the fontProgram. Otherwise false.
-
close
- Throws:
-
IOException
-
updateUsedGlyphs
The method will update usedGlyphs with additional range or with all glyphs if there is no subset. This set of used glyphs can be used for building width array and ToUnicode CMAP.- Parameters:
-
usedGlyphs- a set of integers, which are glyph ids that denote used glyphs. This set is updated inside of the method if needed. -
subset- subset status -
subsetRanges- additional subset ranges
-