# Where exactly is text aligned in terms of the edges of the text?

For example, say I have an invisible rectangle that's bigger than a line of text inside it. If I now click align in some software, for example Microsoft Publisher, so that the text's vertical center is the same as the box's vertical center, I have the following questions:

How is the text aligned? Is is based on the center point from the base line to top line, or including letters that fall below the line, e.g. "y" "g" "j" etc.?

In other words, what is the mathematical distance/ratio of how the text is distributed inside the rectangle and what are the reference points (i.e. where across the text are the top and bottom baselines)?

• I believe this will depend on the font... Commented Jun 13, 2017 at 15:36

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.

• I don't know (and it's impossible to know for all software) but I would assume that there's none of that calculating based on x-height etc and it's all just based on the em height
– Cai
Commented Jun 13, 2017 at 18:04

I don't know for certain (it's impossible to know for all software; and I havn't touched PowerPoint in a long long time) but I would assume that everything is aligned based on the font's EM height, rather than taking in to account the design of the typeface itself.

All fonts are designed on an EM grid. Most often 1000 × 1000 or 2048 × 2048 units. This is (AFAIK) mostly a convention and can be something completely different in reality though (the number of units makes little difference for this though). This means, for a font designed on a 1000 × 1000 grid and set at 10 pt, those 1000 units will be 10 pt. If the "E" on that font is 800 units tall, it will be 8 pt tall.

The EM height will roughly be from descender to ascender or cap height, but this is by no means guaranteed. Those metrics will often be slightly within the EM square and you can have glyphs that extend beyond the bounds of the EM height (unlike in the days of moveable type)...

The box drawn around the "e" in this example corresponds to the bounds of the character, of which the height is the full EM height (which is slightly below the descenders, and slightly more above the ascenders):

• As someone who does not do any font creation/editing, I bow to your greater knowledge regarding EM grids. Commented Jun 13, 2017 at 21:33