Paragraph Class

Definition

A paragraph of text in one style, broken into lines greedily: each line takes as much text as fits the content width, ending at a line break opportunity of the Unicode Line Breaking Algorithm, and a hard line break (line feed, carriage return, next line, line or paragraph separator, vertical tab, form feed) always ends a line. Lines are aligned or justified and placed one line height apart, continuing on the next page when a line would cross the bottom margin.

public sealed class Paragraph : FlowBlock

Remarks

ISO 32000-2 §9.4.3 and §9.4.4: each line is one text object positioned with Tm and shown with Tj (or TJ when kerned). Justification stretches the spaces of every line but a paragraph's last (and lines ended by a hard line break): with word spacing Tw when the font applies it to its single-byte space code, otherwise with a TJ adjustment after each space. The glyph box of a line ([descent, ascent] of the font) is centred vertically in the line height.

UAX #14, Unicode Line Breaking Algorithm (revision 53, Unicode 16.0.0), default rules untailored: lines may break after spaces and hyphens, between ideographs and before opening punctuation, never at a no-break space or word joiner. A soft hyphen (U+00AD) is not shown unless the line breaks after it, where a hyphen-minus is shown in its place (UAX #14 §5.3). Spaces and hard line breaks at a line end are not shown. A word wider than the content width breaks at the last extended grapheme cluster boundary (UAX #29) that fits, at least one cluster per line: the emergency break UAX #14 describes under rule LB3.

A paragraph of inline content (TextRuns and InlineImages) breaks its lines over the text of all its runs together, an image counting as U+FFFC OBJECT REPLACEMENT CHARACTER. Each run is shown in its own font, size and colour (Tf and the colour operators change inside the line's text object, §9.3 and §8.6.8) on the line's common baseline: the line is as tall as its tallest content, each run's glyph box centred in its own line height and an image standing on the baseline, and never shorter than a line of the paragraph's style. Images end the text object and are painted with Do (§8.9.5). Underlines and strike-throughs are filled rectangles after the text; links are link annotations (§12.5.6.5) over each run's portion of a line.

UAX #9, Unicode Bidirectional Algorithm (revision 50, Unicode 16.0.0): the paragraph's embedding levels are resolved once under Direction (each hard paragraph separator starting a new bidi paragraph, rule P1), lines are broken in logical order, and each line is split into runs of one level, reset by rule L1 and reordered by L2. Each run is shaped on its own in its direction, right-to-left runs with mirrored glyphs (L4). A line whose runs move is wrapped in a Span marked-content sequence whose ActualText is the line's text in logical order (ISO 32000-2 §14.9.4), so extraction, which reads content order, gets the logical text; a single right-to-left run already carries its own.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Constructors (2)

Properties (3)