So is that even a thing? I felt like it would make sense when I was testing my font using the famous Pablo Impallari's template:
The solution is pretty straightforward, but requires us to keep the list of all glyphs in the font within a class (here
This will increase the left sidebearing at the beginning of the glyph run and the right sidebearing at the end.
Is this approach at all practical or useful, have you ever implemented this or something similar? Is there an easy way to do this in any of the apps/tools you use? Now that I come to think of it, you could just write a script checking the sidebearings in all glyphs and applying appropriate kerning.
One way of thinking is that resolving such issues is responsibility of the layout engine or the typesetter. But obviously most people are not even aware this could be an issue:
Fixing a bug like above wouldn't be really obvious, I think at least some (if not most) design environments just take the advance width of the text as equivalent of the bounding box.
From my experiments, MS Word uses advance width to center text. So text with applied kerning of this kind would be centered more precisely, if that is what you'd want. (Besides, I often find myself centering text in InDesign manually because the unique shapes of sidebearings (even positive) make for an illusion of misalignment... but that's another pair of shoes).