Package com.openhtmltopdf.java2d
Class Java2DFontResolver
java.lang.Object
com.openhtmltopdf.java2d.Java2DFontResolver
- All Implemented Interfaces:
com.openhtmltopdf.extend.FontResolver
public class Java2DFontResolver extends Object implements com.openhtmltopdf.extend.FontResolver
REsolves an AWT font instance from a list of CSS font families and characteristics.
- Author:
- Joshua Marinacci
-
Constructor Summary
Constructors Constructor Description Java2DFontResolver(com.openhtmltopdf.layout.SharedContext sharedCtx, boolean useEnvironmentFonts) -
Method Summary
Modifier and Type Method Description voidaddFontFile(File fontFile, String fontFamilyNameOverride, Integer fontWeightOverride, com.openhtmltopdf.css.constants.IdentValue fontStyleOverride)Add a font using a existing file.voidaddInputStreamFont(com.openhtmltopdf.extend.FSSupplier<InputStream> fontSupplier, String fontFamilyNameOverride, Integer fontWeightOverride, com.openhtmltopdf.css.constants.IdentValue fontStyleOverride)protected static FontcreateFont(com.openhtmltopdf.layout.SharedContext ctx, Font rootFont, float size, com.openhtmltopdf.css.constants.IdentValue weight, com.openhtmltopdf.css.constants.IdentValue style, com.openhtmltopdf.css.constants.IdentValue variant)Creates a concrete instance of a font at specified size, weight, style and variant.voidflushCache()Deprecated.protected static StringgetFontInstanceHashName(com.openhtmltopdf.layout.SharedContext ctx, String name, float size, com.openhtmltopdf.css.constants.IdentValue weight, com.openhtmltopdf.css.constants.IdentValue style, com.openhtmltopdf.css.constants.IdentValue variant)Gets the hash key for a concrete instance of a font.voidimportFontFaces(List<com.openhtmltopdf.css.sheet.FontFaceRule> fontFaces)com.openhtmltopdf.render.FSFontresolveFont(com.openhtmltopdf.layout.SharedContext renderingContext, com.openhtmltopdf.css.value.FontSpecification spec)com.openhtmltopdf.render.FSFontresolveFont(com.openhtmltopdf.layout.SharedContext ctx, String[] families, float size, com.openhtmltopdf.css.constants.IdentValue weight, com.openhtmltopdf.css.constants.IdentValue style, com.openhtmltopdf.css.constants.IdentValue variant)Resolves a list of font families.voidsetFontMapping(String name, Font font)Sets the fontMapping attribute of the FontResolver object
-
Constructor Details
-
Method Details
-
flushCache
Deprecated.- Specified by:
flushCachein interfacecom.openhtmltopdf.extend.FontResolver
-
importFontFaces
-
addInputStreamFont
public void addInputStreamFont(com.openhtmltopdf.extend.FSSupplier<InputStream> fontSupplier, String fontFamilyNameOverride, Integer fontWeightOverride, com.openhtmltopdf.css.constants.IdentValue fontStyleOverride) -
addFontFile
public void addFontFile(File fontFile, String fontFamilyNameOverride, Integer fontWeightOverride, com.openhtmltopdf.css.constants.IdentValue fontStyleOverride)Add a font using a existing file. Does not handle true type collections. -
setFontMapping
Sets the fontMapping attribute of the FontResolver object- Parameters:
name- The new fontMapping valuefont- The new fontMapping value
-