【文件属性】:
文件名称:calculate-size:计算字符串的像素大小(宽度高度)(集成缓存)
文件大小:55KB
文件格式:ZIP
更新时间:2021-05-16 22:50:55
TypeScript
计算大小
计算字符串的像素大小(宽度/高度)(集成缓存)
安装
此包支持开箱即用的Typescript
$ npm install calculate-size
用法
const size = calculateSize ( 'Hello world!' , {
font : 'Arial' ,
fontSize : '12px'
} )
### Options
* `font: string`
* `fontSize: string`
* `fontWeight: string`
* `lineHeight: string`
* `width: string` ( Constraint width by a fixed value to calc height )
console . log ( size . width ) // 140
console . log (
【文件预览】:
calculate-size-master
----.gitignore(52B)
----tsconfig.json(328B)
----README.md(786B)
----test()
--------resources()
--------index.js(2KB)
----LICENSE(1KB)
----package.json(913B)
----src()
--------index.ts(2KB)
----.travis.yml(203B)
----.editorconfig(148B)
----yarn.lock(114KB)