Table of Contents

Namespace Egami.Fonts.Layout

Classes

DecorationShape

One decoration line over a decorated stretch of one text line: an underline, overline or line-through at one position and thickness for the whole stretch (the lowest underline and thickest line among its fonts, as CSS), cut where glyphs cross an underline or overline when SkipInk is Auto.

LayoutRun

A piece of a line: glyphs of one font and bidi level, or a placeholder, tab or break.

LineBreaks

Finds where lines may break: Unicode's line breaking algorithm (UAX #14, Unicode 17.0) from Egami's own tables, with CSS Text 3's word-break and line-break switches. No shaping is involved, and there are no dictionaries: Thai, Lao, Khmer and Myanmar break only at spaces and zero width spaces.

LineFlow

Lays a paragraph out one line at a time, each at its own width, so text can flow across columns and pages or around images; Layout(float) is built on it. Not thread-safe; make one per flow.

Paragraph

A paragraph of styled text, prepared once to be laid out at any width: styles resolved, bidi levels and break opportunities found, text itemized into runs and each run shaped. Immutable and safe to share between threads.

ParagraphStyle

How a paragraph is laid out: its default text style, direction, alignment, line breaking, line filling, hyphens, ellipsis and line limits, line box rules, tabs and writing mode. The defaults follow CSS: start-aligned, greedy filling, normal line height, tab stops every 8 spaces, horizontal lines.

RichText

Text with styles: a string, the StyleSpans over it (sorted, never overlapping) and the Placeholders for its object replacement characters, in order. Immutable; build one with RichTextBuilder.

RichTextBuilder

Builds a RichText: Push(TextStyle) a style, Append(string) text, Pop() back to the enclosing style. Styles nest: a pushed style's unset fields come from the one it is pushed on, and the result has one flat span per stretch of equal style.

Strut

A minimum line box every line has, from a font and a line height (CSS's strut), or with Force the exact line box, for line grids in forms and columns.

TextDecoration

Lines drawn with text (CSS Text Decoration 4).

TextLayout

A paragraph laid out at a width: its lines of glyph runs and the size of its layout box. Positions are in canvas units relative to the box's top-left corner, y down; nothing is rounded to pixels. Immutable and safe to share between threads.

TextLine

One line of a laid-out paragraph: the text it holds, its line box and its runs in visual order. Coordinates are the layout box's, or for a line from a LineFlow, the line's own box with its top at 0.

TextStyle

How a stretch of text looks. Every field is optional: an unset field takes the enclosing builder style's, then the paragraph's DefaultStyle, then Egami's default (16 pixels, black, normal line height, no decoration). Fields that change shaping (fonts, size, style, variations, language, features, letter spacing) split a paragraph into separately shaped runs; the others (colors, paints, background, decoration, shadows) never do, so a color change inside a ligature keeps the ligature.

Structs

Caret

Where a caret is drawn: the primary segment, and at a bidi boundary, where the position touches text of both directions, a secondary segment at the other text's edge.

CaretLine

A caret segment across the line: vertical in horizontal layouts, horizontal in vertical ones.

DecorationSegment

A piece of a decoration line along a text line: its left and right x.

LineBreak

A place where a line may or must end.

LineBreakEnumerator

Enumerates line break opportunities; get one from Enumerate(ReadOnlySpan<char>, LineBreakOptions).

LineBreakOptions

How text may break into lines, as CSS Text 3 sets it: word-break, overflow-wrap, line-break and the content language. The default is CSS's default: Unicode's line breaking algorithm (UAX #14) with breaks before small kana, as browsers break.

LineHeight

The height a run asks of its line box (CSS line-height): Normal from the font's metrics, a Multiple(float) of the font size or an Absolute(float) height. The extra over the font's ascent and descent is split half above and half below.

Placeholder

An inline box laid out with the text, such as an icon or an image, which the caller draws: it stands for an object replacement character (U+FFFC) in the text, so bidi, line breaking and indexes treat it as one character.

StyleSpan

A text style over a stretch of a RichText, in UTF-16 units.

TabStop

An explicit tab stop.

TextPosition

A caret position: a UTF-16 index at a grapheme cluster boundary and the side it belongs to.

TextShadow

A shadow under text: the glyphs and decorations again, moved and blurred (CSS text-shadow).

Interfaces

ITextPaint

A paint that Egami.Fonts carries for text but never reads: Egami.Drawing's Paint implements it, so gradients, images and blend modes reach text drawn from a layout without Egami.Fonts depending on the drawing package.

Enums

CaretMove

How MoveCaret(TextPosition, CaretMove, float) moves a caret.

KashidaLevel

How far Kashida lengthens a word, as Word's three kashida justifications.

LayoutRunKind

What a LayoutRun holds.

LineBreakStrictness

How strictly line breaks follow Chinese and Japanese rules (CSS line-break): breaks before small kana, hyphens, iteration marks and some punctuation.

LineFill

How lines are filled.

LineHeightKind

How a LineHeight is given.

OverflowWrap

Whether a piece wider than its line may break anywhere (CSS overflow-wrap).

PlaceholderAlignment

How a Placeholder sits on its line.

SelectionHeight

How tall selection rectangles are.

TabAlignment

How text aligns on a tab stop.

TextAffinity

Which side of a position a caret belongs to where one index has two places: at a line wrap or a bidi boundary.

TextAlign

How lines align in their width (CSS text-align).

TextAlignLast

How the last line, and lines before a hard break, align (CSS text-align-last).

TextDecorationLines

Which decoration lines are drawn.

TextDecorationSkipInk

Whether underlines and overlines skip glyph ink.

TextDecorationStyle

How decoration lines are drawn.

TextJustify

How justified lines stretch (CSS text-justify).

TextOrientation

How characters stand in vertical lines (CSS text-orientation).

WordBreak

Where breaks may fall inside words (CSS word-break).

WritingMode

Whether lines run horizontally or vertically (CSS writing-mode).