- All Implemented Interfaces:
Serializable
,Comparable<FontWeight>
,Constable
Specifies different font weights which can be used when searching for a
font on the system.
The names correspond to pre-defined weights in the OS/2 table of the
OpenType font specification.
The CSS 3 specification references the same as a sequence of values.
- Since:
- JavaFX 2.0
-
Nested Class Summary
Nested classes/interfaces declared in class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionrepresents Black font weight (900).represents Bold font weight (700).represents 'Extra Bold' font weight (800).represents 'Extra Light' font weight (200).represents Light font weight (300).represents Medium font weight (500).represents Normal font weight (400).represents 'Demi Bold' font weight (600).represents Thin font weight (100). -
Method Summary
Modifier and TypeMethodDescriptionstatic FontWeight
findByName
(String name) ReturnsFontWeight
by its name.static FontWeight
findByWeight
(int weight) Returns the closestFontWeight
for a weight value as defined by the CSS and OpenType specifications.int
Return the visual weight (degree of blackness or thickness) specified by thisFontWeight
.static FontWeight
Returns the enum constant of this class with the specified name.static FontWeight[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
THIN
represents Thin font weight (100). -
EXTRA_LIGHT
represents 'Extra Light' font weight (200). -
LIGHT
represents Light font weight (300). -
NORMAL
represents Normal font weight (400). -
MEDIUM
represents Medium font weight (500). -
SEMI_BOLD
represents 'Demi Bold' font weight (600). -
BOLD
represents Bold font weight (700). -
EXTRA_BOLD
represents 'Extra Bold' font weight (800). -
BLACK
represents Black font weight (900).
-
-
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
-
getWeight
public int getWeight()Return the visual weight (degree of blackness or thickness) specified by thisFontWeight
.- Returns:
- weight
-
findByName
ReturnsFontWeight
by its name.- Parameters:
name
- name of theFontWeight
- Returns:
- the FontWeight by its name
-
findByWeight
Returns the closestFontWeight
for a weight value as defined by the CSS and OpenType specifications. Where the specified value is equidistant between twoFontWeight
values, then the implementation may select either at its discretion. This lookup is without reference to a font, so this is purely a mapping to the set ofFontWeight
instances and does not mean that a font of that weight will be available.- Parameters:
weight
- the weight value- Returns:
- closest
FontWeight
-