Class FontUtilities


public class FontUtilities
Utility class for font-related operations.
  • Method Details

    • getFallbackFontIfNecessary

      public static Font getFallbackFontIfNecessary(String stringToWrite, float textSize, Font primaryFont, Font fallbackFont)
      Returns a fallback font if the primary font cannot display the specified string.
      Parameters:
      stringToWrite - the string to be displayed
      textSize - the size of the text
      primaryFont - the primary font to be used
      fallbackFont - the fallback font to be used if the primary font cannot display the string
      Returns:
      the primary font if it can display the string, otherwise the fallback font