TextStyle

data class TextStyle(val fontSize: Sp = 12.sp, val fontWeight: FontWeight = FontWeight.Normal, val fontStyle: FontStyle = FontStyle.Normal, val color: PdfColor = PdfColor.Black, val font: PdfFont = PdfFont.Default, val letterSpacing: Sp = Sp.Zero, val lineHeight: Sp = Sp.Zero, val underline: Boolean = false, val strikethrough: Boolean = false, val align: TextAlign = TextAlign.Start, val maxLines: Int? = null, val overflow: TextOverflow = TextOverflow.Clip, val script: TextScript = TextScript.None, val direction: TextDirection = TextDirection.Auto, val minLinesBeforeBreak: Int = 1, val minLinesAfterBreak: Int = 1, val hyphenation: HyphenationPatterns? = null, val kashidaJustify: Boolean = false)

Visual style applied to a piece of text.

Properties are merged top-down: a value set on a parent (com.conamobile.pdfkmp.dsl.PageScope.textStyle) cascades to children unless they override it. Inheritance happens in the builders, not here — this is the resolved output of that cascade.

Constructors

Link copied to clipboard
constructor(fontSize: Sp = 12.sp, fontWeight: FontWeight = FontWeight.Normal, fontStyle: FontStyle = FontStyle.Normal, color: PdfColor = PdfColor.Black, font: PdfFont = PdfFont.Default, letterSpacing: Sp = Sp.Zero, lineHeight: Sp = Sp.Zero, underline: Boolean = false, strikethrough: Boolean = false, align: TextAlign = TextAlign.Start, maxLines: Int? = null, overflow: TextOverflow = TextOverflow.Clip, script: TextScript = TextScript.None, direction: TextDirection = TextDirection.Auto, minLinesBeforeBreak: Int = 1, minLinesAfterBreak: Int = 1, hyphenation: HyphenationPatterns? = null, kashidaJustify: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Horizontal alignment of wrapped lines inside the paragraph box. See TextAlign for the four options. Defaults to TextAlign.Start.

Link copied to clipboard

Glyph color.

Link copied to clipboard

Base paragraph direction. TextDirection.Auto (default) detects RTL scripts (Arabic, Hebrew) from the content; see TextDirection.

Link copied to clipboard

Resolvable font; defaults to the platform sans-serif.

Link copied to clipboard

Font size in scale-independent pixels.

Link copied to clipboard

Italic vs normal.

Link copied to clipboard

Weight on the 100..900 axis.

Link copied to clipboard

Automatic hyphenation dictionary, or null (the default) to disable it.

Link copied to clipboard
val kashidaJustify: Boolean = false

Kashida (tatweel, U+0640) justification for cursive RTL scripts.

Link copied to clipboard

Extra horizontal spacing inserted between adjacent glyphs. 0.sp means use the font's natural advance widths.

Link copied to clipboard

Vertical distance between baselines of consecutive lines. 0.sp means use the font's natural line height.

Link copied to clipboard
val maxLines: Int? = null

Maximum number of wrapped lines to keep. null (the default) keeps every line. When the paragraph wraps to more lines than this, the excess is dropped according to overflow.

Link copied to clipboard

Widow control: the slicing counterpart of minLinesBeforeBreak — at least this many lines must continue on the next page, otherwise lines are pulled forward from the previous page to join the lonely "widow". 1 (default) allows any split.

Link copied to clipboard

Orphan control: when the Slice strategy breaks this paragraph across pages, keep at least this many lines together at the bottom of the page before the break — fewer would leave a lonely "orphan" line. The paragraph moves to the next page whole when the minimum cannot be met. 1 (default) allows any split.

Link copied to clipboard

How to present the cut when maxLines truncates the paragraph. Ignored while maxLines is null.

Link copied to clipboard

Vertical script position — superscript / subscript. Only takes effect on rich-text spans; see TextScript.

Link copied to clipboard
val strikethrough: Boolean = false

Whether to draw a continuous line through the vertical centre of the glyphs. Inherits color like underline.

Link copied to clipboard
val underline: Boolean = false

Whether to draw a continuous line just below the baseline. The line inherits color and is one PDF point thick (scaled by font size for larger text).