(39 lines)
1 '\" t2 .\" Copyright (c) 2025 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Text.width 3 2025-11-29 "Tomo man-pages"6 .SH NAME7 Text.width \- get display width8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Text.width\ :\ func(text:\ Text\ ->\ Int)13 .fi14 .SH DESCRIPTION15 Returns the display width of the text as seen in a terminal with appropriate font rendering. This is usually the same as the text's `.length`, but there are some characters like emojis that render wider than 1 cell.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx23 l l l.24 Name Type Description25 text Text The text whose length you want.26 .TE27 .SH RETURN28 An integer representing the display width of the text.30 .SH NOTES31 This will not always be exactly accurate when your terminal's font rendering can't handle some unicode displaying correctly.33 .SH EXAMPLES34 .EX35 assert "AmΓ©lie".width() == 636 assert "π€ ".width() == 237 .EE38 .SH SEE ALSO39 .BR Tomo-Text (3)