title: Vertical alignment of canvas text
body: <p>I am working on a canvas based app, and I have some problems with the vertical alignment of my texts. I am using floating point coordinates, which I think are the cause of the problem. I am not sure though, and am nonetheless looking for a solution. Anyway, the code I use for displaying the letter 'O' in a square, for instance, is:</p>
  
  <pre><code>context.fillRect(0, 0, 21.864951768488744, 21.864951768488744);
  context.textBaseline = 'middle';
  context.textAlign = alignLeft ? 'left' : 'center';
  context.fillText('O', 10.932475884244372, 10.932475884244372);
  </code></pre>
  
  <p>The result on the canvas is that the 'O' is centered horizontally, but placed about 1 - 2 pixels above the center.</p>
  
  <p>Does anyone have any thoughts on this?</p>