title: Font size discrepancy in .NET GDI+?
body: <p>I am wracking my brains in trying to understand the discrepancy between the font sizes users select or specify (for example, using a <strong>FontDialog</strong>) and the em-size reported by the <strong>Font</strong> class in .NET.</p>
  
  <p>For example:</p>
  
  <pre><code>using (FontDialog dlg = new FontDialog()) {
      if (dlg.ShowDialog() == DialogResult.OK) {
          Console.WriteLine("Selected font size: " + dlg.Font.SizeInPoints.ToString("0.##"));
      }
  }
  </code></pre>
  
  <p>Using the above code, you will get some confusing results:</p>
  
  <p>Selecting 11 in the dialog produces 11.25</p>
  
  <p>Selecting 12 in the dialog produces 12</p>
  
  <p>Selecting 14 in the dialog produces 14.25</p>
  
  <p>Selecting 16 in the dialog produces 15.75</p>
  
  <p>This behaviour occurs regardless of the font you choose. As you can see from above, there is no pattern in the discrepancy, it seems to vary randomly between +0.25 and -0.25.</p>
  
  <p>I get around this in user interfaces by only ever displaying the font size as a rounded whole number, but I swear that I have seen word processing/DTP packages that allow users to select fractional font sizes - and these packages do not show the above behaviour when interacting with Windows font dialog boxes.</p>
  
  <p>Can anyone provide a rational explanation for this? Is there a best practice technique for displaying the font size in a UI? How about when the user wants a fractional size such as '10.5'?</p>