I have been thinking about this for a while.

The two possibilities I see for querying the current font are:

  1. Use the font bounding box for centering.

This might not fit the current string.

  1. Extract the metrics of all glyphs in the string.

How should the vertical centering be done? Using the lowest height, or the largest height, the median, ...?

For Latin fonts I would correct by the half of the lowest height (with respect to the base line). But I don't know if this would also fit cyrillic, japanese and other fonts.

If I find some time, I could come up with a proposal patch.