TextStyle
@Immutable data class TextStyle
kotlin.Any | |
↳ | androidx.compose.ui.text.TextStyle |
Styling configuration for a Text
.
import androidx.compose.material.Text import androidx.compose.ui.text.TextStyle Text( text = "Demo Text", style = TextStyle( color = Color.Red, fontSize = 16.sp, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.W800, fontStyle = FontStyle.Italic, letterSpacing = 0.5.em, background = Color.LightGray, textDecoration = TextDecoration.Underline ) )
Summary
Public constructors | |
---|---|
<init>(color: Color = Color.Unspecified, fontSize: TextUnit = TextUnit.Unspecified, fontWeight: FontWeight? = null, fontStyle: FontStyle? = null, fontSynthesis: FontSynthesis? = null, fontFamily: FontFamily? = null, fontFeatureSettings: String? = null, letterSpacing: TextUnit = TextUnit.Unspecified, baselineShift: BaselineShift? = null, textGeometricTransform: TextGeometricTransform? = null, localeList: LocaleList? = null, background: Color = Color.Unspecified, textDecoration: TextDecoration? = null, shadow: Shadow? = null, textAlign: TextAlign? = null, textDirection: TextDirection? = null, lineHeight: TextUnit = TextUnit.Unspecified, textIndent: TextIndent? = null) Styling configuration for a |
Public methods | |
---|---|
TextStyle |
Returns a new text style that is a combination of this style and the given other style. |
TextStyle |
Returns a new text style that is a combination of this style and the given other style. |
TextStyle |
merge(other: ParagraphStyle) Returns a new text style that is a combination of this style and the given other style. |
operator TextStyle |
Plus operator overload that applies a merge. |
operator TextStyle |
plus(other: ParagraphStyle) Plus operator overload that applies a merge. |
operator TextStyle |
Plus operator overload that applies a merge. |
ParagraphStyle | |
SpanStyle |
Properties | |
---|---|
Color |
The background color for the text. |
BaselineShift? |
The amount by which the text is shifted up from the current baseline. |
Color |
The text color. |
FontFamily? |
The font family to be used when rendering the text. |
String? |
The advanced typography settings provided by font. |
TextUnit |
The size of glyphs to use when painting the text. |
FontStyle? |
The typeface variant to use when drawing the letters (e. |
FontSynthesis? |
Whether to synthesize font weight and/or style when the requested weight or style cannot be found in the provided custom font family. |
FontWeight? |
The typeface thickness to use when painting the text (e. |
TextUnit |
The amount of space to add between each letter. |
TextUnit | |
LocaleList? |
The locale list used to select region-specific glyphs. |
Shadow? |
The shadow effect applied on the text. |
TextAlign? |
The alignment of the text within the lines of the paragraph. |
TextDecoration? |
The decorations to paint on the text (e. |
TextDirection? |
The algorithm to be used to resolve the final text and paragraph direction: Left To Right or Right To Left. |
TextGeometricTransform? |
The geometric transformation applied the text. |
TextIndent? |
The indentation of the paragraph. |
Companion properties | |
---|---|
TextStyle |
Constant for default text style. |
Public constructors
<init>
TextStyle(
color: Color = Color.Unspecified,
fontSize: TextUnit = TextUnit.Unspecified,
fontWeight: FontWeight? = null,
fontStyle: FontStyle? = null,
fontSynthesis: FontSynthesis