Utility: Measure text width and split properly

Signed-off-by: Peter Cai <xqsx43cxy@126.com>