Arathorn | 75a23b5 | 2020-08-05 13:31:40 +0200 | [diff] [blame] | 1 | SYNOPSIS |
| 2 | int text_width(string str) |
| 3 | |
| 4 | DESCRIPTION |
| 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 | |
| 19 | EXAMPLES |
| 20 | text_width("\e[1mHeya!\e[0m") -> 5 |
| 21 | |
| 22 | HISTORY |
| 23 | Introduced in LDMud 3.6.2. |
| 24 | |
| 25 | SEE ALSO |
| 26 | sizeof(E) |