Be aware of font aliasing issues in C#

When you use a Graphics object's DrawString method to draw text, you can set the object's TextRenderingHint property to tell it what method to use when drawing the text. Often the value AntiAliasGridFit produces a nice result efficiently. For small font sizes, however, the grid fitting techniques mess up the anti aliasing and produce a terrible result as shown in the picture above.

Also note in the picture that for very small fonts, in this example 6 point, ClearTypeGridFit seems to give the best result. Of course you probably shouldn't display text that small because it is hard to read in any case.

IMHO, with this font, at least, the best choices for TextRenderingHint are:

  • For fonts 14 point or greater, use AntiAliasGridFit.
  • For fonts between around 8 and 14 point, use AntiAlias.
  • For fonts smaller than 8 point, use ClearTypeGridFit.

These results may not hold for all fonts so you should experiment with the fonts you are using, but the point is that the same TextRenderingHint values don't produce the same quality result at all font sizes.

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.