pub struct TextPrimitiveNode {
pub node_id: NodeId,
pub rect: Rect,
pub text: Rc<AnnotatedString>,
pub render_text: Arc<RenderString>,
pub text_style: Arc<TextStyle>,
pub font_size: f32,
pub layout_options: TextLayoutOptions,
pub clip: Option<Rect>,
pub paint: TextPaintCache,
}Expand description
A run of text to draw, with the layout facts that a renderer needs.
Fields§
§node_id: NodeIdLayout node that owns the text.
rect: RectBox of the laid-out text in logical pixels, after alignment and panning.
text: Rc<AnnotatedString>Shared so the renderer can hand the same allocation to every draw it emits for this node instead of deep-copying the string once per emit.
render_text: Arc<RenderString>text as the renderer’s draws carry it across threads, shared with
the prepared layout it came from so no frame converts it again.
text_style: Arc<TextStyle>Shared so every frame’s draws of this text hand over the same style instead of copying it.
font_size: f32Resolved font size in logical pixels.
layout_options: TextLayoutOptionsOptions (overflow, soft wrap, line limits) the text was measured with.
clip: Option<Rect>Rectangle that cuts the glyphs, or None when overflow is visible and the text does not
pan.
paint: TextPaintCacheWhat a renderer reads of text_style and text’s spans to draw the
glyphs, so that drawing a plain text does not load the style.