In TrueType-based fonts (.TTF files), you can try parsing the 'post' table. It's fairly easy to figure out. But, only format 2.0 explicitly stores glyph names. If the post table is format 3.0, there are no glyph names stored (there are a couple of other formats defined, but fonts using them are very, very rare). In that case, your only option is to back-track using Unicode values from the 'cmap'...there are some standard references for Unicode-to-glyph names that may be useful.
For CFF-based fonts (.OTF files), glyph names are stored inside of the 'CFF ' table. That's a bit trickier to parse, but if you're only looking for the glyph name references it shouldn't be too difficult to figure out.