FontStyle
public
final
class
FontStyle
extends Object
java.lang.Object | |
↳ | android.graphics.fonts.FontStyle |
A font style object. This class represents a single font style which is a pair of weight value and slant value. Here are common font styles examples:
final FontStyle NORMAL = new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_UPRIGHT);
final FontStyle BOLD = new FontStyle(FONT_WEIGHT_BOLD, FONT_SLANT_UPRIGHT);
final FontStyle ITALIC = new FontStyle(FONT_WEIGHT_NORMAL, FONT_SLANT_ITALIC);
final FontStyle BOLD_ITALIC = new FontStyle(FONT_WEIGHT_BOLD, FONT_SLANT_ITALIC);
Summary
Constants | |
---|---|
int |
FONT_SLANT_ITALIC
A font slant value for italic |
int |
FONT_SLANT_UPRIGHT
A font slant value for upright |
int |
FONT_WEIGHT_BLACK
A font weight value for the black weight |
int |
FONT_WEIGHT_BOLD
A font weight value for the bold weight. |
int |
FONT_WEIGHT_EXTRA_BOLD
A font weight value for the extra-bold weight |
int |
FONT_WEIGHT_EXTRA_LIGHT
A font weight value for the extra-light weight |
int |
FONT_WEIGHT_LIGHT
A font weight value for the light weight |
int |
FONT_WEIGHT_MAX
A maximum weight value for the font |
int |
FONT_WEIGHT_MEDIUM
A font weight value for the medium weight |
int |
FONT_WEIGHT_MIN
A minimum weight value for the font |
int |
FONT_WEIGHT_NORMAL
A font weight value for the normal weight |
int |
FONT_WEIGHT_SEMI_BOLD
A font weight value for the semi-bold weight |
int |
FONT_WEIGHT_THIN
A font weight value for the thin weight |
int |
FONT_WEIGHT_UNSPECIFIED
A default value when font weight is unspecified |
Public constructors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FontStyle()
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FontStyle(int weight, int slant)
Create FontStyle with specific weight and italic
ConstantsFONT_SLANT_ITALIC
Added in API level 29
public static final int FONT_SLANT_ITALIC A font slant value for italic Constant Value: 1 (0x00000001) FONT_SLANT_UPRIGHT
Added in API level 29
public static final int FONT_SLANT_UPRIGHT A font slant value for upright Constant Value: 0 (0x00000000) FONT_WEIGHT_BLACK
Added in API level 29
public static final int FONT_WEIGHT_BLACK A font weight value for the black weight Constant Value: 900 (0x00000384) FONT_WEIGHT_BOLD
Added in API level 29
public static final int FONT_WEIGHT_BOLD A font weight value for the bold weight. Constant Value: 700 (0x000002bc) FONT_WEIGHT_EXTRA_BOLD
Added in API level 29
public static final int FONT_WEIGHT_EXTRA_BOLD A font weight value for the extra-bold weight Constant Value: 800 (0x00000320) FONT_WEIGHT_EXTRA_LIGHT
Added in API level 29
public static final int FONT_WEIGHT_EXTRA_LIGHT A font weight value for the extra-light weight Constant Value: 200 (0x000000c8) FONT_WEIGHT_LIGHT
Added in API level 29
public static final int FONT_WEIGHT_LIGHT A font weight value for the light weight Constant Value: 300 (0x0000012c) FONT_WEIGHT_MAX
Added in API level 29
public static final int FONT_WEIGHT_MAX A maximum weight value for the font Constant Value: 1000 (0x000003e8) FONT_WEIGHT_MEDIUM
Added in API level 29
public static final int FONT_WEIGHT_MEDIUM A font weight value for the medium weight Constant Value: 500 (0x000001f4) FONT_WEIGHT_MIN
Added in API level 29
public static final int FONT_WEIGHT_MIN A minimum weight value for the font Constant Value: 1 (0x00000001) FONT_WEIGHT_NORMAL
Added in API level 29
public static final int FONT_WEIGHT_NORMAL A font weight value for the normal weight Constant Value: 400 (0x00000190) FONT_WEIGHT_SEMI_BOLD
Added in API level 29
public static final int FONT_WEIGHT_SEMI_BOLD A font weight value for the semi-bold weight Constant Value: 600 (0x00000258) FONT_WEIGHT_THIN
Added in API level 29
public static final int FONT_WEIGHT_THIN A font weight value for the thin weight Constant Value: 100 (0x00000064) FONT_WEIGHT_UNSPECIFIED
Added in API level 34
public static final int FONT_WEIGHT_UNSPECIFIED A default value when font weight is unspecified Constant Value: -1 (0xffffffff) Public constructorsFontStyle
Added in API level 29
public FontStyle (int weight, int slant) Create FontStyle with specific weight and italic
See also: Public methodsequals
Added in API level 29
public boolean equals (Object o) Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
getSlant
Added in API level 29
public int getSlant () Gets the slant value
getWeight
Added in API level 29
public int getWeight () Gets the weight value
See also: hashCode
Added in API level 29
public int hashCode () Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
toString
Added in API level 29
public String toString () Returns a string representation of the object.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates. Last updated 2024-04-11 UTC.
[null,null,["Last updated 2024-04-11 UTC."],[],[]]
|