My idea is to redefine the \strut to be as short as possible.

It means the length of strut is the sum of the tallest letter length and the deepest letter length.

  • 2
    Hm. Do you mean "the tallest letter in the font file", "the tallest letter of an encoding (e.g. T1)" or "the tallest letter used in your document"? This sets can differ quite a lot - even more if you include luatex/xetex in your question which can use large fonts with thousands of characters. Dec 22, 2010 at 9:57
  • @Ulrike, the tallest letter for fonts used in my document only. Dec 22, 2010 at 10:00
  • 3
    All fonts? Include the "large symbol math font"? At what about the unused letters in the fonts? Should a chinese letter be measured too? Dec 22, 2010 at 10:15
  • 1
    Then measuring the box Ag should usually be enough, perhaps with some safety margin.
    – Philipp
    Dec 22, 2010 at 14:03
  • 1
    @xport if you use { like in maths you should look-up mathstrut.
    – yannisl
    Dec 22, 2010 at 16:37

3 Answers 3


One problem is that the font metrics do not include appropriate dimensions for this. The code below provides a short macro for displaying the font dimensions.


\usepackage{graphicx, booktabs, tabularx, scalefnt, xcolor} 

  Parameter  & Description & Value\\
  fontdimen1 & slant &  \the\fontdimen1\font\\
  fontdimen2 &interword space  &  \the\fontdimen2\font\\
  fontdimen3 &interword stretch &  \the\fontdimen3\font\\
  fontdimen4 & interword shrink &  \the\fontdimen4\font\\
  fontdimen5 & x-height &  \the\fontdimen5\font\\
  fontdimen6 & quad width &  \the\fontdimen6\font\\
  fontdimen7 & extra space &  \the\fontdimen7\font\\
\caption{Font metrics for font #1}

\scalebox{2}{ H\'AMB\"URG\'E\c F\'ON\c ST\'IV}

\scalebox{2}{ \lowercase{H\'AMB\"URG\'E\'ty\c F\'ON\c ST\'IV}}


One solution is to use a vphantom which you can use as a strut.


\colorbox{yellow}{\Z abcdy}
  • thanks for introducing vphantom that I haven't known before. It will be sophisticated if on the fly we can make a query against the letters to find the heighest letter and the deepest letter. And finally construct a strut using \vphantom and the 2 letters obtained by the query. Dec 22, 2010 at 6:33
  • why did you use nested \vphantom when defining \Z ? does it make a difference if I just use one? Dec 22, 2010 at 7:29
  • 1
    @xport It makes little difference. I used two to show that you get a different height based on y rather than l.
    – yannisl
    Dec 22, 2010 at 10:49

the strutbox is defined to exactly the height of \baselineskip which is the smallest value including the interlinespace of a row. However, you have to redefine every time the strutbux when changing the fontsize. This is the reason why it makes no sense to have an own strut value. Use instead the \vphantom macro:

  • first of all, thank for answering. The combination Äg produces the longest length? Or are there other combinations that produce the longest one? Dec 22, 2010 at 6:36
  • 3
    There is no longest length in general. It depends to the used language. For example, when writing vietnamese you have double accents (accent over another one). The conbination of Äg is the longest one for german, no more no less.
    – user2478
    Dec 22, 2010 at 6:57
  • Rather than making a new macro, why not change \strutbox appropriately? It should be an \hbox containing a \vrule with the appropriate height and depth and zero width.
    – TH.
    Dec 22, 2010 at 19:39

The Luatex manual, section, Glyph items, documents the glyph array that exists for each font, which provides information on the bounding element of each rendered character:

On boundingbox: The boundingbox information for TrueType fonts and TrueType-based otf fonts is read directly from the font file. PostScript-based fonts do not have this information, so the boundingbox of traditional PostScript fonts is generated by interpreting the actual bezier curves to find the exact boundingbox. This can be a slow process, so starting from LuaTEX 0.45, the boundingboxes of Post- Script-based otf fonts (and raw cff fonts) are calculated using an approximation of the glyph shape based on the actual glyph points only, instead of taking the whole curve into account. This means that glyphs that have missing points at extrema will have a too-tight boundingbox, but the processing is so much faster that in our opinion the tradeoff is worth it.

This sounds like it is as good an approximation to what you want as you will get. Iterating over the glyphs in a font and computing the maximum altitude and depth of each should be fairly easy if you know Lua.

  • I think one of the OpenType headers already contains the correct values for the maximum ascent and descent.
    – Philipp
    Dec 22, 2010 at 13:32
  • @Philipp: I think that's what the first sentence I quoted means, but it won't help with other kinds of font. Dec 22, 2010 at 15:45
  • I'm not sure, but I interpreted the sentence as referring to the bounding boxes of inidividual characters, not to the global maximum values.
    – Philipp
    Dec 22, 2010 at 17:10
  • @Philipp: Yes, that is right, I misunderstood the point you were making. Where that exists, it probably is better than the result from computing the value by iteration. Dec 22, 2010 at 19:23

You must log in to answer this question.

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