public abstract class AbstractFontSelectorStrategy extends Object implements IFontSelectorStrategy
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).
| Constructor and Description |
|---|
AbstractFontSelectorStrategy(FontProvider fontProvider,
FontSelector fontSelector,
FontSet additionalFonts)
Creates a new instance of
AbstractFontSelectorStrategy. |
| Modifier and Type | Method and Description |
|---|---|
List<com.itextpdf.commons.datastructures.Tuple2<com.itextpdf.io.font.otf.GlyphLine,PdfFont>> |
getGlyphLines(String text)
Converts text into glyphs with the best matching font.
|
protected abstract boolean |
isCurrentFontCheckRequired()
If it is necessary to provide a check that the best font for passed symbol equals to the current font.
|
protected PdfFont |
matchFont(int codePoint,
FontSelector fontSelector,
FontProvider fontProvider,
FontSet additionalFonts)
Finds the best font which matches passed symbol.
|
public AbstractFontSelectorStrategy(FontProvider fontProvider, FontSelector fontSelector, FontSet additionalFonts)
AbstractFontSelectorStrategy.fontProvider - the font providerfontSelector - the font selectoradditionalFonts - the set of fonts to be used additionally to the fonts added to font provider.protected abstract boolean isCurrentFontCheckRequired()
true if check is needed, otherwise falsepublic List<com.itextpdf.commons.datastructures.Tuple2<com.itextpdf.io.font.otf.GlyphLine,PdfFont>> getGlyphLines(String text)
getGlyphLines in interface IFontSelectorStrategytext - the text to splitprotected PdfFont matchFont(int codePoint, FontSelector fontSelector, FontProvider fontProvider, FontSet additionalFonts)
codePoint - the symbol to matchfontSelector - the font selectorfontProvider - the font provideradditionalFonts - the addition fontsCopyright © 1998–2025 Apryse Group NV. All rights reserved.