title: Android: Find out which font file is appropriate for the characters I want to display
body: <p>I am maintaining an Android app that people use to display strings in various exotic languages like Tibetan or old Greek. Because Android devices come with very few fonts, users can put font files on the SD card, and the app will use them.</p>
  
  <p><b>QUESTION:</b> Given a string, how can I automatically decide which font file is the most appropriate, so that this string appears without characters being replaced with squares/boxes?</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>Each string is in one language.</li>
  <li>Strings are displayed in a WebView.</li>
  <li>Custom fonts work, the only problem is deciding which font file to use.</li>
  <li>Instead of a single font, it could provide a list of fonts that are acceptable for that string.</li>
  </ul>
  
  <p><i>
  Unnecessary context, for the curious: I am trying to develop this feature:
  <a href="http://code.google.com/p/ankidroid/issues/detail?id=779" rel="nofollow">http://code.google.com/p/ankidroid/issues/detail?id=779</a>
  </i></p>
  
  <hr>
  
  <p><b>UPDATE</b>: I ended up creating the <b><a href="https://github.com/nicolas-raoul/Antisquare" rel="nofollow">Antisquare</a></b> Open Source library based on Mostafa's idea.<br>
  It has a <code>getSuitableFonts</code> method which is blazingly fast.</p>