Automatic text wrapping and reformatting