<p>I'm working on a project that generates PDFs that can contain fairly complex math and science formulas.  The text is rendered in Times New Roman, which has pretty good Unicode coverage, but not complete. We have a system in place to swap in a more Unicode complete font for code points that don't have a glyph in TNR (like most of the "stranger" math symbols,) but I can't seem to find a way to query the *.ttf file to see if a given glyph is present.  So far, I've just hard-coded a lookup table of which code points are present, but I'd much prefer an automatic solution.</p>

<p>I'm using VB.Net in a web system under ASP.net, but solutions in any programming language/environment would be appreciated.</p>

<p>Edit: The win32 solution looks excellent, but the specific case I'm trying to solve is in an ASP.Net web system.  Is there a way to do this without including the windows API DLLs into my web site?</p>

FreeType
is a library that can read TrueType font files (among others) and can be used to query the font for a specific glyph.  However, FreeType is designed for rendering, so using it might cause you to pull in more code than you need for this solution.
Unfortunately, there's not really a clear solution even within the world of OpenType / TrueType fonts; the character-to-glyph mapping has about a dozen different definitions depending on the type of font and what platform it was originally designed for.  You might try to look at the
cmap table definition
in Microsoft's copy of the
OpenType spec
, but it's not exactly easy reading.