Enum Class FontFamily
- All Implemented Interfaces:
Serializable, Comparable<FontFamily>, Constable
標準字體家族枚舉。
定義常見的字體系統名稱,應用程式可根據需求選擇使用。 字體檔案需由應用層自行提供並透過 FontBuilder 載入。
範例用法:
// 應用層提供字體檔案路徑
InputStream fontStream = getClass().getResourceAsStream("fonts/NotoSans.ttf");
Font font = FontBuilder.newFont(fontStream)
.withStyle(Font.BOLD)
.ofSize(14)
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDialog 字體Dialog Input 字體系統預設等寬字體系統預設無襯線字體系統預設襯線字體 -
Method Summary
Modifier and TypeMethodDescriptiongetName()取得字體家族的顯示名稱toString()取得字體家族名稱(等同於 getName)static FontFamilyReturns the enum constant of this class with the specified name.static FontFamily[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SANS_SERIF
系統預設無襯線字體 -
SERIF
系統預設襯線字體 -
MONOSPACE
系統預設等寬字體 -
DIALOG
Dialog 字體 -
DIALOG_INPUT
Dialog Input 字體
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getName
-
toString
取得字體家族名稱(等同於 getName)- Overrides:
toStringin classEnum<FontFamily>- Returns:
- 字體名稱
-