Text utilities: width estimation and line wrapping for PDF layout.
Uses a Helvetica-like character-width approximation (~0.5 pt per character per unit font size).
Summary
Functions
Estimated width of a string in points (Helvetica-like).
Breaks a string into lines that fit within max_width (in points).
Splits on spaces (words); if a word exceeds max_width, breaks by character.
Preserves existing newlines as paragraph breaks.
Functions
Estimated width of a string in points (Helvetica-like).
Breaks a string into lines that fit within max_width (in points).
Splits on spaces (words); if a word exceeds max_width, breaks by character.
Preserves existing newlines as paragraph breaks.