Package com.openhtmltopdf.swing
Class AWTFontResolver
- java.lang.Object
-
- com.openhtmltopdf.swing.AWTFontResolver
-
- All Implemented Interfaces:
FontResolver
public class AWTFontResolver extends Object implements FontResolver
REsolves an AWT font instance from a list of CSS font families and characteristics.- Author:
- Joshua Marinacci
-
-
Constructor Summary
Constructors Constructor Description AWTFontResolver()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static FontcreateFont(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.voidflushCache()protected static StringgetFontInstanceHashName(SharedContext ctx, String name, float size, IdentValue weight, IdentValue style, IdentValue variant)Gets the hash key for a concrete instance of a font.FSFontresolveFont(SharedContext renderingContext, FontSpecification spec)FSFontresolveFont(SharedContext ctx, String[] families, float size, IdentValue weight, IdentValue style, IdentValue variant)Resolves a list of font families.protected FontresolveFont(SharedContext ctx, String font, float size, IdentValue weight, IdentValue style, IdentValue variant)Resolves a single font name.voidsetFontMapping(String name, Font font)Sets the fontMapping attribute of the FontResolver object
-
-
-
Method Detail
-
flushCache
public void flushCache()
-
resolveFont
public FSFont resolveFont(SharedContext ctx, String[] families, float size, IdentValue weight, IdentValue style, IdentValue variant)
Resolves a list of font families.
-
setFontMapping
public void setFontMapping(String name, Font font)
Sets the fontMapping attribute of the FontResolver object- Parameters:
name- The new fontMapping valuefont- The new fontMapping value
-
createFont
protected 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.
-
resolveFont
protected Font resolveFont(SharedContext ctx, String font, float size, IdentValue weight, IdentValue style, IdentValue variant)
Resolves a single font name. TODO: Make case insensitive.
-
getFontInstanceHashName
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. This incorporates size, weight, etc.
-
resolveFont
public FSFont resolveFont(SharedContext renderingContext, FontSpecification spec)
- Specified by:
resolveFontin interfaceFontResolver
-
-