Skip to content
This repository was archived by the owner on Apr 22, 2021. It is now read-only.

Commit 83b34fe

Browse files
Reg011David Michaud
andauthored
Replaced all new Buffer(...) by Buffer.alloc(...) and Buffer.from(...) (#6)
Co-authored-by: David Michaud <david.michaud@probewell.com>
1 parent b185c55 commit 83b34fe

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/WOFF2Font.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class WOFF2Font extends TTFFont {
3737
throw new Error('Error decoding compressed data in WOFF2')
3838
}
3939

40-
this.stream = new r.DecodeStream(new Buffer(decompressed))
40+
this.stream = new r.DecodeStream(Buffer.from(decompressed))
4141
this._decompressed = true
4242
}
4343
}

src/WOFFFont.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class WOFFFont extends TTFFont {
2020

2121
if (table.compLength < table.length) {
2222
this.stream.pos += 2; // skip deflate header
23-
let outBuffer = new Buffer(table.length);
23+
let outBuffer = Buffer.alloc(table.length);
2424
let buf = inflate(this.stream.readBuffer(table.compLength - 2), outBuffer);
2525
return new r.DecodeStream(buf);
2626
} else {

src/subset/CFFSubset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class CFFSubset extends Subset {
3939
this.cff.stream.pos = subr.offset;
4040
res.push(this.cff.stream.readBuffer(subr.length));
4141
} else {
42-
res.push(new Buffer([11])); // return
42+
res.push(Buffer.from([11])); // return
4343
}
4444
}
4545

src/subset/TTFSubset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class TTFSubset extends Subset {
2525

2626
// if it is a compound glyph, include its components
2727
if (glyf && glyf.numberOfContours < 0) {
28-
buffer = new Buffer(buffer);
28+
buffer = Buffer.from(buffer);
2929
for (let component of glyf.components) {
3030
gid = this.includeGlyph(component.glyphID);
3131
buffer.writeUInt16BE(gid, component.pos);

0 commit comments

Comments
 (0)