Original code from: http://people.mozilla.com/~jkew/woff/