There are many answers here which explain how to obtain the size of the current font (\f@size) and others which explain how to obtain the height of a given character (\settoheight) in the current font.

I would like to know how to obtain the height of a font, i.e. the distance between the upper edge of the enclosing box of a capital letter and the baseline. Is there such a metric defined for fonts, i.e. is there such a property within font design? – The idea is motivated by the graphic in this answer that the letters "Q" and "A" (at least in that font, at least to the precision of the rendering) have the same height.

If not, is there a "typical" capital letter whose height could be used as a substitute?

Background: I'm trying to align a TikZ text node with respect to its upper edge, but the actual text can vary depending on the circumstances and may or may not contain capital letters. The idea would be to position using the baseline instead, and set the coordinate lower by a certain amount.

  • Could you give a MWE to show what effect do you want to achieve?
    – ZhiyuanLck
    Commented Jul 15, 2020 at 4:12
  • @ZhiyuanLck, I'm looking for a generic answer, not the solution to a concrete programming problem. I added the "Background" only for motivation.
    – A. Donda
    Commented Jul 15, 2020 at 4:32

2 Answers 2


The way fontspec determines Scale=MatchUppercase is exactly how you said in your question. It measures the height of the letter H, which you can do with \settoheight. The H-height is a traditional way of doing it (I’ve also seen T), but some fonts might have an ornament on the letter H that makes a different letter a better choice.

If you want to measure the descent, you could take the depth of gjpqy. This will give you the greatest depth of any of them.

  • 1
    Thanks, if fontspec does it this way, that's good enough for me. – For future reference for people who want to achieve something similar: I ended up using node[anchor=base,yshift=-height("H")]; height is TikZ' shorter version of \settoheight.
    – A. Donda
    Commented Jul 15, 2020 at 4:34
  • Sorry, follow-up: Is there a similar letter recommendation for a "typical" descender depth? E.g. "y" or "g"?
    – A. Donda
    Commented Jul 15, 2020 at 5:08
  • 1
    @A.Donda It depends on the font; in Computer Modern the deepest glyph is j, but for other fonts it could be y. Also, the height depends on the language: with French, for instance, you should also take into account accents.
    – egreg
    Commented Jul 15, 2020 at 12:26

To supplement Davislor's answer, according to fonts.com, the "font height" I was asking for is typographically called cap(ital) height, or H height. The corresponding "font depth" is called descender depth or p height. And finally, there is the ascender height or k height. All terms reflect the letters typically used to define them.

Wikipedia states that the cap height is determined from capital letters with a flat top such as "H" or "I".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .