pub struct TextPrimitive {
pub rect: Rect,
pub text: Rc<str>,
pub style: TextStyle,
pub color: Color,
}Expand description
A run of text, positioned and ready to rasterize.
rect is already resolved: DrawScope::draw_text_at measures the
string, applies TextStyle::align / TextStyle::vertical_align inside
the requested box, and stores the result here. Renderers therefore lay the
glyphs out from rect’s top-left and never re-align — which is what keeps
what DrawScope::measure_text reported and what lands on screen the same
geometry.
Fields§
§rect: RectTight block box: origin is the top-left of the first line’s slot, size is the measured size.
text: Rc<str>Shared so redrawing an unchanged string each frame clones a pointer rather than the characters.
style: TextStyle§color: ColorText is filled with a single color: the glyph atlas path modulates one
vertex color per glyph. Gradient brushes are resolved to their first
stop by the draw scope, exactly like DrawScope::draw_vector_path.
Trait Implementations§
Source§impl Clone for TextPrimitive
impl Clone for TextPrimitive
Source§fn clone(&self) -> TextPrimitive
fn clone(&self) -> TextPrimitive
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more