Expand description
A toolkit-neutral text style — the seam that lets one document model drive any frontend.
The WYSIWYG builder (crate::wysiwyg) tags each rendered glyph with one of
these instead of a ratatui::Style or a gpui::TextStyle, so the caret
model and the AST→glyph layout stay free of any GUI/TUI dependency.
What core records is what a glyph is, never what color to paint it: a
Role (heading, code, link, a list bullet, …) plus the portable emphasis
the author actually wrote (**bold**, *em*, {+ins+}, {-del-}). Palette
is presentation, and presentation belongs to the frontend — a terminal tells
a heading from body text by color because color is all it can vary, while a
GUI varies size and font instead. So each frontend maps a Role to its own
look: leaf-tui turns it into terminal colors, leaf-gpui into an Hsla
plus a font size and family. Core stays out of that argument.
The one place core does carry a paint value is the presentation vocabulary
the author writes by hand: a data-size is a name (SizeStep) where a
name will do and a measurement (FontSize::Points) where the author needed
exactness, and the open type beside each closed enum — FontSize,
LineHeight, TextColor, FontFace — is where the two meet. A name
outlives a theme change and a value does not, which is the trade the author
makes knowingly; see docs/proposals/exact-presentation-values.md.
Structs§
- FaceId
- A named family’s id on a glyph — what
FaceRef::Namedcarries andFaceTable::namereads back. - Face
Table - Every named family a
crate::wysiwyg::VisualMapdraws, by the id its glyphs carry — the side table that letsStylestayCopywhile a face name stays aString. - Hundredths
- A number a presentation value carries, in hundredths — 14 points is
1400, a ratio of 1.3 is130. - Style
- A glyph’s style: a typographic
Roleplus the compositional emphasis flags the author wrote. Deliberately no color — that is a frontend’s call, keyed on theRole. Builder methods (.bold,.italic, …) mirror the shape of ratatui’sStyleso the WYSIWYG builder reads the same as it did before the split.
Enums§
- Align
- How a block’s lines are set across the measure — the one presentation
property an author reaches for before any other, and the only one of the
six whose vocabulary is a class rather than a
data-key. - Baseline
- Which line a glyph sits on relative to the text around it.
- FaceRef
- The face a glyph is set in —
FontFace’sCopyhalf, so that aStylestaysCopyandEqand can be stamped on every glyph and compared for run-merging. - Font
Face - The face a run is set in: one of CSS’s four generics, or the family the author named.
- Font
Family - The face a run is set in — CSS’s generic families, less
fantasyandsystem-ui, neither of which an author asks for. - Font
Size - How large a run is set: a
SizeSteprelative to the text around it, or the point size the author asked for. - Line
Height - How far apart a block’s lines are set: a
LineSpacingfrom the menu’s three, or the ratio the author asked for.FontSize’s peer, one property along, and with no unit at all — a line height is a multiple. - Line
Spacing - How far apart a block’s lines are set, as a multiple of the theme’s own line height — the spacing menu every word processor has, less the single spacing that is absence.
- Mark
Color - The colour an author named on a highlight — the closed vocabulary twig
records as a
marknode’sdata-color, one variant per circle emoji the==🔴 text==spelling recognises. - Role
- What a glyph is, typographically — the semantic role a frontend maps to its
own presentation. Mutually exclusive per glyph (a glyph is a heading, or a
link, or body text — not two at once); the compositional emphasis a run can
also carry lives in
Style’sbold/italic/underline/strikethroughflags alongside this. - Size
Step - How large a run is set relative to the text around it — CSS’s
<absolute-size>keyword set withmediumremoved, becausemediumis absence. - Text
Color - A run’s foreground colour: one of the seven
MarkColornames, or the RGB triple the author asked for. - Token
- What a glyph in a fenced code block is to the language it is written in
— the syntax-highlighting vocabulary, one level down from
Role.