Enum Class FontFamily

java.lang.Object
java.lang.Enum<FontFamily>
io.leandev.appfuse.font.FontFamily
All Implemented Interfaces:
Serializable, Comparable<FontFamily>, Constable

public enum FontFamily extends Enum<FontFamily>

標準字體家族枚舉。

定義常見的字體系統名稱,應用程式可根據需求選擇使用。 字體檔案需由應用層自行提供並透過 FontBuilder 載入。

範例用法:

// 應用層提供字體檔案路徑
InputStream fontStream = getClass().getResourceAsStream("fonts/NotoSans.ttf");
Font font = FontBuilder.newFont(fontStream)
    .withStyle(Font.BOLD)
    .ofSize(14)
    .build();
  • Enum Constant Details

    • SANS_SERIF

      public static final FontFamily SANS_SERIF
      系統預設無襯線字體
    • SERIF

      public static final FontFamily SERIF
      系統預設襯線字體
    • MONOSPACE

      public static final FontFamily MONOSPACE
      系統預設等寬字體
    • DIALOG

      public static final FontFamily DIALOG
      Dialog 字體
    • DIALOG_INPUT

      public static final FontFamily DIALOG_INPUT
      Dialog Input 字體
  • Method Details

    • values

      public static FontFamily[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FontFamily valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getName

      public String getName()
      取得字體家族的顯示名稱
      Returns:
      顯示名稱
    • toString

      public String toString()
      取得字體家族名稱(等同於 getName)
      Overrides:
      toString in class Enum<FontFamily>
      Returns:
      字體名稱