Skip to main content

paint_aligned_text

Function paint_aligned_text 

Source
pub fn paint_aligned_text(
    ctx: &mut PaintCtx,
    rect: Rect,
    text: &str,
    style: &TextStyle,
    line_height: f32,
    horizontal_alignment: f32,
)
Expand description

Paint text using SUI’s shared optical baseline and horizontal alignment path.

horizontal_alignment is clamped to 0.0..=1.0, where 0.0 is left, 0.5 is centered, and 1.0 is right aligned. Callers should normally pass style.line_height for line_height; the separate argument is retained for compatibility with controls that constrain a token line-height to their slot.