Package com.itextpdf.layout.font
Class FontSelector
java.lang.Object
com.itextpdf.layout.font.FontSelector
Sort given set of fonts according to font name and style.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
-
Constructor Summary
ConstructorsConstructorDescriptionFontSelector
(Collection<FontInfo> allFonts, List<String> fontFamilies, FontCharacteristics fc) Create new FontSelector instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal FontInfo
The best font match.protected Comparator
<FontInfo> getComparator
(List<String> fontFamilies, FontCharacteristics fc) getFonts()
Sorted set of fonts.
-
Field Details
-
fonts
-
EXPECTED_FONT_IS_BOLD_AWARD
private static final int EXPECTED_FONT_IS_BOLD_AWARD- See Also:
-
EXPECTED_FONT_IS_NOT_BOLD_AWARD
private static final int EXPECTED_FONT_IS_NOT_BOLD_AWARD- See Also:
-
EXPECTED_FONT_WEIGHT_IS_EQUALS_AWARD
private static final int EXPECTED_FONT_WEIGHT_IS_EQUALS_AWARD- See Also:
-
EXPECTED_FONT_WEIGHT_IS_FAR_AWARD
private static final int EXPECTED_FONT_WEIGHT_IS_FAR_AWARD- See Also:
-
EXPECTED_FONT_IS_ITALIC_AWARD
private static final int EXPECTED_FONT_IS_ITALIC_AWARD- See Also:
-
EXPECTED_FONT_IS_NOT_ITALIC_AWARD
private static final int EXPECTED_FONT_IS_NOT_ITALIC_AWARD- See Also:
-
EXPECTED_FONT_IS_MONOSPACED_AWARD
private static final int EXPECTED_FONT_IS_MONOSPACED_AWARD- See Also:
-
EXPECTED_FONT_IS_NOT_MONOSPACED_AWARD
private static final int EXPECTED_FONT_IS_NOT_MONOSPACED_AWARD- See Also:
-
FONT_FAMILY_EQUALS_AWARD
private static final int FONT_FAMILY_EQUALS_AWARD- See Also:
-
-
Constructor Details
-
FontSelector
public FontSelector(Collection<FontInfo> allFonts, List<String> fontFamilies, FontCharacteristics fc) Create new FontSelector instance.- Parameters:
allFonts
- unsorted set of all available fonts.fontFamilies
- sorted list of preferred font families.fc
- instance ofFontCharacteristics
.
-
-
Method Details
-
bestMatch
The best font match. If any font fromgetFonts()
doesn't contain requested glyphs, this font will be used.- Returns:
- the best matched font
-
getFonts
Sorted set of fonts.- Returns:
- sorted set of fonts
-
getComparator
-