Package com.openhtmltopdf.swing
Class AWTFontResolver
java.lang.Object
com.openhtmltopdf.swing.AWTFontResolver
- All Implemented Interfaces:
FontResolver
REsolves an AWT font instance from a list of CSS font families and characteristics.
-
Field Summary
FieldsModifier and TypeFieldDescriptionMap of base fonts, from which we can derive a concrete instance at the correct size, weight, etc.Map of concrete instances of fonts including size, weight, etc. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Font
createFont
(SharedContext ctx, Font rootFont, float size, IdentValue weight, IdentValue style, IdentValue variant) Creates a concrete instance of a font at specified size, weight, style and variant.void
protected static String
getFontInstanceHashName
(SharedContext ctx, String name, float size, IdentValue weight, IdentValue style, IdentValue variant) Gets the hash key for a concrete instance of a font.private void
init()
resolveFont
(SharedContext renderingContext, FontSpecification spec) resolveFont
(SharedContext ctx, String[] families, float size, IdentValue weight, IdentValue style, IdentValue variant) Resolves a list of font families.protected Font
resolveFont
(SharedContext ctx, String font, float size, IdentValue weight, IdentValue style, IdentValue variant) Resolves a single font name.void
setFontMapping
(String name, Font font) Sets the fontMapping attribute of the FontResolver object
-
Field Details
-
instanceHash
Map of concrete instances of fonts including size, weight, etc. -
availableFontsHash
Map of base fonts, from which we can derive a concrete instance at the correct size, weight, etc. Note: The value is initially null until we need the given base font.
-
-
Constructor Details
-
AWTFontResolver
public AWTFontResolver()Constructor
-
-
Method Details
-
init
private void init() -
flushCache
public void flushCache() -
setFontMapping
Sets the fontMapping attribute of the FontResolver object- Parameters:
name
- The new fontMapping valuefont
- The new fontMapping value
-