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_ITALICpublic static final int FONT_SLANT_ITALIC A font slant value for italic Constant Value: 1 (0x00000001) FONT_SLANT_UPRIGHTpublic static final int FONT_SLANT_UPRIGHT A font slant value for upright Constant Value: 0 (0x00000000) FONT_WEIGHT_BLACKpublic static final int FONT_WEIGHT_BLACK A font weight value for the black weight Constant Value: 900 (0x00000384) FONT_WEIGHT_BOLDpublic static final int FONT_WEIGHT_BOLD A font weight value for the bold weight. Constant Value: 700 (0x000002bc) FONT_WEIGHT_EXTRA_BOLDpublic static final int FONT_WEIGHT_EXTRA_BOLD A font weight value for the extra-bold weight Constant Value: 800 (0x00000320) FONT_WEIGHT_EXTRA_LIGHTpublic static final int FONT_WEIGHT_EXTRA_LIGHT A font weight value for the extra-light weight Constant Value: 200 (0x000000c8) FONT_WEIGHT_LIGHTpublic static final int FONT_WEIGHT_LIGHT A font weight value for the light weight Constant Value: 300 (0x0000012c) FONT_WEIGHT_MAXpublic static final int FONT_WEIGHT_MAX A maximum weight value for the font Constant Value: 1000 (0x000003e8) FONT_WEIGHT_MEDIUMpublic static final int FONT_WEIGHT_MEDIUM A font weight value for the medium weight Constant Value: 500 (0x000001f4) FONT_WEIGHT_MINpublic static final int FONT_WEIGHT_MIN A minimum weight value for the font Constant Value: 1 (0x00000001) FONT_WEIGHT_NORMALpublic static final int FONT_WEIGHT_NORMAL A font weight value for the normal weight Constant Value: 400 (0x00000190) FONT_WEIGHT_SEMI_BOLDpublic static final int FONT_WEIGHT_SEMI_BOLD A font weight value for the semi-bold weight Constant Value: 600 (0x00000258) FONT_WEIGHT_THINpublic static final int FONT_WEIGHT_THIN A font weight value for the thin weight Constant Value: 100 (0x00000064) FONT_WEIGHT_UNSPECIFIEDpublic static final int FONT_WEIGHT_UNSPECIFIED A default value when font weight is unspecified Constant Value: -1 (0xffffffff) Public constructorsFontStylepublic FontStyle () FontStyle
public FontStyle (int weight,
int slant)Create FontStyle with specific weight and italic
See also: Public methodsequalspublic 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.
getSlantpublic int getSlant () Gets the slant value
getWeightpublic int getWeight () Gets the weight value
See also: hashCodepublic 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
toStringpublic 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 2026-12-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-12-04 UTC."],[],[]]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||