Skip to content

Commit

Permalink
Release v3.5.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lindell committed Sep 25, 2016
1 parent b4119e0 commit 87b619e
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ Download or get the CDN link to the script:

| Name | Supported barcodes | Size (gzip) | CDN / Download |
|------|--------------------|:-----------:|---------------:|
| *All* | *All the barcodes!* | *8.1 kB* | *[JsBarcode.all.min.js][1]* |
| *All* | *All the barcodes!* | *8.2 kB* | *[JsBarcode.all.min.js][1]* |
| CODE128 | CODE128 (auto and force mode) | 5.4 kB | [JsBarcode.code128.min.js][2] |
| CODE39 | CODE39 | 4.6 kB | [JsBarcode.code39.min.js][3] |
| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 5.2 kB | [JsBarcode.ean-upc.min.js][4] |
| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 5.3 kB | [JsBarcode.ean-upc.min.js][4] |
| ITF-14 | ITF-14 | 4.4 kB | [JsBarcode.itf-14.min.js][5] |
| ITF | ITF | 4.3 kB | [JsBarcode.itf.min.js][6] |
| MSI | MSI, MSI10, MSI11, MSI1010, MSI1110 | 4.6 kB | [JsBarcode.msi.min.js][7] |
Expand Down
32 changes: 30 additions & 2 deletions bin/barcodes/EAN_UPC/EAN13.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var EAN13 = function (_Barcode) {
_this.structure = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"];

// Make sure the font is not bigger than the space between the guard bars
if (options.fontSize > options.width * 10) {
if (!options.flat && options.fontSize > options.width * 10) {
_this.fontSize = options.width * 10;
} else {
_this.fontSize = options.fontSize;
Expand All @@ -57,6 +57,17 @@ var EAN13 = function (_Barcode) {
};

EAN13.prototype.encode = function encode() {
if (this.options.flat) {
return this.flatEncoding();
} else {
return this.guardedEncoding();
}
};

// The "standard" way of printing EAN13 barcodes with guard bars


EAN13.prototype.guardedEncoding = function guardedEncoding() {
var encoder = new _ean_encoder2.default();
var result = [];

Expand Down Expand Up @@ -118,10 +129,27 @@ var EAN13 = function (_Barcode) {
options: { fontSize: this.fontSize }
});
}

return result;
};

EAN13.prototype.flatEncoding = function flatEncoding() {
var encoder = new _ean_encoder2.default();
var result = "";

var structure = this.structure[this.data[0]];

result += "101";
result += encoder.encode(this.data.substr(1, 6), structure);
result += "01010";
result += encoder.encode(this.data.substr(7, 6), "RRRRRR");
result += "101";

return {
data: result,
text: this.text
};
};

return EAN13;
}(_Barcode3.default);

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.5.0-beta",
"version": "3.5.0-beta.2",
"homepage": "https://github.com/lindell/JsBarcode",
"authors": [
"Johan Lindell <johan@lindell.me>"
Expand Down
32 changes: 30 additions & 2 deletions dist/JsBarcode.all.js
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ var EAN13 = function (_Barcode) {
_this.structure = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"];

// Make sure the font is not bigger than the space between the guard bars
if (options.fontSize > options.width * 10) {
if (!options.flat && options.fontSize > options.width * 10) {
_this.fontSize = options.width * 10;
} else {
_this.fontSize = options.fontSize;
Expand All @@ -1429,6 +1429,17 @@ var EAN13 = function (_Barcode) {
};

EAN13.prototype.encode = function encode() {
if (this.options.flat) {
return this.flatEncoding();
} else {
return this.guardedEncoding();
}
};

// The "standard" way of printing EAN13 barcodes with guard bars


EAN13.prototype.guardedEncoding = function guardedEncoding() {
var encoder = new _ean_encoder2.default();
var result = [];

Expand Down Expand Up @@ -1490,10 +1501,27 @@ var EAN13 = function (_Barcode) {
options: { fontSize: this.fontSize }
});
}

return result;
};

EAN13.prototype.flatEncoding = function flatEncoding() {
var encoder = new _ean_encoder2.default();
var result = "";

var structure = this.structure[this.data[0]];

result += "101";
result += encoder.encode(this.data.substr(1, 6), structure);
result += "01010";
result += encoder.encode(this.data.substr(7, 6), "RRRRRR");
result += "101";

return {
data: result,
text: this.text
};
};

return EAN13;
}(_Barcode3.default);

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/barcodes/JsBarcode.ean-upc.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.5.0-beta",
"version": "3.5.0-beta.2",
"description": "JsBarcode is a customizable barcode generator with support for multiple barcode formats.",
"main": "./bin/JsBarcode.js",
"directories": {
Expand Down

0 comments on commit 87b619e

Please sign in to comment.