Different font size on different computers? ( SpriteFont.Measurestring() )

Hi

I’m working on a project on MonoGame 3.6. (Powercity 9000)

I used to work on a computer running Microsoft Visual Studio 2015, but I recently made a new computer and installed Visual Studio 2017.
I imported my MonoGame project, and the first thing I saw when I started the project, was that my font wasn’t correctly displayed. I looked into the code and I noticed that my font size was different. (I use SpriteFont.Measurestring())

Difference

old computer, Visual Studio 2015: size of 32

.

new computer, Visual Studio 2017: size of 44

I can easily modify the code, but I’m curious why the font size is different on these computers.
One “pixel” (it’s a pixelfont) of the font is a value of 4 on each computer. This is why the code doesn’t work on the new computer. The new computer takes a value of 44 and divides it by 8. You get a value of 5.5 instead of 4.

You can see an example of the font below.

UPDATE
GitHub issue: https://github.com/MonoGame/MonoGame/issues/5802

Sounds like a bug. Can you open an issue on GitHub and provide some more information about your computers. Specifically, I think GPU and resolution might have an effect on MeasureString results. VS version doesn’t matter.

Seems like a big deal, so it’s weird no one ran into this earlier. Maybe it’s a driver issue or something? :confused:

Thanks for the fast reply Jjagg!
I will do that as soon as possible. Maybe I can check on my third computer too.

I think I found the problem. I’m going to open a GitHub issue tomorrow with further details.

This is what I found:

computer 1:

CPU: intel core i7-7700K, 4.20GHz
Memory: Gskill trident Z DDR4 4x8GB
Motherboard: Asus maximus ix formula
GPU: ZOTAC GTX 1080ti amp extreme
resolution: 1920 x 1080
used font size Y: 44
used font size X: 8

computer 2:

CPU: intel core i7-4790S, 3.20GHz
Memory: Samsung DDR3 8GB
Motherboard: Hewlett-Packard 2AF7
GPU: AMD R7 240
resolution: 1920 x 1080
used font size Y: 32
used font size X: 8

computer 3:

CPU: intel core i7-4770
Memory: Nanya DDR3 2x8GB
Motherboard: Medion MS-7848
GPU: Nvidia GTX 760
resolution: 1920 x 1080
used font size Y: 44
used font size X: 8

Nvidia and AMD cards use a different font height. Computer 1 & 3 have Nvidia GPU’s and they have the same font size. The computer with the AMD card does not.

1 Like

GitHub issue: https://github.com/MonoGame/MonoGame/issues/5802

1 Like

Would this not relate to Windows Scaling?

Did you go from Windows 7 to Windows 8/10?

It was solved in the linked GitHub issue. It was different XNB files.

1 Like