Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

text-width

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-width - npm Package Compare versions

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;

9

package.json
{
"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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc