Package com.orsonpdf

Class DefaultFontMapper

  • All Implemented Interfaces:
    FontMapper

    public class DefaultFontMapper
    extends java.lang.Object
    implements FontMapper
    A class that can be used to map AWT/Java2D fonts to PDF built-in font names. This is a very minimal way to support fonts in this PDFGraphics2D implementation.

    Note that there is an option to draw text as vector graphics which you can specify using the rendering hint PDFHints.KEY_DRAW_STRING_TYPE. This can be useful, for example, if you need to display characters (such as the euro symbol) that are not supported by the PDF built-in fonts.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<FontKey,​java.lang.String> map  
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultFontMapper()
      Creates a new instance with default mappings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String mapToBaseFont​(java.awt.Font f)
      Returns the name of the PDF built-in font that should be used in place of the specified AWT/Java2D font.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • map

        private final java.util.Map<FontKey,​java.lang.String> map
    • Constructor Detail

      • DefaultFontMapper

        public DefaultFontMapper()
        Creates a new instance with default mappings.
    • Method Detail

      • mapToBaseFont

        public java.lang.String mapToBaseFont​(java.awt.Font f)
        Description copied from interface: FontMapper
        Returns the name of the PDF built-in font that should be used in place of the specified AWT/Java2D font.
        Specified by:
        mapToBaseFont in interface FontMapper
        Parameters:
        f - the font.
        Returns:
        The name of the built-in PDF font.