in Browser, Measure Text width.
$ npm i --save bmt
import { measureTextByDOM, measureTextByCanvas } from 'bmt';
const font = {
fontFamily: 'sans-serif',
fontSize: 16,
};
measureTextByDOM('hello world', font); // = 80
measureTextByCanvas('hello world', font); // ~= 80
Run on your computer.
$ npm run perf
MIT@hustcc.