Table of Contents

Class AbstractFontSelectorStrategy

Namespace
iText.Layout.Font.Selectorstrategy
Assembly
itext.layout.dll

The class defines complex implementation of IFontSelectorStrategy which based on the following algorithm: 1.

public abstract class AbstractFontSelectorStrategy : IFontSelectorStrategy
Inheritance
AbstractFontSelectorStrategy
Implements
Derived
Inherited Members

Remarks

The class defines complex implementation of IFontSelectorStrategy which based on the following algorithm:

  1. Find first significant symbol (not whitespace or special).
  2. Find font which matches symbol according to passed FontSelector.
  3. Try to append as many symbols as possible using the current font.
  4. If symbol is not matched to the current font, go to step 1.

Algorithm takes care of the case when there is no matched font for symbol or when diacritic from another font is used (previous symbol will be processed by diacritic's font).

Constructors

AbstractFontSelectorStrategy(FontProvider, FontSelector, FontSet)

Creates a new instance of AbstractFontSelectorStrategy.

public AbstractFontSelectorStrategy(FontProvider fontProvider, FontSelector fontSelector, FontSet additionalFonts)

Parameters

fontProvider FontProvider

the font provider

fontSelector FontSelector

the font selector

additionalFonts FontSet

the set of fonts to be used additionally to the fonts added to font provider.

Methods

GetGlyphLines(string)

public virtual IList<Tuple2<GlyphLine, PdfFont>> GetGlyphLines(string text)

Parameters

text string

Returns

IList<Tuple2<GlyphLine, PdfFont>>

IsCurrentFontCheckRequired()

If it is necessary to provide a check that the best font for passed symbol equals to the current font.

protected abstract bool IsCurrentFontCheckRequired()

Returns

bool

true if check is needed, otherwise false

Remarks

If it is necessary to provide a check that the best font for passed symbol equals to the current font. Result of checking is used to split text into parts in case if inequality.

MatchFont(int, FontSelector, FontProvider, FontSet)

Finds the best font which matches passed symbol.

protected virtual PdfFont MatchFont(int codePoint, FontSelector fontSelector, FontProvider fontProvider, FontSet additionalFonts)

Parameters

codePoint int

the symbol to match

fontSelector FontSelector

the font selector

fontProvider FontProvider

the font provider

additionalFonts FontSet

the addition fonts

Returns

PdfFont

font which matches the symbol