Source set: Common
public class ParagraphStyle(
public val textAlign: TextAlign = TextAlign.Unspecified,
public val textDirection: TextDirection = TextDirection.Unspecified,
public val lineHeight: TextUnit = TextUnit.Unspecified,
public val textIndent: TextIndent? = null,
public val platformStyle: PlatformParagraphStyle? = null,
public val lineHeightStyle: LineHeightStyle? = null,
public val lineBreak: LineBreak = LineBreak.Unspecified,
public val hyphens: Hyphens = Hyphens.Unspecified,
public val textMotion: TextMotion? = null,
) : AnnotatedString.Annotation
Paragraph styling configuration.
Defines styling parameters that apply to a whole paragraph (e.g., alignment, line height).
In contrast to SpanStyle which applies at character level, ParagraphStyle separates the marked text into a new paragraph, as if a line feed character was inserted.
Parameters
| textAlign | alignment of the text within the lines of the paragraph. |
| textDirection | algorithm used to resolve the final text direction: Left To Right or Right To Left. |
| lineHeight | line height |
| textIndent | paragraph indentation |
| platformStyle | platform-specific parameters |
| lineHeightStyle | line height distribution configuration |
| lineBreak | line breaking rules. |
| hyphens | hyphenation configuration. |
| textMotion | character placement optimization. |
Properties
deprecatedboxingtextAlign
Source set: Common
@Deprecated("Kept for backwards compatibility.", level = DeprecationLevel.WARNING)
@get:JvmName("getTextAlign-buA522U") // b/320819734
public val deprecated_boxing_textAlign: TextAlign?
deprecatedboxingtextDirection
Source set: Common
@Deprecated("Kept for backwards compatibility.", level = DeprecationLevel.WARNING)
@get:JvmName("getTextDirection-mmuk1to") // b/320819734
public val deprecated_boxing_textDirection: TextDirection?
deprecatedboxinghyphens
Source set: Common
@Deprecated("Kept for backwards compatibility.", level = DeprecationLevel.WARNING)
@get:JvmName("getHyphens-EaSxIns") // b/320819734
public val deprecated_boxing_hyphens: Hyphens?
deprecatedboxinglineBreak
Source set: Common
@Deprecated("Kept for backwards compatibility.", level = DeprecationLevel.WARNING)
@get:JvmName("getLineBreak-LgCVezo") // b/320819734
public val deprecated_boxing_lineBreak: LineBreak?
Functions
merge
Source set: Common
public fun merge(other: ParagraphStyle? = null): ParagraphStyle
Returns a new paragraph style that is a combination of this style and the given other style.
If the given paragraph style is null, returns this paragraph style.
Parameters
| other | style to merge |
plus
Source set: Common
@Stable public operator fun plus(other: ParagraphStyle): ParagraphStyle
Plus operator overload that applies a merge.
copy
Source set: Common
@Deprecated(
"ParagraphStyle copy constructors that do not take new stable parameters " +
"like LineHeightStyle, LineBreak, Hyphens are deprecated. Please use the new stable " +
"copy constructor.",
level = DeprecationLevel.HIDDEN,
)
public fun copy(
textAlign: TextAlign? = this.textAlign,
textDirection: TextDirection? = this.textDirection,
lineHeight: TextUnit = this.lineHeight,
textIndent: TextIndent? = this.textIndent,
): ParagraphStyle
copy
Source set: Common
@Deprecated(
"ParagraphStyle copy constructors that do not take new stable parameters " +
"like LineHeightStyle, LineBreak, Hyphens are deprecated. Please use the new stable " +
"copy constructor.",
level = DeprecationLevel.HIDDEN,
)
public fun copy(
textAlign: TextAlign? = this.textAlign,
textDirection: TextDirection? = this.textDirection,
lineHeight: TextUnit = this.lineHeight,
textIndent: TextIndent? = this.textIndent,
platformStyle: PlatformParagraphStyle? = this.platformStyle,
lineHeightStyle: LineHeightStyle? = this.lineHeightStyle,
): ParagraphStyle
copy
Source set: Common
@Deprecated(
"ParagraphStyle copy constructors that do not take new stable parameters " +
"like LineBreak, Hyphens, TextMotion are deprecated. Please use the new stable " +
"copy constructor.",
level = DeprecationLevel.HIDDEN,
)
public fun copy(
textAlign: TextAlign? = this.textAlign,
textDirection: TextDirection? = this.textDirection,
lineHeight: TextUnit = this.lineHeight,
textIndent: TextIndent? = this.textIndent,
platformStyle: PlatformParagraphStyle? = this.platformStyle,
lineHeightStyle: LineHeightStyle? = this.lineHeightStyle,
lineBreak: LineBreak? = this.lineBreak,
hyphens: Hyphens? = this.hyphens,
): ParagraphStyle
copy
Source set: Common
@Deprecated(
"ParagraphStyle copy constructors that take nullable TextAlign, " +
"TextDirection, LineBreak, and Hyphens are deprecated. Please use a new constructor " +
"where these parameters are non-nullable. Null value has been replaced by a special " +
"Unspecified object for performance reason.",
level = DeprecationLevel.HIDDEN,
)
public fun copy(
textAlign: TextAlign? = this.textAlign,
textDirection: TextDirection? = this.textDirection,
lineHeight: TextUnit = this.lineHeight,
textIndent: TextIndent? = this.textIndent,
platformStyle: PlatformParagraphStyle? = this.platformStyle,
lineHeightStyle: LineHeightStyle? = this.lineHeightStyle,
lineBreak: LineBreak? = this.lineBreak,
hyphens: Hyphens? = this.hyphens,
textMotion: TextMotion? = this.textMotion,
): ParagraphStyle
copy
Source set: Common
public fun copy(
textAlign: TextAlign = this.textAlign,
textDirection: TextDirection = this.textDirection,
lineHeight: TextUnit = this.lineHeight,
textIndent: TextIndent? = this.textIndent,
platformStyle: PlatformParagraphStyle? = this.platformStyle,
lineHeightStyle: LineHeightStyle? = this.lineHeightStyle,
lineBreak: LineBreak = this.lineBreak,
hyphens: Hyphens = this.hyphens,
textMotion: TextMotion? = this.textMotion,
): ParagraphStyle