Bluring / Antialias for a font.

Hi folks.

After a bit of a struggle to get fonts through the pipeline and into the correct location, I’m wondering if it’s possible to give a DrawString a blur effect, or at least some antialiasing so the fonts don’t look so ‘sharp’ on the screen?


Well, you can blur everything you want. Question is, why you should need to postprocess fonts? Don’t get me wrong, I am in need of better font antialiasing as well. Thing is what we both kinda need is to change how sprite font (which creates spritesheet for characters) samples original font. Thus it is not about postprocessing but preprocessing (what happens before font is rendered). Currently monogames does it right since they are mirroring XNA behavior, I know there were some alternatives for XNA and I am not sure if they would work in mono. In any case I think this is perfect suggestion for: MonoGame Feature Wishlist “Extended sampling options when creating spritefonts, something similar to photoshop’s “Smooth, crips, strong, none” font sampling settings would be awesome”.

Edit: I am going to post this suggestion since I`ve realized I have one more.

Agreed. I vote for that too.

We use FreeType to rasterize the glyphs, and it does provide some good anti-aliasing (often better than GDI which is what XNA used). Some TrueType fonts can provide bitmap glyphs for smaller point sizes to provide a clearer rasterization, and in the cases where those bitmap glyphs are available FreeType will use those in preference to rasterizing the vector shapes itself.

1 Like

Thanks for the info Konaju.

I’ve been creating my own fonts with a designer, but only vector based, not bitmap. How does FreeType fit into the work flow? Do you re-render a complete font at run time or is this work done before the pipeline?

The content pipeline takes the spritefont XML file and the TTF and rasterizes the glyphs to a texture according to the various properties in the spritefont file. This is all bundled into a single XNB file that is loaded by the game.

I understand how to get a font into the project, I mean where does FreeType come into the work flow?

And going back to the first answer from Ravendarke, how would I go about bluring a sprite?

FreeType is used by the content pipeline to rasterize a glyph from the TTF to a bitmap. These bitmaps are then gathered together into the texture.

Ah ok. So, is it possible to influence the way FreeType brings in the font?