I'm trying to place text accurately in the centre of a pane both horizontally and vertically. Using fontmetrics and a test program I get the following results:

[![enter image description here](https://i.stack.imgur.com/q4M6F.jpg)](https://i.stack.imgur.com/q4M6F.jpg)

This test raises the following questions:

1. Why is the ascent value (top black line) so high? I expected it to go across the top of the 'T'. The magenta line is the 'lineheight' value, so I assume that's the baseline for any text above it.
2. If the black line includes line spacing, why is there no measurement for the top of the 'T'?
3. Is there a way to get an accurate bounding box or do I have to graphically linescan a text image to find the boundaries? Obviously the left and right values also include some sort of spacing, so a scan would seem to be the only solution.