From my point of view you can only calculate it, from the size of the title
string plus a constant number, for the margins.
The size of the string can be calculated in pixels using the
FontMetrics class, and of course it is dependent on the string and on the font that is used.
Ana