I'm trying to render some text onscreen in Monogame by drawing a string to a Texture2D
This is the output I currently have
this is what i want it to look like
and here is a snippet of the code
Bitmap b = new Bitmap(width, height, PixelFormat.Format32bppArgb);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(b);
g.Clear(System.Drawing.Color.Transparent);
//Quality settings
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
Brush brush = new SolidBrush(Color.White);
g.DrawString(text, f, brush, 0, 0);
After reading some of the other posts about the same issue I tried clearing with the colour white, didn't change anything, then I tried adding a bunch of graphics settings like this post said to and that only gave me
Which has a bunch of unwanted black dots around it, which is arguably better then the first result but still not the crisp text I need, and clearing it with a single colour wont work because this text could potentially be on an image or something that moves
EDIT: i was able to get it slightly better with TextRenderingHint.SingleBitPerPixelGridFit
Still isnt what i want but at least closer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.