org.apache.poi.sl.draw

## Class DrawFontManagerDefault

- java.lang.Object
- - org.apache.poi.sl.draw.DrawFontManagerDefault

- All Implemented Interfaces:
    DrawFontManager

      public class DrawFontManagerDefault
      extends java.lang.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 and Description
    --- | ---
    `protected java.util.Set<java.lang.String>` | `knownSymbolFonts`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DrawFontManagerDefault()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.awt.Font` | `createAWTFont(java.awt.Graphics2D graphics, FontInfo fontInfo, double fontSize, boolean bold, boolean italic)` Create an AWT font object with the given attributes
    `FontInfo` | `getFallbackFont(java.awt.Graphics2D graphics, FontInfo fontInfo)` In case the original font doesn't contain a glyph, use the returned fallback font as an alternative
    `FontInfo` | `getMappedFont(java.awt.Graphics2D graphics, FontInfo fontInfo)` select a font to be used to paint text
    `java.lang.String` | `mapFontCharset(java.awt.Graphics2D graphics, FontInfo fontInfo, java.lang.String text)` Map text charset depending on font family.
    `static java.lang.String` | `mapSymbolChars(java.lang.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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### knownSymbolFonts

          protected final java.util.Set<java.lang.String> knownSymbolFonts

  - ### Constructor Detail

    - #### DrawFontManagerDefault

          public DrawFontManagerDefault()

  - ### Method Detail

    - #### getMappedFont

          public FontInfo getMappedFont(java.awt.Graphics2D graphics,
                                        FontInfo fontInfo)

      Description copied from interface: `DrawFontManager`
      select a font to be used to paint text
      Specified by:
        `getMappedFont` in interface `DrawFontManager`
      Parameters:
        `graphics` - the graphics context to request additional rendering hints
        `fontInfo` - the font info object corresponding to the text run font
      Returns:
        the font to be used to paint text

    - #### getFallbackFont

          public FontInfo getFallbackFont(java.awt.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 interface `DrawFontManager`
      Parameters:
        `graphics` - the graphics context to request additional rendering hints
        `fontInfo` - 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 java.lang.String mapFontCharset(java.awt.Graphics2D graphics,
                                                 FontInfo fontInfo,
                                                 java.lang.String text)

      Description copied from interface: `DrawFontManager`
      Map text charset depending on font family.

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

      Specified by:
        `mapFontCharset` in interface `DrawFontManager`
      Parameters:
        `graphics` - the graphics context to request additional rendering hints
        `fontInfo` - the font info object corresponding to the text run font
        `text` - the raw text
      Returns:
        String with mapped codepoints
      See Also:
        Drawing exotic fonts in a java applet, `StringUtil.mapMsCodepointString(String)`

    - #### mapSymbolChars

          public static java.lang.String mapSymbolChars(java.lang.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 helper function maps the chars of the text string to the corresponding private use range chars.
      Parameters:
        `text` - the input string, typically consists of ASCII chars
      Returns:
        the mapped string, typically consists of chars in the range of 0xf000 to 0xf0ff
      Since:
        POI 4.0.0

    - #### createAWTFont

          public java.awt.Font createAWTFont(java.awt.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 interface `DrawFontManager`
      Parameters:
        `graphics` - the graphics context to request additional rendering hints
        `fontInfo` - the font info object corresponding to the text run font
        `fontSize` - the font size in points
        `bold` - `true` if the font is bold
        `italic` - `true` if the font is italic
      Returns:
        the AWT font object

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.