title: Is it possible to get accurate character/font metrics in AS3?
body: <p>I have created a class which will use an embedded font to dynamically generate a bitmap font at run-time.
  So far it works well except that I have a minor issue with character spacing.</p>
  
  <p>In the image below the first line is an actual <code>TextField</code> and the second has been rendered
  using the generated bitmap font.</p>
  
  <p><img src="https://i.stack.imgur.com/N4s3j.png" alt="Character spacing problem example"></p>
  
  <p>If you look at the word 'fox' or the 'ed' of the word 'jumped' you can see that the letter spacing looks a little bit odd. </p>
  
  <p>Are there any alternatives to the <code>TextLineMetrics</code> class which will give me more accurate character metrics?</p>
  
  <p><strong>UPDATE :</strong></p>
  
  <p>Text rendering quality using the new Flash Text Engine :</p>
  
  <p><img src="https://i.stack.imgur.com/kEiqu.png" alt="Text rendering quality using the new Flash Text Engine"></p>
  
  <p><strong>UPDATE 2 :</strong></p>
  
  <p>By chance I have eventually found the solution :</p>
  
  <p>The first problem was the <code>antiAliasType</code> property which was set to <code>AntiAliasType.ADVANCED</code>.<br>
  Although it produces higher quality text it also causes <code>TextLineMetrics</code> to return incorrect widths for characters.</p>
  
  <p>The second was that it had to also be rounded up (using <code>Math.ceil</code>) to the nearest pixel and not down.</p>