Calculate text width using a specific font size Supports mathematical notation with superscripts and subscripts