# In MonoGame, how can I disable font anti-aliasing?

I am building a game with a "low resolution" aesthetic, so I would like to disable the default font anti-aliasing. The text is drawn using the built-in SpriteFont and SpriteBatch classes.

Here is what it currently looks like:

Here is what I would like it to look like:

(Please ignore the particles)

• Did you try anything? Jun 19, 2015 at 23:18
• What does the font actually look like? Are you hoping for a way to make a regular font look like the one on the bottom? If you have the text on the bottom as a font and are drawing it without re-sizing it then it should look like the text on the bottom. Jun 20, 2015 at 0:08
• The font is Arial Narrow. The bottom image was done in Photoshop by setting the smoothing to "None". Jun 20, 2015 at 7:43
• @asafafas XNA fonts are simply images. Load the image file in photoshop, set the smoothing to none, then load it up in your content project.See web.archive.org/web/20140812180813/http://www.nubik.com/…. Jun 23, 2015 at 17:31
• Did you set the samplerstate to SamplerState.PointClamp in your SpriteBatch.Begin? Jul 7, 2015 at 13:58

## 1 Answer

To turn off antialiasing, all you have to do is change your sampler state to SamplerState.PointClamp in your spriteBatch.Begin() call. Here's a short code example:

spriteBatch.Begin(SpriteSortMode.Deferred,
BlendState.AlphaBlend,
SamplerState.PointClamp,
null, null, null, null));

// Draw text here using DrawString

spriteBatch.End();

spriteBatch.Begin()

// Draw textures, etc

spriteBatch.End()


Alternatively to this, you can permanently set the SamplerState of the graphics device to PointClamp in your Initialize() method with the following code (this should work in any method that is only called once, maybe even the constructor):

graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;

This way, you could use the normal spriteBatch.Begin() call with no parameters. Note that this method would apply SamplerState.PointClamp to everything that you draw, not just text

# References:

Here's the reference for XNA's SamplerState, which should be the same as MonoGame's: https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.samplerstate_fields%28v=xnagamestudio.40%29.aspx

Behind the scenes when actually drawing, SamplerState.PointClamp actually evaluates to:

Filter = TextureFilter.Point,

AddressU = TextureAddressMode.Clamp,
AddressV = TextureAddressMode.Clamp,
AddressW = TextureAddressMode.Clamp,


(according to the documentation)

# Notes:

Another possibility to disable antialiasing would be to change this graphics device setting:

Game1.GraphicsDevice.RenderState.MultiSampleAntiAlias = false;

• Filter = TextureFilter.Point is the key line here. By default, XNA uses a Linear filter, which will interpolate colors when pixels are not one to one. Point filter will, on the other hand, just scale the pixels and do no interpolation. Jul 7, 2015 at 18:09