TextUnit
@Immutable inline class TextUnit
kotlin.Any | |
↳ | androidx.compose.ui.unit.TextUnit |
The unit used for text related dimension value.
This unit can hold either scaled pixels (SP), relative font size (em) and special unit for indicating inheriting from other style.
Note that do not store this value in your persistent storage or send to another process since the internal representation may be changed in future.
Summary
Public constructors | |
---|---|
The unit used for text related dimension value. |
Public methods | |
---|---|
operator Int |
Support comparing Dimensions with comparison operators. |
operator TextUnit |
Divide a TextUnit by a scalar. |
operator TextUnit |
Divide a TextUnit by a scalar. |
operator TextUnit |
Divide a TextUnit by a scalar. |
operator Float |
Divide by another TextUnit to get a scalar. |
operator TextUnit |
Subtract a TextUnit from another one. |
operator TextUnit |
Add two TextUnits together. |
operator TextUnit |
Multiply a TextUnit by a scalar. |
operator TextUnit |
Multiply a TextUnit by a scalar. |
operator TextUnit |
Multiply a TextUnit by a scalar. |
String |
toString() |
operator TextUnit |
This is the same as multiplying the TextUnit by -1. |
Companion functions | |
---|---|
TextUnit |
Creates an EM unit TextUnit. |
TextUnit |
Creates an EM unit TextUnit. |
TextUnit |
Creates an EM unit TextUnit. |
TextUnit |
Creates a SP unit TextUnit. |
TextUnit |
Creates a SP unit TextUnit. |
TextUnit |
Creates a SP unit TextUnit. |
Extension functions | ||||||||
---|---|---|---|---|---|---|---|---|
From androidx.compose.ui.unit
|
Properties | |
---|---|
Boolean |
True if this is a EM unit type. |
Boolean |
True if this is TextUnit.Unspecified, otherwise false. |
Boolean |
True if this is a SP unit type. |
Long | |
TextUnitType |
A type information of this TextUnit. |
Float |
Returns the value |
Companion properties | |
---|---|
TextUnit |
A special TextUnit instance for representing inheriting from parent value. |
TextUnit |
A special TextUnit instance for representing inheriting from parent value. |
Extension properties | ||||
---|---|---|---|---|
From androidx.compose.ui.unit
|
Public constructors
<init>
TextUnit(packedValue: Long)
The unit used for text related dimension value.
This unit can hold either scaled pixels (SP), relative font size (em) and special unit for indicating inheriting from other style.
Note that do not store this value in your persistent storage or send to another process since the internal representation may be changed in future.
Public methods
compareTo
inline operator fun compareTo(other: TextUnit): Int
Support comparing Dimensions with comparison operators.
div
inline operator fun div(other: Float): TextUnit
Divide a TextUnit by a scalar.
This operation works only if the left operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
div
inline operator fun div(other: Double): TextUnit
Divide a TextUnit by a scalar.
This operation works only if the left operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
div
inline operator fun div(other: Int): TextUnit
Divide a TextUnit by a scalar.
This operation works only if the left operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
div
inline operator fun div(other: TextUnit): Float
Divide by another TextUnit to get a scalar.
This operation works only if all the operands are the same unit type and they are not equal to TextUnit.Unspecified.
minus
inline operator fun minus(other: TextUnit): TextUnit
Subtract a TextUnit from another one.
This operation works only if all the operands are the same unit type and not they are not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
plus
inline operator fun plus(other: TextUnit): TextUnit
Add two TextUnits together.
This operation works only if all the operands are the same unit type and not they are not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
times
inline operator fun times(other: Float): TextUnit
Multiply a TextUnit by a scalar.
This operation works only if the left operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
times
inline operator fun times(other: Double): TextUnit
Multiply a TextUnit by a scalar.
This operation works only if the left operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
times
inline operator fun times(other: Int): TextUnit
Multiply a TextUnit by a scalar.
This operation works only if the left operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
toString
fun toString(): String
unaryMinus
inline operator fun unaryMinus(): TextUnit
This is the same as multiplying the TextUnit by -1.0.
This operation works only if the operand is not equal to TextUnit.Unspecified. The result of this operation is the same unit type of the given one.
Properties
packedValue
val packedValue: Long
type
val type: TextUnitType
A type information of this TextUnit.
Exceptions | |
---|---|
RuntimeException |
if unknown unknown unit type is appeared. |