This will depend on the font, as @tobybot stated, and can also depend on the specific software.
It's important to understand a bit about font anatomy to understand why your question is difficult to answer. Font anatomy is a pretty complex issue, but for these purposes, all you need to know is how the height of a font is defined. Take a look at this graphic:
Pay attention to the terms at the extreme left of this graphic. Every typeface has a baseline, which is the line upon which the majority of the characters sit, an x-height, which is the height of a lowercase X, as well as the height of the main portion of lowercase letters in that typeface*, and then ascender and descender lines, for those elements that rise above or drop below the height of the majority of the letters.
One of the defining characteristics of different typefaces is the x-height. Some fonts have an x-height that is exactly half the height of an ascender, others may have a low or high x-height. For a typeface that has a high x-height, like the one shown in the graphic, determining the vertical center of the letters mathematically may result in something that doesn't appear to our eyes to be vertically centered.
I don't know this for sure, but I would guess that some software programs determine the vertical height of a type element by dividing the distance between the ascender line and the descender line in half, and others might use a more nuanced mathematical calculation based on the x-height of a particular typeface. You might be able to determine how any particular program makes that determination by searching for information on that software and "x-height justification" or something similar. However, even if you figure out how your particular program determines the vertical center, I think you will often have to adjust the final design manually to account for the differences between how our eyes respond to typefaces with differing x-heights.
*There are lots of explanations of x-height and other font anatomy questions all over the web--this is one that I thought was pretty clear.
EDITED TO ADD: I think that @cai's comment is probably correct, that software may well determine the vertical center of a text element based on the EM height value, which is included within the font definition. However, whether the vertical height is based upon x-height or EM height, the issues that arise because of the way our eyes perceive visual weight will still pertain.