Posted a thread on the community forums for this. Most of the details can be found there :)
http://community.monogame.net/t/spritefont-rendering-cant-seem-to-disable-smoothing/11225?u=trinith
The short of it is, with SamplerState set to PointClamp, fonts still render smoothed and not pixelated. Same deal with setting the SamplerState on the graphics device. I believe the problem might be with whatever turns the SpriteFont file into a texture, because I saved the resulting texture to a file and the smoothing is present there... because of this, it would stand to reason that SamplerState wouldn't matter.
Another community member, Kimimaru, was able to confirm the behaviour that I was seeing. We're wondering if this is a bug.
The issue is likely that the SpriteFont content processor is smoothing the font when rasterizing it generating a smoothed font.
There was never any option for controlling this in XNA. Do you know if it generated non-smoothed fonts with the same .spritefont?
It could be that FreeType is always smoothing and not obeying some hint in the TTF.
Do you know if it generated non-smoothed fonts with the same .spritefont?
I feel like I was able to do pixelated font rendering in XNA, but it was so long ago that I really can't be sure. I'm also not sure how to get XNA working anymore... one of the many, many reasons II'm using MonoGame these days :)
If anybody has a working XNA installation, the test project is relatively straightforward to create.
I looked into this a little since I was having this issue with a font. Though I didn't manage to disable smoothing due to an issue with the font itself, I was able to significantly adjust the output by modifying the LoadFlags, LoadTarget, and RenderMode when loading the glyph.
In short, many more settings to adjust fonts are all there and they just needs to be exposed in the pipeline.
Being able to control both smoothing and hinting would be great.
There was never any option for controlling this in XNA.
This maybe true but there was also no pipeline tool in xna.
If the default remains as it is and a option is added either in the tool or in the framework then there is no change to current behavior. Unless the change is explicitly (or intentionally) specified by the user and this is then just additional functionality.
I feel like I was able to do pixelated font rendering in XNA.
Well you can turn on point in the sampler but that doesn't help with anti-aliasing or stretching when the font is rendered to texture on importing. Having the font rasterized without aliasing is just a bit of help it may not entirely solve some artifacts but it would help with the really bad ones.
If anyone needs screenshots from "vintage" XNA, I happen to have it installed, at least for the next week or two when I have to register my copy of Visual C# Express 2010, which I doubt is possible now.
A comparison with XNA's output would be most welcome!
Well, if you can point me to a spritefont file and some C# code to run, I can paste a screenshot. (Note that I don't have MonoGame installed.) I can say that I'm definitely getting font smoothing, but my code doesn't quite match what's in the forum thread. Alternatively, I could just attach the xnb files that get generated?
If you check the link at the very beginning, I posted some code in the thread on the MG forums. You can just make the sprite font via Visual Studio. Any standard font (ie, Consolas) will do. If you need one though, let me know and I can paste the XML :)
That code didn't compile on vintage XNA because that overload of SpriteBatch.Begin() didn't exist. Once we fix that minor issue...
