precise-text-size
script that returns precise text width and height - from first non-transparent pixel to the last-one, ignoring any kerning space before/after word, which is usually accounted into a getTextWidth() calculation.
works with custom fonts too. measurement is done by traversing pixels of word raster drawn on inmemory canvas.
grab from github: https://github.com/easwee/precise-text-size