FontStyle
class FontStyle
kotlin.Any | |
↳ | 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:
<code> 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); </code>
Summary
Constants | |
---|---|
static Int |
A font slant value for italic |
static Int |
A font slant value for upright |
static Int |
A font weight value for the black weight |
static Int |
A font weight value for the bold weight. |
static Int |
A font weight value for the extra-bold weight |
static Int |
A font weight value for the extra-light weight |
static Int |
A font weight value for the light weight |
static Int |
A maximum weight value for the font |
static Int |
A font weight value for the medium weight |
static Int |
A minimum weight value for the font |
static Int |
A font weight value for the normal weight |
static Int |
A font weight value for the semi-bold weight |
static Int |
A font weight value for the thin weight |
static Int |
A default value when font weight is unspecified |
Public constructors | |
---|---|
Create FontStyle with specific weight and italic |
Public methods | |
---|---|
Boolean |
Indicates whether some other object is "equal to" this one. |
Int |
getSlant() Gets the slant value |
Int |
Gets the weight value |
Int |
hashCode() |
String |
toString() |
Constants
FONT_SLANT_ITALIC
static val FONT_SLANT_ITALIC: Int
A font slant value for italic
Value: 1
FONT_SLANT_UPRIGHT
static val FONT_SLANT_UPRIGHT: Int
A font slant value for upright
Value: 0
FONT_WEIGHT_BLACK
static val FONT_WEIGHT_BLACK: Int
A font weight value for the black weight
Value: 900
FONT_WEIGHT_BOLD
static val FONT_WEIGHT_BOLD: Int
A font weight value for the bold weight.
Value: 700
FONT_WEIGHT_EXTRA_BOLD
static val FONT_WEIGHT_EXTRA_BOLD: Int
A font weight value for the extra-bold weight
Value: 800
FONT_WEIGHT_EXTRA_LIGHT
static val FONT_WEIGHT_EXTRA_LIGHT: Int
A font weight value for the extra-light weight
Value: 200
FONT_WEIGHT_LIGHT
static val FONT_WEIGHT_LIGHT: Int
A font weight value for the light weight
Value: 300
FONT_WEIGHT_MAX
static val FONT_WEIGHT_MAX: Int
A maximum weight value for the font
Value: 1000
FONT_WEIGHT_MEDIUM
static val FONT_WEIGHT_MEDIUM: Int
A font weight value for the medium weight
Value: 500
FONT_WEIGHT_MIN
static val FONT_WEIGHT_MIN: Int
A minimum weight value for the font
Value: 1
FONT_WEIGHT_NORMAL
static val FONT_WEIGHT_NORMAL: Int
A font weight value for the normal weight
Value: 400
FONT_WEIGHT_SEMI_BOLD
static val FONT_WEIGHT_SEMI_BOLD: Int
A font weight value for the semi-bold weight
Value: 600
FONT_WEIGHT_THIN
static val FONT_WEIGHT_THIN: Int
A font weight value for the thin weight
Value: 100
FONT_WEIGHT_UNSPECIFIED
static val FONT_WEIGHT_UNSPECIFIED: Int
A default value when font weight is unspecified
Value: -1
Public constructors
FontStyle
FontStyle(
weight: Int,
slant: Int)
Create FontStyle with specific weight and italic
Value | Name | Android Definition |
---|---|---|
100 | Thin | FontStyle#FONT_WEIGHT_THIN |
200 | Extra Light (Ultra Light) | FontStyle#FONT_WEIGHT_EXTRA_LIGHT |
300 | Light | FontStyle#FONT_WEIGHT_LIGHT |
400 | Normal (Regular) | FontStyle#FONT_WEIGHT_NORMAL |
500 | Medium | FontStyle#FONT_WEIGHT_MEDIUM |
600 | Semi Bold (Demi Bold) | FontStyle#FONT_WEIGHT_SEMI_BOLD |
700 | Bold | FontStyle#FONT_WEIGHT_BOLD |
800 | Extra Bold (Ultra Bold) | FontStyle#FONT_WEIGHT_EXTRA_BOLD |
900 | Black (Heavy) | FontStyle#FONT_WEIGHT_BLACK |
Parameters | |
---|---|
weight |
Int: a weight value |
slant |
Int: a slant value Value is android.graphics.fonts.FontStyle#FONT_SLANT_UPRIGHT , or android.graphics.fonts.FontStyle#FONT_SLANT_ITALIC |
See Also
android.graphics.fonts.FontStyle#FONT_WEIGHT_THIN
android.graphics.fonts.FontStyle#FONT_WEIGHT_EXTRA_LIGHT
android.graphics.fonts.FontStyle#FONT_WEIGHT_LIGHT
android.graphics.fonts.FontStyle#FONT_WEIGHT_NORMAL
android.graphics.fonts.FontStyle#FONT_WEIGHT_MEDIUM
android.graphics.fonts.FontStyle#FONT_WEIGHT_SEMI_BOLD
android.graphics.fonts.FontStyle#FONT_WEIGHT_BOLD
android.graphics.fonts.FontStyle#FONT_WEIGHT_EXTRA_BOLD
android.graphics.fonts.FontStyle#FONT_WEIGHT_BLACK
Public methods
equals
fun equals(other: Any?): Boolean
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
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.
Parameters | |
---|---|
obj |
the reference object with which to compare. |
o |
This value may be null . |
Return | |
---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getSlant
fun getSlant(): Int
Gets the slant value
Return | |
---|---|
Int |
a slant value Value is android.graphics.fonts.FontStyle#FONT_SLANT_UPRIGHT , or android.graphics.fonts.FontStyle#FONT_SLANT_ITALIC |
getWeight
fun getWeight(): Int
Gets the weight value
Return | |
---|---|
Int |
a weight value Value is between 0 and 1000 inclusive |
See Also
toString
fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |