🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

string-pixel-width

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-pixel-width - npm Package Compare versions

Comparing version

to
1.10.0

@@ -26,3 +26,4 @@ 'use strict';

var variant = 0 + (sett.bold ? 1 : 0) + (sett.italic ? 2 : 0);
var available = Object.keys(_widthsMap2.default);
var map = sett.map || _widthsMap2.default;
var available = Object.keys(map);
if (available.indexOf(font) === -1) {

@@ -38,3 +39,3 @@ throw new Error('This font is not supported. Supported fonts are: ' + available.join(', '));

// use width of 'x' as fallback for unregistered char
var widths = _widthsMap2.default[font][char] || _widthsMap2.default[font].x;
var widths = map[font][char] || map[font].x;
var width = widths[variant];

@@ -41,0 +42,0 @@ totalWidth += width;

{
"name": "string-pixel-width",
"version": "1.9.0",
"version": "1.10.0",
"description": "String pixel width measurement on the backend in Javascript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -29,2 +29,3 @@ [string-pixel-width](https://github.com/adambisek/string-pixel-width)

- Georgia
- Helvetica
- Impact

@@ -31,0 +32,0 @@ - Times New Roman