Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/afeiship/next-canvas-measure-text

A wrapper for measureText.
https://github.com/afeiship/next-canvas-measure-text

canvas measure next text

Last synced: 21 days ago
JSON representation

A wrapper for measureText.

Awesome Lists containing this project

README

        

# next-canvas-measure-text
> A wrapper for measureText.

## installation
```bash
npm install -S afeiship/next-canvas-measure-text --registry=https://registry.npm.taobao.org
```

## usage
```js
import 'next-canvas-measure-text';
import { createCanvas } from 'canvas';

const canvas = createCanvas(1000, 1000);
const ctx = canvas.getContext('2d');

nx.canvasMeasureText({
context: ctx,
callback: function(ctx){ ctx.font = '12px PingFang SC' },
text:'Just a tse'
});
```