Note, you do need to consider precisely what you mean by vertical centering.
Fonts are rendered on a baseline, running along the bottom of the text. The vertical space is allocated as follows:
---
^
| leading
v
--
^ Y Y
| Y Y
| Y Y
| ascent Y y y
| Y y y
v Y y y
__ baseline ______Y________y_________
| y
v descent yy
--
The leading is simply the font's recommended space between lines. For the sake of centering vertically between two points, you should ignore leading (it's leding, BTW, not leeding; in typography it was the lead inserted between lines in a printing plate).
So for centering the text ascenders and descenders, you want the
baseline=(top+((bottom+1-top)/2) - ((ascent + descent)/2) + ascent;
Without the final "+ ascent", you have the position for the top of the font; therefore adding the ascent goes from the top to the baseline.
Also, note that the font height should include leading, but some fonts don't include it, and the due to rounding differences, the font height may not exactly equal (leading + ascent + descent).