Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy System.Drawing + ClearType font have ugly black fragments?
    text
    copied!<p>I'm using following C# code to make a picture with a text in it</p> <pre><code> // Create font. Parameter is a global variable Font objFont = new Font(fontname, fontsize, fontstyle, System.Drawing.GraphicsUnit.Pixel); // Grab an existing image from picture box. (target is picturebox's name) Bitmap result; if (target.Image != null) { result = new Bitmap(target.Image); } else { result = new Bitmap(target.Width, target.Height); } Graphics objGraphics = Graphics.FromImage(result); // And draw to it. Select a mode with check box. objGraphics.SmoothingMode = SmoothingMode.HighQuality; if (!checkBox1.Checked) { objGraphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; } else { objGraphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; } Brush b = new LinearGradientBrush(new Rectangle(new Point(x, y), objGraphics.MeasureString(text, objFont).ToSize()),color1,color2,LinearGradientMode.Vertical); objGraphics.DrawString(text, objFont, b, x, y); objGraphics.Save(); //Set the result to picturebox target.Image = result; objGraphics.Dispose(); b.Dispose(); </code></pre> <p>prior to this code, target.BackColor has been set into a desired color like </p> <pre><code>target.BackColor = Color.Black; </code></pre> <p>This is the results :</p> <p><a href="http://image.free.in.th/z/ie/yqbsg.png" rel="nofollow noreferrer">http://image.free.in.th/z/ie/yqbsg.png</a></p> <p>I was wondering that why ClearType font looks so ugly on bright bg? (On bg like dark purple you won't notice black border but it's still there)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload