Skip to main content

measure_text

Function measure_text 

Source
pub fn measure_text(
    rasterizer: &TextRasterizer,
    text: &str,
    style: &TextStyle,
    size: PictureSize,
) -> Result<TextBounds, TextRasterError>
Expand description

Where text in style lies on a canvas of size, laid out with rasterizer’s fonts and placed exactly as a frame places it, without drawing it.

Measured at the frame’s render size it agrees with that frame to the pixel; at another size lines can break elsewhere.

§Errors

Returns the text host’s refusal: no fonts, or a style out of range.