TransWikia.com

How to measure the width of a character including overshoot

TeX - LaTeX Asked on April 4, 2021

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?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP