Skip to content

Commit

Permalink
📦 Release v3.11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lindell committed Apr 25, 2021
1 parent b86e391 commit cd87268
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 22 deletions.
10 changes: 8 additions & 2 deletions bin/renderers/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,14 @@ function messureText(string, options, context) {
ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font;

// Calculate the width of the encoding
var size = ctx.measureText(string).width;

var measureTextResult = ctx.measureText(string);
if (!measureTextResult) {
// Some implementations don't implement measureText and return undefined.
// If the text cannot be measured we will return 0.
// This will make some barcode with big text render incorrectly
return 0;
}
var size = measureTextResult.width;
return size;
}

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "JsBarcode",
"main": "dist/JsBarcode.all.min.js",
"version": "3.11.3",
"version": "3.11.4",
"homepage": "https://github.com/lindell/JsBarcode",
"authors": [
"Johan Lindell <[email protected]>"
Expand Down
10 changes: 8 additions & 2 deletions dist/JsBarcode.all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3285,8 +3285,14 @@ function messureText(string, options, context) {
ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font;

// Calculate the width of the encoding
var size = ctx.measureText(string).width;

var measureTextResult = ctx.measureText(string);
if (!measureTextResult) {
// Some implementations don't implement measureText and return undefined.
// If the text cannot be measured we will return 0.
// This will make some barcode with big text render incorrectly
return 0;
}
var size = measureTextResult.width;
return size;
}

Expand Down
4 changes: 2 additions & 2 deletions dist/JsBarcode.all.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.codabar.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.code128.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.code39.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.ean-upc.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.itf.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.msi.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/barcodes/JsBarcode.pharmacode.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsbarcode",
"version": "3.11.3",
"version": "3.11.4",
"description": "JsBarcode is a customizable barcode generator with support for multiple barcode formats.",
"main": "./bin/JsBarcode.js",
"directories": {
Expand Down

0 comments on commit cd87268

Please sign in to comment.