Skip to main content

measure_box_size

Function measure_box_size 

Source
pub fn measure_box_size(
    painter: &Style<'_, impl Renderer>,
    text: &str,
    width: BoxWidth,
) -> GridSize
Expand description

Measure text as a box width wide shows it and return the box extent in whole grid cells — the shown text’s laid-out size plus the inset padding, rounded up so the box always encloses the text. A box with a width of its own keeps it, and only its height follows the text.