Skip to content

PdfTextLayout class

View as Markdown

Namespace: PdfNetStack.Drawing
Assembly: PdfNetStack.dll
Package: PdfNetStack

A paragraph broken into lines for a given width: the Unicode line breaking algorithm finds break opportunities, the bidirectional algorithm orders each line, and an OpenType shaper forms the glyphs. Measure with it, then draw it with DrawText.

public sealed class PdfTextLayout

Inheritance

object ← PdfTextLayout

Lines are filled greedily, breaking at spaces, at soft hyphens and, with Hyphenator, inside words. A word still wider than the line is broken between characters. Trailing spaces do not count toward a line’s width. Line height follows the CSS model: each span’s font contributes its ascent and descent, spread by the paragraph’s line height.

Total height of all lines.

public double Height { get; }

double

The lines, top to bottom.

public IReadOnlyList<PdfTextLine> Lines { get; }

IReadOnlyList<PdfTextLine>

The width lines were broken for.

public double MaxWidth { get; }

double

The laid out paragraph.

public PdfParagraph Paragraph { get; }

PdfParagraph

Width of the widest line.

public double Width { get; }

double

Breaks paragraph into lines no wider than width points.

public static PdfTextLayout Create(PdfParagraph paragraph, double width)

paragraph PdfParagraph

width double

PdfTextLayout

ArgumentException

A character has no glyph in its style’s font or fallbacks.