Skip to main content

Module rich

Module rich 

Source
Expand description

Rich text labels (#413, ggtext’s element_markdown()): a small Markdown / HTML subset in titles, axis titles, strip and legend text when Theme::rich_text is on.

Supported: **bold**, *italic* / _italic_, ^super^ / ~sub~, <b>, <i>, <sup>, <sub>, <span style='color:#rrggbb'> (or a basic CSS colour name: red, steelblue, …) and \* escapes. Anything else is literal text.

Structs§

RichRun
One run of uniformly styled text.

Functions§

draw
Draw text — as rich runs when rich is on and it carries markup, else exactly as DrawBackend::draw_text (byte-identical).
has_markup
Does text contain any markup parse would interpret?
layout_runs
Lay runs out left to right (along the text’s angle): each run’s text, start point and style, measuring a run with width(text, size, face) — what a backend without native rich text draws with DrawBackend::draw_text.
parse
Split text into styled runs.
plain
The text with all markup removed (for width estimates and fallbacks).
run_size
The font size of a shifted (super / subscript) run.

Type Aliases§

RunWidth
Measures a run: (text, size, face) -> width in px.