A great advantage of putting variables and constants in one class is that you could both write <tt>5π</tt> and <tt>5x</tt>.
Right now you only support single variables.
Try seeing them as the other symbols (π, <i>e</i>, i), and draw them like that.
The code from <i>e</i> for example won't differ that much from the code that draws / measures the text for the variables.