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:
(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?
