I am working on a project where I am using the “.Graphics.DrawString” to put text into a graphics object but when I display the text or output it as a jpg (with 100% quality) the text looks blurry and fuzzy. I have tried turning AntiAlias on and set the UseGDIPlus to true but I just cant get the text to look better. Any suggestions?
Draw it to a picture with 2x width and height, and 2x font size. Then scale that picture down and draw it instead of the “DrawString”.
What do you mean by draw it to a picture? How do you draw to a picture without using DrawString?
Let’s say your string fits in 200 x 32 pixels, text size 32. Code might look like…
[code]p = new picture(400, 64)
g = p.graphics
g.TextSize = 64
g.DrawString(s, 0, g.TextAscent)
// scale p down to 200, 32 – SSG Graphics, MBS, or a DrawPicture call – make sure you’re using an interpolation mode
// draw scaled p where you were going to draw the string.
[/code]
Anyway, this is how anti-aliasing works. Draw it chunky big, scale it down with interpolative scaling to get the grey pixels around the edges.
Thanks Brad, will give that a try although it does seem mad that you have to do this just to get non fuzzy text !!!
[quote=95297:@Nathan Wright]Thanks Brad, will give that a try although it does seem mad that you have to do this just to get non fuzzy text !!!
[/quote]
On the Mac, you get anti-aliased text by default. If Graphics did it by default on all platforms, someone surely have a problem with string drawing being too slow. The solution here would be for someone to write a nice module of Graphics extensions.