Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

wrap_stroke_text_box

Function wrap_stroke_text_box 

Source
pub fn wrap_stroke_text_box(
    text: &str,
    max_width_mm: f64,
    size_x_nm: i64,
) -> String
Expand description

Break KiCad-markup text into lines no wider than max_width_mm at glyph width size_x_nm, at spaces only (Python _wrap_text_box_lines). A word wider than the box keeps its own line. Each byte is appended and measured at most twice (once more when it triggers a wrap), so a long paragraph cannot degrade into repeated whole-prefix measurement.