Skip to main content

estimate_text_width_1pt

Function estimate_text_width_1pt 

Source
pub fn estimate_text_width_1pt(
    font_name: &str,
    text: &str,
    bold: bool,
    italic: bool,
) -> f64
Expand description

estimate_text_width_1pt from lib/common/textspan_lut.c: width of text at 1pt.

Matches C exactly: the font name is looked up directly in the LUT families (PostScript aliases such as Times-Bold are not consulted, so they measure as regular Times), and the text is measured byte by byte, so each byte of a UTF-8 multi-byte character counts as one space (see docs/c-bugs-ledger.md, GV-BUG-011/013).