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

public Class DrawFontManagerDefault

extends Object
implements DrawFontManager
Class Inheritance
All Implemented Interfaces
org.apache.poi.sl.draw.DrawFontManager
Imports
java.awt.Font, .Graphics2D, .GraphicsEnvironment, java.util.Arrays, .Map, .Set, .TreeSet, org.apache.poi.common.usermodel.fonts.FontCharset, .FontInfo, org.apache.poi.sl.draw.Drawable.DrawableHint, org.apache.poi.util.StringUtil

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

Field Summary

Modifier and TypeField and Description
protected final Set<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Font
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
fontSize
,
boolean
true if the font is bold
bold
,
boolean
true if the font is italic
italic
)

Implements org.apache.poi.sl.draw.DrawFontManager.createAWTFont.

Create an AWT font object with the given attributes

public FontInfo
getFallbackFont(Graphics2D
the graphics context to request additional rendering hints
graphics
,
FontInfo
the font info object corresponding to the text run font
fontInfo
)

Implements org.apache.poi.sl.draw.DrawFontManager.getFallbackFont.

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

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

Implements org.apache.poi.sl.draw.DrawFontManager.getMappedFont.

select a font to be used to paint text

public String

Returns:

the mapped string, typically consists of chars in the range of 0xf000 to 0xf0ff
mapFontCharset
(Graphics2D
the used graphics context
graphics
,
FontInfo
the font info
fontInfo
,
String
the input string
text
)

Implements org.apache.poi.sl.draw.DrawFontManager.mapFontCharset.

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.

private static int
mapSymbolChar(int cp)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

knownSymbolFontsback to summary
protected final Set<String> knownSymbolFonts

Constructor Detail

DrawFontManagerDefaultback to summary
public DrawFontManagerDefault()

Method Detail

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

Implements org.apache.poi.sl.draw.DrawFontManager.createAWTFont.

Doc from org.apache.poi.sl.draw.DrawFontManager.createAWTFont.

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

fontSize: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

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

Implements org.apache.poi.sl.draw.DrawFontManager.getFallbackFont.

Doc from org.apache.poi.sl.draw.DrawFontManager.getFallbackFont.

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

Annotations
@Override
getFontWithFallbackback to summary
private FontInfo getFontWithFallback(Graphics2D graphics, Drawable.DrawableHint hint, FontInfo fontInfo)
getMappedFontback to summary
public FontInfo getMappedFont(Graphics2D graphics, FontInfo fontInfo)

Implements org.apache.poi.sl.draw.DrawFontManager.getMappedFont.

Doc from org.apache.poi.sl.draw.DrawFontManager.getMappedFont.

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

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

Implements org.apache.poi.sl.draw.DrawFontManager.mapFontCharset.

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.

Parameters
graphics:Graphics2D

the used graphics context

fontInfo:FontInfo

the font info

text:String

the input string

Returns:String

the mapped string, typically consists of chars in the range of 0xf000 to 0xf0ff

Annotations
@Override
Since
POI 4.0.0
mapSymbolCharback to summary
private static int mapSymbolChar(int cp)