From 0ce568e7896cbda8444540f488796fed6462009e Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 15 Apr 2023 10:26:56 +0200 Subject: [PATCH 1/2] Remove `CFFCompiler.compileGlobalSubrIndex` since it's completely unused This method was originally added in PR 1320, eleven years ago, however it doesn't appear to ever have been used (not even from the start). Furthermore, this method also tries to access a property that doesn't exist (`this.out`) and then call a method that also doesn't exist (`writeByteArray`). --- src/core/cff_parser.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/core/cff_parser.js b/src/core/cff_parser.js index c1ce00c9c..d454c5bcd 100644 --- a/src/core/cff_parser.js +++ b/src/core/cff_parser.js @@ -1742,11 +1742,6 @@ class CFFCompiler { return this.compileIndex(stringIndex); } - compileGlobalSubrIndex() { - const globalSubrIndex = this.cff.globalSubrIndex; - this.out.writeByteArray(this.compileIndex(globalSubrIndex)); - } - compileCharStrings(charStrings) { const charStringsIndex = new CFFIndex(); for (let i = 0; i < charStrings.count; i++) { From c79bdd6ae6c16bca881b57bb66e965b942ddf7e4 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 15 Apr 2023 10:34:57 +0200 Subject: [PATCH 2/2] Simplify the `CFFCompiler.compileTypedArray` method Rather than manually creating the Array, we can use the now existing `Array.from` method instead. --- src/core/cff_parser.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/cff_parser.js b/src/core/cff_parser.js index d454c5bcd..2e31028f5 100644 --- a/src/core/cff_parser.js +++ b/src/core/cff_parser.js @@ -1845,11 +1845,7 @@ class CFFCompiler { } compileTypedArray(data) { - const out = []; - for (let i = 0, ii = data.length; i < ii; ++i) { - out[i] = data[i]; - } - return out; + return Array.from(data); } compileIndex(index, trackers = []) {