Okay, so I have been trying left and right to figure this out, but I just can't figure it out.

I have been trying to produce a collection of Bitmap variables in my program of a series of characters. The problem is that during my tests, I save a file of the image, and find that I can't get the results I wanted. Let me show a photo, it will help me explain it more


What I am trying to produce is the far right number 8. That image was produced in photoshop where I created a .png of a size 8 Courier New number 8. Notice how it has the 8-bit look (blocky).

Now the one of the left and middle are ones I have tried to create programmically. Here's the code I have been using

Bitmap charImage = new Bitmap(20, 20);
Graphics g = Graphics.FromImage(charImage);

Font courierFont = new Font("Courier New", 20, FontStyle.Bold, GraphicsUnit.Pixel);
SolidBrush colorFont = new SolidBrush(Color.White);
Point drawLocation = new Point(0, 0);

g.DrawString(character, courierFont, colorFont, drawLocation, StringFormat.GenericDefault);

If I changed the Font's FontStyle to Regular or Bold I get the two other results you see in the image. Note that in Bold form, the number is mirrored, but Regular gives me some wear extra pixels on the left side.

So my problem here is I am trying to produce the result you see on the far right in the picture (which I can't figure out as I thought Courier New would give this effect since it has no problem doing it in Photoshop ... but C# won't do it).

That all make sense? I hope so (I can not think super clear at the moment). Thanks for any help in advance

Edited by JOSheaIV

3 Years
Discussion Span
Last Post by ddanbe

Don't know if it matters much, but the right picture is 7x5 "pixels", but the left and middle picture are 13x10 "pixels.


I was messing around with sizes to see if it could fix it (as well as other settings). But the big thing for me is I was never able to produce that flat look. It's Courier New which I thought was suppose to look like that, and in Photoshop came out with no problem, but in C#, couldn't reproduce it.

Oh wait the sizing is the difference between "Bold" and not


Did you try g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit
and/or g.SmoothingMode = SmoothingMode.None ?


I tried the SmoothingMode to None to have no luck, and it's not looking like that TextRenderingHint is working either.

It seems like .NET is apply some default formatting setting I can't get rid of (I might have to build the characters manually)


Perhaps this could have something to do with your problem. You can find it in the Program.cs file of every forms app.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.