Top Description Methods
org.apache.poi.sl.draw

public Interface DrawFontManager

Known Direct Implementers
org.apache.poi.sl.draw.DrawFontManagerDefault
Imports
java.awt.Font, .Graphics2D, org.apache.poi.common.usermodel.fonts.FontInfo, org.apache.poi.util.StringUtil

Manages fonts when rendering slides. Use this class to handle unknown / missing fonts or to substitute fonts

Method Summary

Modifier and TypeMethod and Description
public Font

Returns:

the AWT font object
createAWTFont
(Graphics2D
the graphics context to request additional rendering hints
graphics
,
FontInfo
the font info object corresponding to the text run font
fontInfo
,
double
the font size in points
size
,
boolean
true if the font is bold
bold
,
boolean
true if the font is italic
italic
)

Create an AWT font object with the given attributes

public FontInfo

Returns:

the font to be used as a fallback for the original typeface
getFallbackFont
(Graphics2D
the graphics context to request additional rendering hints
graphics
,
FontInfo
the font info object corresponding to the text run font
fontInfo
)

In case the original font doesn't contain a glyph, use the returned fallback font as an alternative

public FontInfo

Returns:

the font to be used to paint text
getMappedFont
(Graphics2D
the graphics context to request additional rendering hints
graphics
,
FontInfo
the font info object corresponding to the text run font
fontInfo
)

select a font to be used to paint text

public String

Returns:

String with mapped codepoints
mapFontCharset
(Graphics2D
the graphics context to request additional rendering hints
graphics
,
FontInfo
the font info object corresponding to the text run font
fontInfo
,
String
the raw text
text
)

Map text charset depending on font family.

Method Detail

createAWTFontback to summary
public Font createAWTFont(Graphics2D graphics, FontInfo fontInfo, double size, boolean bold, boolean italic)

Create an AWT font object with the given attributes

Parameters
graphics:Graphics2D

the graphics context to request additional rendering hints

fontInfo:FontInfo

the font info object corresponding to the text run font

size:double

the font size in points

bold:boolean

true if the font is bold

italic:boolean

true if the font is italic

Returns:Font

the AWT font object

getFallbackFontback to summary
public FontInfo getFallbackFont(Graphics2D graphics, FontInfo fontInfo)

In case the original font doesn't contain a glyph, use the returned fallback font as an alternative

Parameters
graphics:Graphics2D

the graphics context to request additional rendering hints

fontInfo:FontInfo

the font info object corresponding to the text run font

Returns:FontInfo

the font to be used as a fallback for the original typeface

getMappedFontback to summary
public FontInfo getMappedFont(Graphics2D graphics, FontInfo fontInfo)

select a font to be used to paint text

Parameters
graphics:Graphics2D

the graphics context to request additional rendering hints

fontInfo:FontInfo

the font info object corresponding to the text run font

Returns:FontInfo

the font to be used to paint text

mapFontCharsetback to summary
public String mapFontCharset(Graphics2D graphics, FontInfo fontInfo, String text)

Map text charset depending on font family.

Currently this only maps for wingdings and symbol font (into unicode private use area)

Depending if the requested font is installed in the system, tbe mapped string varies:
If the font is registered into the graphics environment the characters are mapped to the private use area. If the font is missing (and hence a AWT logical font is used), the characters are mapped to the corresponding unicode characters

Parameters
graphics:Graphics2D

the graphics context to request additional rendering hints

fontInfo:FontInfo

the font info object corresponding to the text run font

text:String

the raw text

Returns:String

String with mapped codepoints

See Also
StringUtil#mapMsCodepointString(String)