I use this code to place an image next to a character while matching its size:


        \PackageWarning{Eu}{Empty character given}%

    \dots \ScaleImage{!}!

    \dots) \ScaleImage{)}

    an \ScaleImage{a} anonymous \dots

    \dots fooling around, \ScaleImage{,}


This is how this looks:

enter image description here

It works pretty well, but note, for example, the example with the exclamation mark, which exceeds the size of the red box. Am I missing something, or is there some discrepancy between how a character is measured and how it is printed?