Package org.apache.poi.sl.draw
Class DrawFontManagerDefault
- java.lang.Object
-
- org.apache.poi.sl.draw.DrawFontManagerDefault
-
- All Implemented Interfaces:
DrawFontManager
public class DrawFontManagerDefault extends Object implements DrawFontManager
Manages fonts when rendering slides. Use this class to handle unknown / missing fonts or to substitute fonts
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>
knownSymbolFonts
-
Constructor Summary
Constructors Constructor Description DrawFontManagerDefault()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Font
createAWTFont(Graphics2D graphics, FontInfo fontInfo, double fontSize, boolean bold, boolean italic)
Create an AWT font object with the given attributesFontInfo
getFallbackFont(Graphics2D graphics, FontInfo fontInfo)
In case the original font doesn't contain a glyph, use the returned fallback font as an alternativeFontInfo
getMappedFont(Graphics2D graphics, FontInfo fontInfo)
select a font to be used to paint textString
mapFontCharset(Graphics2D graphics, FontInfo fontInfo, String text)
Symbol fonts like "Wingdings" or "Symbol" have glyphs mapped to a Unicode private use range via the Java font loader, although a system font viewer might show you the glyphs in the ASCII range.
-
-
-
Method Detail
-
getMappedFont
public FontInfo getMappedFont(Graphics2D graphics, FontInfo fontInfo)
Description copied from interface:DrawFontManager
select a font to be used to paint text- Specified by:
getMappedFont
in interfaceDrawFontManager
- Parameters:
graphics
- the graphics context to request additional rendering hintsfontInfo
- the font info object corresponding to the text run font- Returns:
- the font to be used to paint text
-
getFallbackFont
public FontInfo getFallbackFont(Graphics2D graphics, FontInfo fontInfo)
Description copied from interface:DrawFontManager
In case the original font doesn't contain a glyph, use the returned fallback font as an alternative- Specified by:
getFallbackFont
in interfaceDrawFontManager
- Parameters:
graphics
- the graphics context to request additional rendering hintsfontInfo
- the font info object corresponding to the text run font- Returns:
- the font to be used as a fallback for the original typeface
-
mapFontCharset
public String mapFontCharset(Graphics2D graphics, FontInfo fontInfo, String text)
Symbol fonts like "Wingdings" or "Symbol" have glyphs mapped to a Unicode private use range via the Java font loader, although a system font viewer might show you the glyphs in the ASCII range. This maps the chars of the text string to the corresponding private use range chars.- Specified by:
mapFontCharset
in interfaceDrawFontManager
- Parameters:
graphics
- the used graphics contextfontInfo
- the font infotext
- the input string- Returns:
- the mapped string, typically consists of chars in the range of 0xf000 to 0xf0ff
- Since:
- POI 4.0.0
- See Also:
StringUtil.mapMsCodepointString(String)
-
createAWTFont
public Font createAWTFont(Graphics2D graphics, FontInfo fontInfo, double fontSize, boolean bold, boolean italic)
Description copied from interface:DrawFontManager
Create an AWT font object with the given attributes- Specified by:
createAWTFont
in interfaceDrawFontManager
- Parameters:
graphics
- the graphics context to request additional rendering hintsfontInfo
- the font info object corresponding to the text run fontfontSize
- the font size in pointsbold
-true
if the font is bolditalic
-true
if the font is italic- Returns:
- the AWT font object
-
-