Skip to content

Commit 0e964c2

Browse files
Merge pull request #20894 from Snuffleupagus/compileFontPathInfo-slice
Simplify compilation of font paths (PR 20346 follow-up)
2 parents 87c1231 + fa7ddbb commit 0e964c2

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

src/core/obj_bin_transform_core.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,15 @@ function compilePatternInfo(ir) {
389389
}
390390

391391
function compileFontPathInfo(path) {
392-
let data;
393-
let buffer;
394-
if (
395-
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
396-
FeatureTest.isFloat16ArraySupported
397-
) {
398-
buffer = new ArrayBuffer(path.length * 2);
399-
data = new Float16Array(buffer);
400-
} else {
401-
buffer = new ArrayBuffer(path.length * 4);
402-
data = new Float32Array(buffer);
392+
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
393+
assert(
394+
FeatureTest.isFloat16ArraySupported
395+
? path instanceof Float16Array
396+
: path instanceof Float32Array,
397+
"compileFontPathInfo: Unexpected path format."
398+
);
403399
}
404-
data.set(path);
405-
return buffer;
400+
return path.slice().buffer;
406401
}
407402

408403
export {

0 commit comments

Comments
 (0)