Class FontSelector

java.lang.Object
com.itextpdf.text.pdf.FontSelector

public class FontSelector extends Object
Selects the appropriate fonts that contain the glyphs needed to render text correctly. The fonts are checked in order until the character is found.

The built in fonts "Symbol" and "ZapfDingbats", if used, have a special encoding to allow the characters to be referred by Unicode.

  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • fonts

      protected ArrayList<Font> fonts
    • unsupportedFonts

      protected ArrayList<Font> unsupportedFonts
    • currentFont

      protected Font currentFont
  • Constructor Details

    • FontSelector

      public FontSelector()
  • Method Details

    • addFont

      public void addFont(Font font)
      Adds a Font to be searched for valid characters.
      Parameters:
      font - the Font
    • process

      public Phrase process(String text)
      Process the text so that it will render with a combination of fonts if needed.
      Parameters:
      text - the text
      Returns:
      a Phrase with one or more chunks
    • processChar

      protected Chunk processChar(char[] cc, int k, StringBuffer sb)
    • getSize

      protected int getSize()
    • getFont

      protected Font getFont(int i)
    • isSupported

      private boolean isSupported(Font font)