blob: 04803c82b8ba56a043b5fa10576dbc424f1f7df7 [file] [log] [blame]
Arathorn75a23b52020-08-05 13:31:40 +02001SYNOPSIS
2 int text_width(string str)
3
4DESCRIPTION
5 Returns the approximate screen width of the given string.
6
7 Normally the width is the same as the string length, but this efun
8 takes ANSI escape sequences and wide unicode characters into account.
9 Thus the result might be smaller or larger than the string length.
10
11 If the string contains line breaks the width of the widest line
12 is returned.
13
14 Note that the actual rendering of unicode strings is entirely
15 dependent upon the client's capabilities, regional context and the
16 fonts used there. So this efun will only return a guess for the
17 displayed width.
18
19EXAMPLES
20 text_width("\e[1mHeya!\e[0m") -> 5
21
22HISTORY
23 Introduced in LDMud 3.6.2.
24
25SEE ALSO
26 sizeof(E)