Comparing version 1.0.0 to 1.1.0
12
index.js
@@ -20,3 +20,6 @@ var util = require('util'); | ||
options = extend({ | ||
size: 10, | ||
style: 'normal', | ||
variant: 'normal', | ||
weight: 'normal', | ||
size: 'medium', | ||
family: 'sans-serif', | ||
@@ -30,3 +33,8 @@ align: 'start', | ||
context.font = util.format('%s %s', size, options.family); | ||
context.font = util.format('%s %s %s %s %s', | ||
options.style, | ||
options.variant, | ||
options.weight, | ||
size, | ||
options.family); | ||
context.textAlign = options.align; | ||
@@ -33,0 +41,0 @@ context.textBaseline = options.baseline; |
{ | ||
"name": "text-width", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Measure the text width in browsers", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test/*.js" | ||
"test": "browserify test/*.js | testling", | ||
"test-browser": "browserify test/*.js | testling -u" | ||
}, | ||
@@ -29,4 +30,6 @@ "repository": { | ||
"devDependencies": { | ||
"tape": "~3.0.3" | ||
"tape": "~3.0.3", | ||
"browserify": "~7.0.0", | ||
"testling": "~1.7.1" | ||
} | ||
} |
@@ -18,7 +18,5 @@ # text-width | ||
It accepts the following options. | ||
It supports following font options, `style`, `variant`, `weight`, `size` and `family`. Each corresponding to a similarly named [CSS property][font]. The size option can either be a number (size in pixels) or a string, e.g. `10pt`. | ||
- `family` The font family. | ||
- `size` The font size. Can either be a number (size in pixels) or a string, e.g. `10pt`. | ||
[mt]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text | ||
[font]: https://developer.mozilla.org/en-US/docs/Web/CSS/font |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2591
38
3
22