I always skipped this topic so I don’t have any experience and need advice here from the community
I am looking for advice on how to render fonts really sharp. And on the other hand also how to get a really pixelated look for fonts matching really old and pixelated games (the font should then look very crisp and pixelated too regardless the resolution).
So these are maybe two different goals:
a) Really sharp “HD” font
b) Pixelated old school games type of fonts
For some projects I think a) will fit better and of course in others b) that is why I want to get some advice for both extreme directions.
Talking about b)…
I tried to achieve this style by rendering to a small render target and then simply drawing the render target containing the fonts (and other game elements) to the back buffer which is larger using point sampling. I think it should work this way. What is mssing here in my case is how do I get pixelated fonts drawn into the render target inthe first place? What is controlling the looks of the font? Do I have to do nything inside the spritefont file(s) or is setting the sampler when calling SpriteBatch.Begin() enough?
SpriteFont is a big poopoo. I don’t recommend using it for anything other than debug. Make your own text renderer – simple ones aren’t hard at all.
Also no, you cannot manipulate SpriteFont settings, because there are none. Glyphs are rendered on a texture at compile time.
Look into signed distance field fonts
There are other options as well but that’s the one I like
MonoGame.Extended has some really good BitmapFont support. I used this on a prototype for a pixel based project when I discovered an issue with the SpriteFont content renderer that always gives anti-aliasing pixels on the result.
Set the samplerstate to point clamp before calling drawstring on the font.
While clamp isn’t necessary point sampling will give you crisp edges.
Scaling the text up with this sampler state will give you big blocky crisp letters.
Sorry, if this was in response to me, there is an issue there. You don’t get crisp edges with some fonts, there’s an issue with the font renderer. I posted a while back, you were even involved in the thread! Though to be fair, it was quite a while ago. Here’s a link to the github bug.
Don’t know if anyone made something using it for MonoGame yet.
Thanks for all the replies!
This one needs currently some changes to make it work with MonoGame 3.8.
I made this for myself, based on a proof of concept by someone else:
I will admit that it’s not perfect, but for my own purposes it’s good enough.
Adding it to a project is also a little cumbersome, but hopefully the example is enough to show how.
If you are willing to stick to SpriteFont with no third-party dependencies but more flexibility than what you’d get with XML (like switching antialiasing on/off, adding outline, shadow), I made a tool that generates a sprite sheet that is compatible with SpriteFont – mainly for myself, but dropping it here if anyone else would find it useful: