title: Aero: How to draw ClearType text on glass?
body: <p>Using GDI+ to draw text on glass:</p>
  
  <pre><code>graphics.DrawString(s, Length(s), font, MakePointF(x, y), brush);
  </code></pre>
  
  <p>You'll notice that the ClearType enabled text draws <strong>very</strong> poorly on glass:</p>
  
  <p><a href="https://i.stack.imgur.com/r0oKz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r0oKz.png" alt="alt text"></a></p>
  
  <p>But with glass disabled the text, of course, draw fine:</p>
  
  <p><a href="https://i.stack.imgur.com/urfkf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/urfkf.png" alt="alt text"></a></p>
  
  <p>By way of comparison here is <strong>Anti-alias font smoothing</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/ilQOy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ilQOy.png" alt="alt text"></a></p>
  
  <p>And here is <strong>no font smoothing</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/vcaoo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vcaoo.png" alt="alt text"></a></p>
  
  <p><strong>Note</strong>: No font smoothing looks better than it really does because StackOverflow resizes the images on your monitor.</p>
  
  <p>How do i draw ClearType text on glass?</p>
  
  <h2>Notes</h2>
  
  <ul>
  <li>Win32 native</li>
  <li>not .NET (<em>i.e.</em> native)</li>
  <li>not Winforms (<em>i.e.</em> native)</li>
  <li>GDI+ (<em>i.e.</em> native)</li>
  </ul>
  
  <hr>
  
  <p>What Mark is suggesting is that you cannot honor the user's preferences for text rendering (i.e. "<code>SystemDefault</code>". ClearType does not function on glass, and you cannot use it.</p>
  
  <p>In other words, if you're rendering on glass you must override the text rendering with:</p>
  
  <pre><code>graphics.SetTextRenderingHint(TextRenderingHintAntiAliasGridFit);
  </code></pre>
  
  <p>Otherwise you should leave the <code>TextRenderingHint</code> at it's default <code>TextRenderingHintSystemDefault</code>.</p>
  
  <h2>See also</h2>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4258295/aero-how-to-draw-solid-colors-on-glass">Aero: How to draw solid colors on glass?</a></li>
  <li><a href="https://stackoverflow.com/questions/1870139/windows-aero-what-color-to-paint-to-make-glass-appear">Windows Aero: What color to paint to make “glass” appear?</a></li>
  <li><a href="https://connect.microsoft.com/VisualStudio/feedback/details/502846/wpf-extending-glass-into-client-area-disables-cleartype-entirely?wa=wsignin1.0" rel="nofollow noreferrer">WPF: Extending glass into client area disables ClearType entirely</a></li>
  </ul>