Added text_width function to 2d.