A slightly modified copy of https://github.com/brendankenny/libtess.js