Skip to main content

Module vt

Module vt 

Source
Expand description

The variable-text layout engine: a field value in, positioned glyphs out.

A small paragraph engine. A document is a list of sections — paragraphs, split on the line breaks the text itself carries — and each section holds one entry per character, not per word. Line breaking then groups those entries into lines, and placement gives each one an x and a y.

Two things about the coordinate space. Everything internal is y-down from the plate’s top-left corner, and Layout::to_pdf flips it back on the way out. And the two quantities the formulas call line_leading and line_indent are always zero upstream — never assigned, never returned as anything else. The terms stay in the arithmetic so it reads against the source, but nothing varies them.

§Who uses it

The free-text and pop-up annotation generators, the /NeedAppearances form path, and the widget appearance builders in crate::ap::field_body. There is no second implementation: what the widget path drives is a shell over this engine whose only observable addition is a vertical alignment offset, which the builders pass as edit_ap::generate’s offset.

Modules§

hit
Mapping between a point, a caret position and a character index.

Structs§

Config
How a piece of variable text is to be set.
Layout
A laid-out piece of variable text.
Line
One line of a section.
Metrics
What the engine needs to know about the font it is setting.
Section
One paragraph.
Word
One character, placed.

Enums§

Alignment
How a line sits within the plate.
Direction
Which way a paragraph runs.

Functions§

layout
Lays out a piece of variable text.