Skip to content

hustcc/bmt

Repository files navigation

bmt

in Browser, Measure Text width.

npm Version Build Status Coverage Status npm License

Install

$ npm i --save bmt

Usage

import { measureTextByDOM, measureTextByCanvas } from 'bmt';

const font = {
  fontFamily: 'sans-serif',
  fontSize: 16,
};

measureTextByDOM('hello world', font); // = 80
measureTextByCanvas('hello world', font); // ~= 80

Perf

perf

Run on your computer.

$ npm run perf

License

MIT@hustcc.

Releases

No releases published

Packages

No packages published