easwee.net // tiny digital playground


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