title: Checking if certain characters are supported by a font
body: <p>I found this on StackOverflow: <a href="https://stackoverflow.com/questions/103725/is-there-a-way-to-programatically-determine-if-a-font-file-has-a-specific-unicode">Is there a way to programmatically determine if a font file has a specific Unicode Glyph?</a></p>
  
  <p>However, I need to also check UTF-32 characters. What I am trying to do is parse the Unihan data over at unicode.org and ignore all characters that are not supported by "Arial Unicode MS". I started work on the CheckIfCharInFont() method by modifying the arg to take a string (for utf-32) and checking if it is a surrogare pair. I then get the Int32 by doing a char.ConvertToUtf32(surrogate1, surrogate2), but the problem is the current CheckIfCharInFont() method only supports Uint16... you can see where I placed a "Debugger.Break" that this is a bit of a problem. Any experts out there that can help me figure this thing out?</p>
  
  <p>Thanks</p>
  
  <pre><code>public static bool CheckIfCharInFont(string character, Font font)
          {
              UInt16 value = 0;
              int temp = 0;
              if (character.Length &gt; 1) //UTF-32
              {
                  temp = char.ConvertToUtf32(character[0], character[1]);
              }
              else
              {
                  temp = (int)character[0];
              }
  
              if (temp &gt; UInt16.MaxValue)
              {
                  Debugger.Break();
                  return false;
              }
              value = (UInt16)temp;
  
              //UInt16 value = Convert.ToUInt16(character);
              List&lt;FontRange&gt; ranges = GetUnicodeRangesForFont(font);
              bool isCharacterPresent = false;
              foreach (FontRange range in ranges)
              {
                  if (value &gt;= range.Low &amp;&amp; value &lt;= range.High)
                  {
                      isCharacterPresent = true;
                      break;
                  }
              }
              return isCharacterPresent;
          }
  </code></pre>