Skip to content

Commit

Permalink
Updated to BWIPP 2016-12-16 and a couple of bug fixes (#53, #55)
Browse files Browse the repository at this point in the history
  • Loading branch information
metafloor committed Dec 21, 2016
1 parent 575f410 commit a333ec0
Show file tree
Hide file tree
Showing 9 changed files with 22,101 additions and 22,058 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ See the [Version 1.0 Release Announcement](https://github.com/metafloor/bwip-js/
## Status

* Current bwip-js version is 1.1.1 (2016-09-19)
* Current BWIPP version is 2016-08-29
* Current bwip-js version is 1.2.0 (2016-12-20)
* Current BWIPP version is 2016-12-16
* Node.js compatibility >= v0.10

## Links
Expand Down
Binary file modified barcode.ps
Binary file not shown.
16 changes: 16 additions & 0 deletions bwipjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,22 @@ BWIPJS.prototype.stroke = function() {
}
this.g_path = [];
}

// Fix sources of rounding error by making the scale-factors integral.
// Currently, only floor is being used.
BWIPJS.prototype.floorscale = function() {
this.g_tsx = Math.floor(this.g_tsx) || 1;
this.g_tsy = Math.floor(this.g_tsy) || 1;
}
BWIPJS.prototype.ceilscale = function() {
this.g_tsx = Math.ceil(this.g_tsx) || 1;
this.g_tsy = Math.ceil(this.g_tsy) || 1;
}
BWIPJS.prototype.roundscale = function() {
this.g_tsx = Math.round(this.g_tsx) || 1;
this.g_tsy = Math.round(this.g_tsy) || 1;
}

BWIPJS.prototype.setextent = function() {
if (!this.g_path.length) // Nothing to do?
return;
Expand Down
6 changes: 3 additions & 3 deletions bwipp-min.js

Large diffs are not rendered by default.

44,097 changes: 22,055 additions & 22,042 deletions bwipp.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions demo.html
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@
// Add the alternate text
if (altx) {
opts.alttext = altx;
opts.includetext = true;
}
// We use mm rather than inches for height - except pharmacode2 height
// which is expected to be in mm
if (+opts.height && elt.sym != 'pharmacode2') {
opts.height = opts.height / 25.4 || 0.5;
}
// Likewise, width.
if (+opts.width) {
opts.width = opts.width / 25.4 || 0;
}
// BWIPP does not extend the background color into the
// human readable text. Fix that in the bitmap interface.
Expand Down Expand Up @@ -287,7 +297,7 @@
</head><body>
<div id="header">
<div id="bwipjs">bwip-js // Barcode Writer in Pure JavaScript</div>
<div id="version">bwip-js 1.1.1 (2016-09-19) / BWIPP 2016-08-29</div>
<div id="version">bwip-js 1.2.0 (2016-12-20) / BWIPP 2016-12-16</div>
<div id="fonthdr">&#x25bc; Fonts</div>
<div id="fontdiv" style="visibility:hidden">
<div class="inner">
Expand Down Expand Up @@ -316,7 +326,7 @@
<tr><th>Barcode Type:
<!-- Do not change the `select id="symbol"` - see develop/mkdesc -->
<td><select id="symbol" style="width:63.5ex">
<!-- Barcode Writer in Pure PostScript - Version 2016-06-03 -->
<!-- Barcode Writer in Pure PostScript - Version 2016-12-16 -->
<option value="auspost">AusPost 4 State Customer Code</option>
<option value="azteccode">Aztec Code</option>
<option value="aztecrune">Aztec Runes</option>
Expand Down
4 changes: 2 additions & 2 deletions lib/symdesc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// file: bwip-js/lib/symdesc.js
//
// This code was automatically generated from:
// Barcode Writer in Pure PostScript - Version 2016-06-03
// Barcode Writer in Pure PostScript - Version 2016-12-16
//
// Copyright (c) 2011-2016 Mark Warren
// Copyright (c) 2004-2014 Terry Burton
// Copyright (c) 2004-2016 Terry Burton
//
// Licensed MIT. See the LICENSE file in the bwip-js root directory
// for the extended copyright notice.
Expand Down
16 changes: 10 additions & 6 deletions node-bwipjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,14 @@ module.exports.toBuffer = function(args, callback) {
opts.includetext = true;
}
// We use mm rather than inches for height - except pharmacode2 height
// is explicitly in mm
if (opts.height && bcid != 'pharmacode2') {
// which is expected to be in mm
if (+opts.height && bcid != 'pharmacode2') {
opts.height = opts.height / 25.4 || 0.5;
}
// Likewise, width
if (+opts.width) {
opts.width = opts.width / 25.4 || 0;
}

// Override the `backgroundcolor` option.
if (opts.backgroundcolor) {
Expand Down Expand Up @@ -150,8 +154,8 @@ module.exports.unloadFont = function(fontname) {
freetype.unlink('/' + fontname);
}

module.exports.bwipjs_version = "1.1.1 (2016-09-19)";
module.exports.bwipp_version = "2016-08-29";
module.exports.bwipjs_version = "1.2.0 (2016-12-20)";
module.exports.bwipp_version = "2016-12-16";


// bwipjs Bitmap interface
Expand Down Expand Up @@ -184,8 +188,8 @@ function Bitmap(bgcolor) {

// Optional padding. Rotates with the image.
this.pad = function(width, height) {
_padx = width;
_pady = height;
_padx = width|0;
_pady = height|0;
}

this.limit = function(size) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bwip-js",
"version": "1.1.1",
"version": "1.2.0",
"description": "Barcode generator supporting over 90 types and standards.",
"main": "node-bwipjs",
"bin": {
Expand Down

0 comments on commit a333ec0

Please sign in to comment.