Package snap.swing

Class AWTFontUtils

java.lang.Object
snap.swing.AWTFontUtils

public class AWTFontUtils extends Object
Provides some utility methods for Fonts.
  • Constructor Details

    • AWTFontUtils

      public AWTFontUtils()
  • Method Details

    • getFont

      public static Font getFont(String aName, double aSize)
      Returns a Font for a given name and size.
    • getFonts

      public static Font[] getFonts()
      Returns the array of system fonts.
    • getFontNames

      public static String[] getFontNames()
      Returns a list of all system fontnames (excludes any that don't start with capital A-Z).
    • getFamilyNames

      public static String[] getFamilyNames()
      Returns a list of all system family names.
    • getFontNames

      public static String[] getFontNames(String aFamilyName)
      Returns a list of all font names for a given family name.
    • guessFont

      public static Font guessFont(String aName)
      Returns the system font with the most similar name to the given name.
    • getFontNameNormalized

      public static String getFontNameNormalized(String aName)
      Returns a "cleaned up" or standardized version of the given font name: 1. Remove MT or MS or PS 2. Convert all non alpha numeric characters (essentially just dashes?) to spaces 3. Add space between any adjacent pair of lower-case:upper-case chars
    • getAltFont

      public static Font getAltFont(char aChar)
      Returns an alternate font for given char, if one is found that can display it
    • getAltFonts

      public static Font[] getAltFonts()
      Returns the list of suggested alternate fonts.