format text so that it doesn't overflow