c# - CharacterToGlyphMap contains wrong code points of Unicode for some fonts
<p>I use CharacterToGlyphMap from GlyphTypeface</p>

<p><a href="http://msdn.microsoft.com/en-us/library/ms635034.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms635034.aspx</a></p>

<p>to get all characters include in any fonts. If I use e.g. <em>Arial</em> everything is right, but for some fonts I get wrong code points. </p>

<p>For example for <em>Ebrima</em> I get some code points beyond of the scope of Unicode. The last character in Ebrima font is hex: FD3F (dec: 64831), but CharacterToGlyphMap contains a few additional values, e.g. (dec: 66688, 66689, 66690...). What could be the reason of wrong code points for above example?</p>

<p><strong>Edit:</strong></p>

<p>I implement my own character map and for some fonts my application crash, because I use</p>

<pre><code>Convert.ToChar(unicodeCodePoint)
</code></pre>

<p>The solution for this problem is to limit the use of characters (thanks for @AakashM) e.g.</p>

<pre><code>foreach (KeyValuePair&lt;int, ushort&gt; item in glyphTypeface.CharacterToGlyphMap)
{
   if (item.Key &gt;= Char.MinValue &amp;&amp; item.Key &lt;= Char.MaxValue)
   {
      limitedCharacterMap.Add(item.Key, item.Value);
   }
}
</code></pre>
