CurvedTextStyle
public class CurvedTextStyle(
public val background: Color = Color.Unspecified,
public val color: Color = Color.Unspecified,
public val fontSize: TextUnit = TextUnit.Unspecified,
public val fontFamily: FontFamily? = null,
public val fontWeight: FontWeight? = null,
public val fontStyle: FontStyle? = null,
public val fontSynthesis: FontSynthesis? = null,
public val letterSpacing: TextUnit = TextUnit.Unspecified,
public val letterSpacingCounterClockwise: TextUnit = TextUnit.Unspecified,
public val lineHeight: TextUnit = TextUnit.Unspecified,
)
Styling configuration for a curved text.
Sample using different letter spacings for top & bottom text:
Parameters
background | The background color for the text. |
color | The text color. |
fontSize | The size of glyphs (in logical pixels) to use when painting the text. This may be TextUnit.Unspecified for inheriting from another CurvedTextStyle . |
fontFamily | The font family to be used when rendering the text. |
fontWeight | The thickness of the glyphs, in a range of 1, 1000 . see FontWeight |
fontStyle | The typeface variant to use when drawing the letters (e.g. italic). |
fontSynthesis | Whether to synthesize font weight and/or style when the requested weight or style cannot be found in the provided font family. |
letterSpacing | The amount of space (in em or sp) to add between each letter, when text is going clockwise. |
letterSpacingCounterClockwise | The amount of space (in em or sp) to add between each letter, when text is going counterClockwise. Note that this usually needs to be bigger than letterSpacing to account for the fact that going clockwise, text fans out from the baseline while going counter clockwise text fans in. If not specified, the value for letterSpacing will be used. |
lineHeight | Line height for the text in TextUnit unit, e.g. SP or EM. Note that since curved text only has one line, this used the equivalent of a lineHeightStyle: alignment = Center, trim = None, mode = Fixed |
Secondary Constructors
public constructor(
background: Color = Color.Unspecified,
color: Color = Color.Unspecified,
fontSize: TextUnit = TextUnit.Unspecified,
) : this(background, color, fontSize, null)
Styling configuration for a curved text.
Parameters
background | The background color for the text. |
color | The text color. |
fontSize | The size of glyphs (in logical pixels) to use when painting the text. This may be TextUnit.Unspecified for inheriting from another CurvedTextStyle . |
public constructor(
background: Color = Color.Unspecified,
color: Color = Color.Unspecified,
fontSize: TextUnit = TextUnit.Unspecified,
fontFamily: FontFamily? = null,
fontWeight: FontWeight? = null,
fontStyle: FontStyle? = null,
fontSynthesis: FontSynthesis? = null,
) : this(background, color, fontSize, fontFamily, fontWeight, fontStyle, fontSynthesis)
Parameters
background | The background color for the text. |
color | The text color. |
fontSize | The size of glyphs (in logical pixels) to use when painting the text. This may be TextUnit.Unspecified for inheriting from another CurvedTextStyle . |
fontFamily | The font family to be used when rendering the text. |
fontWeight | The thickness of the glyphs, in a range of 1, 1000 . see FontWeight |
fontStyle | The typeface variant to use when drawing the letters (e.g. italic). |
fontSynthesis | Whether to synthesize font weight and/or style when the requested weight or style cannot be found in the provided font family. |
public constructor(
background: Color = Color.Unspecified,
color: Color = Color.Unspecified,
fontSize: TextUnit = TextUnit.Unspecified,
fontFamily: FontFamily? = null,
fontWeight: FontWeight? = null,
fontStyle: FontStyle? = null,
fontSynthesis: FontSynthesis? = null,
letterSpacing: TextUnit = TextUnit.Unspecified,
) : this(
background,
color,
fontSize,
fontFamily,
fontWeight,
fontStyle,
fontSynthesis,
letterSpacing,
letterSpacing,
)
Parameters
background | The background color for the text. |
color | The text color. |
fontSize | The size of glyphs (in logical pixels) to use when painting the text. This may be TextUnit.Unspecified for inheriting from another CurvedTextStyle . |
fontFamily | The font family to be used when rendering the text. |
fontWeight | The thickness of the glyphs, in a range of 1, 1000 . see FontWeight |
fontStyle | The typeface variant to use when drawing the letters (e.g. italic). |
fontSynthesis | Whether to synthesize font weight and/or style when the requested weight or style cannot be found in the provided font family. |
letterSpacing | The amount of space (in em or sp) to add between each letter. |
public constructor(
style: TextStyle
) : this(
style.background,
style.color,
style.fontSize,
style.fontFamily,
style.fontWeight,
style.fontStyle,
style.fontSynthesis,
style.letterSpacing,
style.letterSpacing,
style.lineHeight,
)
Create a curved text style from the given text style.
Note that not all parameters in the text style will be used, only TextStyle.color
,
TextStyle.fontSize
, TextStyle.background
, TextStyle.fontFamily
, TextStyle.fontWeight
,
TextStyle.fontStyle
, TextStyle.fontSynthesis
, TextStyle.letterSpacing
,
TextStyle.lineHeight
.
Functions
public fun merge(other: CurvedTextStyle? = null): CurvedTextStyle
Returns a new curved text style that is a combination of this style and the given other
style.
other
curved text style's null or inherit properties are replaced with the non-null
properties of this curved text style. Another way to think of it is that the "missing"
properties of the other
style are filled by the properties of this style.
If the given curved text style is null, returns this curved text style.
public operator fun plus(other: CurvedTextStyle): CurvedTextStyle
Plus operator overload that applies a merge
.
public fun copy(
background: Color = this.background,
color: Color = this.color,
fontSize: TextUnit = this.fontSize,
): CurvedTextStyle
public fun copy(
background: Color = this.background,
color: Color = this.color,
fontSize: TextUnit = this.fontSize,
fontFamily: FontFamily? = this.fontFamily,
fontWeight: FontWeight? = this.fontWeight,
fontStyle: FontStyle? = this.fontStyle,
fontSynthesis: FontSynthesis? = this.fontSynthesis,
): CurvedTextStyle
public fun copy(
background: Color = this.background,
color: Color = this.color,
fontSize: TextUnit = this.fontSize,
fontFamily: FontFamily? = this.fontFamily,
fontWeight: FontWeight? = this.fontWeight,
fontStyle: FontStyle? = this.fontStyle,
fontSynthesis: FontSynthesis? = this.fontSynthesis,
letterSpacing: TextUnit = TextUnit.Unspecified,
): CurvedTextStyle
public fun copy(
background: Color = this.background,
color: Color = this.color,
fontSize: TextUnit = this.fontSize,
fontFamily: FontFamily? = this.fontFamily,
fontWeight: FontWeight? = this.fontWeight,
fontStyle: FontStyle? = this.fontStyle,
fontSynthesis: FontSynthesis? = this.fontSynthesis,
letterSpacing: TextUnit = this.letterSpacing,
letterSpacingCounterClockwise: TextUnit = this.letterSpacingCounterClockwise,
lineHeight: TextUnit = this.lineHeight,
): CurvedTextStyle