Skip to main content

text_width

Function text_width 

Source
pub fn text_width(text: &str, size: f64) -> f64
Expand description

Estimated width (px) of text set at font size size, in the house sans (Hanken Grotesk, or the system UI font it falls back to). This is a heuristic per-character average-width table, not real font metrics — good enough for layout decisions (fit, overlap, auto-wrap), not for pixel-perfect text extents.