Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.
Rich text: the inline runs of one paragraph, and the font fallback chain.
A rich paragraph is one text node with several runs: every run has its own
face, size and colour, but they are laid out as one paragraph. The
lines break across the run boundaries (with the break rules and the wrap
modes of [crate::text_wrap]), the runs of a line share one baseline, and
the height of a line is the max of its runs (an explicit line height wins,
as in a plain text).
The font fallback chain is the other half: a face that has no glyph for a cluster hands that cluster to the next face of the chain (the primary face first, then the fallbacks of the text, then the default chain of the typesetter). The runs split where the face changes, and each face-run is shaped on its own (the width of a line is the sum of its face-runs).
Structs
structaster_blueprint::rich_text::Deco
pub struct Deco { /* see fields */ }The decoration of a run: lines drawn in the run's colour and a background, none of which touches the layout.
Public fields
| field | type | |
|---|---|---|
underline | bool | |
strike | bool | |
bg | Option<[u8; 4]> | The background behind the run (sRGB, straight alpha). |
Methods
fn is_none(&self) -> bool
Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq
structaster_blueprint::rich_text::Piece
pub struct Piece { /* see fields */ }One face-run of a rich line: the text of one face, with its size and colour.
Public fields
| field | type | |
|---|---|---|
text | String | The text of the piece. |
font | String | The face of the piece. |
size | f64 | The size of the piece. |
color | Option<[u8; 4]> | The colour of the piece (the element's own colour when it is none). |
level | u8 | The resolved bidi level of the piece (odd is shaped right to left). |
iso | u32 | The isolate span the piece belongs to (0: none) and the level of the text around that isolate: the visual order never mixes an isolate with its surroundings. |
outer | u8 | |
w | f64 | The measured width of the piece. |
h | f64 | The height of the face (ascent + descent + gap). |
ascent | f64 | The ascent of the face: the baseline is this far below the top. |
deco | Deco | The lines and background drawn with the piece. |
Methods
fn dir(&self) -> Direction— The direction the piece is shaped in.
Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq
structaster_blueprint::rich_text::Rich
pub struct Rich { /* see fields */ }A laid-out rich paragraph.
Public fields
| field | type | |
|---|---|---|
lines | Vec<RichLine> | The lines of the paragraph. |
width | f64 | The width of the widest line. |
height | f64 | The height of the paragraph (the sum of its line heights). |
text | String | The plain text of the paragraph (what a screen reader reads). |
Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq
structaster_blueprint::rich_text::RichLine
pub struct RichLine { /* see fields */ }One line of a rich paragraph.
Public fields
| field | type | |
|---|---|---|
pieces | Vec<Piece> | The face-runs of the line, in order. |
w | f64 | The width of the line (the sum of its pieces). |
h | f64 | The height of the line: the max of its runs, or the node's explicit pitch when it has one. |
baseline | f64 | The baseline of the line, from the top of the line. |
Trait implementations: Clone, Debug, Default, PartialEq, StructuralPartialEq
structaster_blueprint::rich_text::Span
pub struct Span { /* see fields */ }One inline run of a rich paragraph.
Public fields
| field | type | |
|---|---|---|
text | String | The text of the run. |
font | String | The face of the run (the node's own face when it is empty). |
size | f64 | The size of the run (the node's own size when it is zero). |
color | Option<[u8; 4]> | The colour of the run (the node's own colour when it is none). |
dir | Option<layout::Direction> | The run is a directional isolate of this direction (None: it reads in the paragraph's flow). |
deco | Deco | The lines and background drawn with the run. |
Methods
fn new(text: impl Into<String>) -> Span— A run oftextin the node's own face, size and colour.fn deco(self, deco: Deco) -> Span— Draw the run underlined, struck through or on a background.fn dir(self, dir: Direction) -> Span— Make the run a directional isolate (UAX #9 LRI / RLI): it is resolved indiron its own, as one neutral object of the paragraph around it, so a Hebrew name in an English sentence (or the other way round) does not pull the punctuation next to it into its direction.fn font(self, f: impl Into<String>) -> Span— The face of the run (the node's own face when it is empty;"bold"is the bold face of the UI theme).fn bold(self) -> Span— The bold face of the run.fn size(self, s: f64) -> Span— The size of the run (px).fn color(self, c: [u8; 4]) -> Span— The colour of the run (sRGB, straight alpha).
Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq
Functions
fnaster_blueprint::rich_text::span
pub fn span(text: impl Into<String>) -> SpanA run of text in the node's own face, size and colour.