1

I'm trying to measure the width of arbitrary letters. For example, I'm using this to get the width of a letter A:

\settowidth{\letterwidth}{A}

This seems to work fine for all my letters, except for the letter Q, where the tail overshoots the box. I can see this with a framebox:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{EB Garamond}

\begin{document}

\setlength{\fboxsep}{0pt}\fbox{Q}

\end{document}

Running this through Overleaf produces a Q whose tail slightly overflows the box:

enter image description here

(Note that this example isn't super pronounced, because I was trying to use a built-in font that replicates the issue, but it's far more pronounced with the particular custom font I'm using).

How do I reliably draw a box around the whole character, including overshoot?

Alec
  • 367
  • 1
  • 7
  • This isn't a "problem", it is a "feature". It occurs on the vertical extent of the letters all the time. https://tex.stackexchange.com/questions/275374/what-is-the-local-height-of-a-capital-letter/275381#275381. It even has a name: "overshoot": https://ilovetypography.com/2009/01/14/inconspicuous-vertical-metrics/. It has to do with human perception, and yes, it does pose a challenge for finding a box that surrounds the printed glyph. – Steven B. Segletes Feb 25 '21 at 10:25
  • I never thought it was a "problem" per se; I just want to know how to get the "true" width of the rendered glyph – Alec Feb 25 '21 at 10:28
  • 1
    I was being a bit facetious in my reply, which is why I "air-quoted" the words. Sorry. – Steven B. Segletes Feb 25 '21 at 10:29
  • Are you using XeLaTeX? – egreg Feb 25 '21 at 10:41
  • @egreg LuaLaTeX – Alec Feb 25 '21 at 10:55

0 Answers0