Table of Contents

Class TrueTypeFont

Namespace
iText.IO.Font
Assembly
itext.io.dll
public class TrueTypeFont : FontProgram
Inheritance
TrueTypeFont
Derived
Inherited Members

Constructors

TrueTypeFont()

protected TrueTypeFont()

TrueTypeFont(byte[])

public TrueTypeFont(byte[] ttf)

Parameters

ttf byte[]

TrueTypeFont(string)

public TrueTypeFont(string path)

Parameters

path string

Fields

bBoxes

protected int[][] bBoxes

Field Value

int[][]

isVertical

protected bool isVertical

Field Value

bool

kerning

The map containing the kerning information.

protected IntHashtable kerning

Field Value

IntHashtable

Remarks

The map containing the kerning information. It represents the content of table 'kern'. The key is an Integer where 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 an Integer. This value is usually negative.

Methods

Close()

public virtual void Close()

GetActiveCmap()

public virtual IDictionary<int, int[]> GetActiveCmap()

Returns

IDictionary<int, int[]>

GetCodePagesSupported()

Gets the code pages supported by the font.

public virtual string[] GetCodePagesSupported()

Returns

string[]

the code pages supported by the font

GetDirectoryOffset()

The offset from the start of the file to the table directory.

public virtual int GetDirectoryOffset()

Returns

int

directory Offset

Remarks

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.

GetFontStreamBytes()

public virtual byte[] GetFontStreamBytes()

Returns

byte[]

GetGdefTable()

public virtual OpenTypeGdefTableReader GetGdefTable()

Returns

OpenTypeGdefTableReader

GetGposTable()

public virtual GlyphPositioningTableReader GetGposTable()

Returns

GlyphPositioningTableReader

GetGsubTable()

public virtual GlyphSubstitutionTableReader GetGsubTable()

Returns

GlyphSubstitutionTableReader

GetKerning(Glyph, Glyph)

Gets the kerning between two glyphs.

public override int GetKerning(Glyph first, Glyph second)

Parameters

first Glyph

the first glyph

second Glyph

the second glyph

Returns

int

the kerning to be applied

GetPdfFontFlags()

public override int GetPdfFontFlags()

Returns

int

GetSubset(ICollection<int>, bool)

public virtual byte[] GetSubset(ICollection<int> glyphs, bool subset)

Parameters

glyphs ICollection<int>
subset bool

Returns

byte[]

HasKernPairs()

public override bool HasKernPairs()

Returns

bool

IsBuiltWith(string)

public override bool IsBuiltWith(string fontProgram)

Parameters

fontProgram string

Returns

bool

IsCff()

public virtual bool IsCff()

Returns

bool

MapGlyphsCidsToGids(ICollection<int>)

Maps a set of glyph CIDs (as used in PDF file) to corresponding GID values (as a glyph primary identifier in the font file).

public virtual ICollection<int> MapGlyphsCidsToGids(ICollection<int> glyphs)

Parameters

glyphs ICollection<int>

a set of glyph CIDs

Returns

ICollection<int>

a set of glyph ids corresponding to the passed glyph CIDs

Remarks

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 for IsCff(). For other types of fonts, GID and CID are always the same, so that call would essentially return a set of the same values.

ReadGdefTable()

protected virtual void ReadGdefTable()

ReadGposTable()

protected virtual void ReadGposTable()

ReadGsubTable()

protected virtual void ReadGsubTable()

UpdateUsedGlyphs(SortedSet<int>, bool, IList<int[]>)

The method will update usedGlyphs with additional range or with all glyphs if there is no subset.

public virtual void UpdateUsedGlyphs(SortedSet<int> usedGlyphs, bool subset, IList<int[]> subsetRanges)

Parameters

usedGlyphs SortedSet<int>

a set of integers, which are glyph ids that denote used glyphs. This set is updated inside of the method if needed.

subset bool

subset status

subsetRanges IList<int[]>

additional subset ranges

Remarks

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.