Class FontSelector


  • public class FontSelector
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.ArrayList<Font> fonts  
    • Constructor Summary

      Constructors 
      Constructor Description
      FontSelector()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFont​(Font font)
      Adds a Font to be searched for valid characters.
      Phrase process​(java.lang.String text)
      Process the text so that it will render with a combination of fonts if needed.
      void setDefaultColor​(java.awt.Color color)
      change the color of default font in FontSelector.
      void setDefaultSize​(float size)
      change the size of default font in FontSelector.
      • Methods inherited from class java.lang.Object

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

      • fonts

        protected java.util.ArrayList<Font> fonts
    • Constructor Detail

      • FontSelector

        public FontSelector()
    • Method Detail

      • setDefaultColor

        public void setDefaultColor​(java.awt.Color color)
        change the color of default font in FontSelector.
        Parameters:
        color - the Color of default font
      • setDefaultSize

        public void setDefaultSize​(float size)
        change the size of default font in FontSelector.
        Parameters:
        size - the size of default font
      • addFont

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

        public Phrase process​(java.lang.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