bwip-js
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -32,4 +32,2 @@ // file : bwip-js/server.js | ||
// require('fs').readFileSync(__dirname + '/fonts/Inconsolata.otf', 'binary')); | ||
bwipjs.loadFont('Verdana', 100, | ||
require('fs').readFileSync('c:/downloads/verdana.otf', 'binary')); | ||
@@ -36,0 +34,0 @@ const server = http.createServer(function(req, res) { |
{ | ||
"name": "bwip-js", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "JavaScript barcode generator supporting over 100 types and standards.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/bwip-js-node.js", |
@@ -16,18 +16,7 @@ # // Barcode Writer in Pure JavaScript | ||
> | ||
> The ES6 module is only available on the browser. Support for nodejs is planned. | ||
> | ||
> There is minor API breakage versus version 2. The exported version strings have changed | ||
> since there is no longer a `BWIPP` object - its contents were hoisted to module scope to | ||
> enable dead code elimination. | ||
> | ||
> | Old Version String | 3.0 Version String | | ||
> | :------------------------| :------------------------| | ||
> | `bwipjs.VERSION` | `bwipjs.BWIPJS_VERSION` | | ||
> | `bwipjs.BWIPP.VERSION` | `bwipjs.BWIPP_VERSION` | | ||
> | ||
> See the section [ES6 Browser Module Usage](#es6-browser-module-usage) for details of the new capabilities. | ||
> See the section [Browser ES6 Module Usage](#browser-es6-module-usage) and [Node.js ES6 Module Usage](#nodejs-es6-module-usage) for details of the new capabilities. | ||
## Status | ||
* Current bwip-js version is 3.0.1 (2021-06-16) | ||
* Current bwip-js version is 3.0.2 (2021-07-16) | ||
* Current BWIPP version is 2021-02-06 | ||
@@ -167,2 +156,3 @@ * Node.js compatibility: 0.12+ | ||
<a name="browser-usage"></a> | ||
## Browser Usage | ||
@@ -224,3 +214,4 @@ | ||
## ES6 Browser Module Usage | ||
<a name="browser-es6-module-usage"></a> | ||
## Browser ES6 Module Usage | ||
@@ -251,2 +242,3 @@ The ESM provides the same API as the standard browser module using: | ||
<a name="react-usage"></a> | ||
## React Usage | ||
@@ -298,2 +290,3 @@ | ||
<a name="nodejs-request-handler"></a> | ||
## Node.js Request Handler | ||
@@ -340,2 +333,3 @@ | ||
<a name="nodejs-image-generator"></a> | ||
## Node.js Image Generator | ||
@@ -387,2 +381,28 @@ | ||
<a name="nodejs-es6-module-usage"></a> | ||
## Node.js ES6 Module Usage | ||
The ESM provides the same API as `require('bwip-js')` using: | ||
```javascript | ||
import bwipjs from 'bwip-js'; | ||
// ... identical to the examples above ... | ||
``` | ||
The ESM also facilitates bundler tree shaking by providing the individual encoders as named exports. Each exported encoder functions identically to `bwipjs.toBuffer()`. | ||
The exported names are the same as the `bcid` names, with the caveat that dashes `-` are replaced with underscores `_`. For example, to import the `gs1-128` encoder, you would use: | ||
```javascript | ||
import { gs1_128 } from 'bwip-js'; | ||
try { | ||
let buf = await gs1_128(options); | ||
} catch (e) { | ||
// `e` may be a string or Error object | ||
} | ||
``` | ||
<a name="electron-example"></a> | ||
## Electron Example | ||
@@ -431,2 +451,3 @@ | ||
<a name="command-line-interface"></a> | ||
## Command Line Interface | ||
@@ -433,0 +454,0 @@ |
@@ -1168,6 +1168,8 @@ // bwip-js/stb_trutype.js | ||
if (b0 == 255) { | ||
f = stbtt__buf_get(b, 4) / 0x10000; | ||
// f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000; | ||
f = (stbtt__buf_get(b, 4)|0) / 0x10000; | ||
} else { | ||
stbtt__buf_skip(b, -1); | ||
f = stbtt__cff_int(b); | ||
// f = (float)(stbtt_int16)stbtt__cff_int(&b); | ||
f = ((stbtt__cff_int(b)<<16)|0)>>16; | ||
} | ||
@@ -1174,0 +1176,0 @@ if (sp >= 48) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
11231042
201575
606
7