Incorrect horizontal SpriteFont layout due to glyph cropping
Horizontal layout of SpriteFont characters is incorrect. This problem was first mentioned in #5098 and a fix was applied in https://github.com/MonoGame/MonoGame/pull/7501 causing a regression problem for other fonts. Unfortunately this fix only worked for the font mentioned in the bug. It breaks horizontal layout for fonts like Segoe UI and Consolas.
The following screenshots shows the fonts Segoe UI, Kingthings Petrock and Consolas, all at size 24. The first line of text is rendered using the Monogame 3.8.1. The second line is drawn with correct horizontal layout (see PR).

What version of MonoGame does the bug occur on:
- MonoGame 3.8.1
What operating system are you using:
- Windows
What MonoGame platform are you using:
- DesktopGL
We also have the same issue with Arial font:

On top it's how it's being rendered by 3.8.1
Below is how it was originally rendered by 3.8.0
3.8.1 has definitely broken non monospace fonts.
Here is a thread going over this issue that may provide more details: https://community.monogame.net/t/incorrect-kerning-when-drawing-text/18213/22
Any contribution to fix the font rendering would be more than welcome. This looks like a good first issue, providing some background on font rendering.
I went down a rabbit hole and finally found this issue and the forum post from 2022.
This makes fonts almost useless.
Most obvious (Arial font size 11/12) with V and Y and apostrophe
To those that reported issues with sprites, would you be so kind to check if your specific cases are resolved in https://github.com/MonoGame/MonoGame/pull/8837 if you do not know how to build the mgcb from source. Could you kindly report your font settings, string to be rendered, and current issues with it. So that I can try it out for you instead.
I do not have time for that. I submitted a PR fixing this ages ago which did not go through. See the linked PR above.
@MutsiMutsi I don't know how to test against a specific branch, if you provide exact steps to link to source, I'll try it. Did you look at the fix that @wldevries is talking about though?
I do not have time for that. I submitted a PR fixing this ages ago which did not go through. See the linked PR above.
I'm sorry to hear that you're so busy, thanks for at least finding the time to reply this query! With regards to why your PR was never merged, I assume it's because it introduced regression bugs and it removed cropping.
But it would be nice if it at least could've been closed. If the ball goes rolling again on this I'll ask for an update on your PR.
In our case the issue happened with plain Arial font.
I think what's due is to create unit tests that render a bunch of fonts and check against a pre-recorded, human verified renders
@vpenades arial is the first one I tested with and confirmed to be fixed, after that I made sure I didnt reintroduce the issue that nkast fixed for Kingthings Petrock which was also addressed in a subsequent commit.
@kaltinril so your test case of arial at 11pt and 12pt has been looked at, if you still want to test the branch is https://github.com/MutsiMutsi/MonoGame/tree/refs/heads/feature/fix_mgcb_spritefont_kernings the way to test is to build the content builder repo, and then the mgcb pipeline editor tool to build the spritefont with, then the built font xnb you can try out in any recent monogame framework to confirm whether it fixed the kerning.