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

https://github.com/pana/textwidth

Calculator of text width.
https://github.com/pana/textwidth

Last synced: 7 months ago
JSON representation

Calculator of text width.

Awesome Lists containing this project

README

          

TextWidth
=========
Calculate text width use canvas measureText() method.

## Install
npm install textwidth

## Example

```
var tw = require('textwidth');
// 使用默认字体及大小
var width = tw("Hello textwidth!!!")
// 设置字体,大小
var width = tw("Set the text font", "10px Arial")
```

## Doc

## Test

## Todo

* 添加测试用例
* 完善文档
* 发布到npm

## Bug

* 中文字体宽度偏差

## Roadmap

* 计算高度
* 根据不同的单位(pixel, pm)计算宽度
* 允许设置字间距

## 其他实现方式

## License
MIT