Class RMFontUtils


  • public class RMFontUtils
    extends java.lang.Object
    Provides some utility methods for Fonts.
    • Constructor Summary

      Constructors 
      Constructor Description
      RMFontUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equals​(java.awt.Font f1, java.awt.Font f2)
      Returns whether two fonts are equal.
      static RMFont getAltFont​(char aChar)
      Returns an alternate font for given char, if one is found that can display it
      static java.util.List<RMFont> getAltFonts()
      Returns the list of suggested alternate fonts.
      static java.lang.String[] getFamilyNames()
      Returns a list of all system family names.
      static java.awt.Font getFont​(java.lang.String aName, float aSize)
      Returns a Font for a given name and size.
      static java.lang.String getFontNameNormalized​(java.lang.String aName)
      Returns a "cleaned up" or standardized version of the given font name: 1.
      static java.lang.String[] getFontNames()
      Returns a list of all system fontnames (excludes any that don't start with capital A-Z).
      static java.lang.String[] getFontNames​(java.lang.String aFamilyName)
      Returns a list of all font names for a given family name.
      static java.awt.Font[] getFonts()
      Returns the array of system fonts.
      static java.awt.Font guessFont​(java.lang.String aName)
      Returns the system font with the most similar name to the given name.
      static void startFontLoadingInBackground()
      Starts loading fonts in the background and returns.
      • Methods inherited from class java.lang.Object

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

      • RMFontUtils

        public RMFontUtils()
    • Method Detail

      • getFont

        public static java.awt.Font getFont​(java.lang.String aName,
                                            float aSize)
        Returns a Font for a given name and size.
      • getFonts

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

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

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

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

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

        public static java.lang.String getFontNameNormalized​(java.lang.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 RMFont getAltFont​(char aChar)
        Returns an alternate font for given char, if one is found that can display it
      • getAltFonts

        public static java.util.List<RMFont> getAltFonts()
        Returns the list of suggested alternate fonts.
      • equals

        public static boolean equals​(java.awt.Font f1,
                                     java.awt.Font f2)
        Returns whether two fonts are equal.
      • startFontLoadingInBackground

        public static void startFontLoadingInBackground()
        Starts loading fonts in the background and returns.