Expand description
Text wrapping utilities shared by layout (measuring) and render (drawing).
Constants§
- CHAR_W
- Approximate pixel width per character at font_scale=1.0 in Minecraft’s default font.
- LINE_
GAP - Gap between wrapped lines.
- LINE_H
- Line height at font_scale=1.0.
Functions§
- line_
count - Number of lines that
textwraps to, at the given scale inmax_wpixels. - text_
height - Total height (px) of wrapped
text. - wrap_
text - Break
textinto lines that fit withinmax_wpixels atfont_scale. Words that are longer than one line get hard-broken at the character boundary.