I've found a Perl-based TTF font subsetter here:
https://bitbucket.org/philip/font-optimizer/overview (MIT license)
there seems to be some C++ source here:
http://podofo.sourceforge.net/doc/ht...TTFSubset.html (LGPL)
Another Perl one here:
http://search.cpan.org/~mhosken/Font-TTF-Scripts/ (Perl Artistic license 2.0)
A php one here:
http://www.4real.gr/technical-documents-ttf-subset.html
Aha! A python one under active development as part of a PDF generation project:
http://code.google.com/p/pyfpdf/ (LGPL)
I do not know if any of the projects also work on otf fonts.
matplotlib is another python project that seems to include font subsetting:
https://github.com/matplotlib/matplotlib (an attribution licence)