[SOLVED] Uneven letters with bitmap font texture

I am using Bitmap Font Generator to create a font texture. When I display the font using spritebatch, every other letter appears different. I have tried many things, such as different fonts, truetype, cleartype, smoothing, etc, but nothing seems to help. See image

What is causing this and how can I fix it?

Other info:
fairly small font (size 18)
Using PointClamp

Thanks is advance

It’s because of the point sampling. You can avoid this by scaling the letter size by integer numbers or switching to another type of sampling.

E.g. If a 1.5 px thick line is drawn right in between two lines of pixels, the rasterizer might color a 2 pixel line instead. But if the next line is drawn on top of a pixel line, only that pixel line will be colored in. That’s the gist of it. It’s the same for pixel art games, you can usually only scale the resolution by integer values.

I have tried changing the SamplerState to Linear or even Anisotropic, but it does not change what is happening. I have also tried changing the graphics to PreferMultipointSamplic = true, but without success. Am I missing something?

I’m still looking for an answer here if anyone can help. I feel like there is a setting I can change somewhere, but I just cannot seems to find it. Thanks

Can you share your code for rendering text?

Sure. I am using Monogame.Extended to draw the text. There is no scaling of the text of the text that I can see. It is simply their methods for rendering the text:

public void DrawText(BitmapFont font, string text, Vector2 position, Color color, Rectangle? clippingRectangle = null)
_spriteBatch.DrawString(font, text, position, color, clippingRectangle);

Here is the render of the spritebatch:

_spriteBatch.Begin(SpriteSortMode.Immediate, null, SamplerState.PointClamp, DepthStencilState.None,
RasterizerState.CullNone, null, camera.GetViewTransformationMatrix());



What about the transformation matrix? Is there scaling because of the camera? Maybe try drawing without the camera and see if that helps, just to see if that’s where the issue is.

1 Like

You sir are a smart man; it indeed does have something to do with the camera. I was fitting the resolution to scale for different devices and when creating the view matrix it was scaling it. Thanks a bunch for your help.


Glad we figured it out :slight_smile: Good luck with the game!

1 Like