Truncating Long UTF-8 Label Text with an Ellipsis in Lua
Long strings can overflow a fixed label. The original project used a SubUTF8String helper to truncate by characters rather than raw bytes:
| |
string.len() counts bytes, so it should not be used by itself as a character count for UTF-8 text. For proportional fonts, character count is only an approximation; measuring rendered width and truncating until it fits produces a more accurate UI.