Merge pull request #20894 from Snuffleupagus/compileFontPathInfo-slice

Simplify compilation of font paths (PR 20346 follow-up)
This commit is contained in:
Tim van der Meij 2026-03-16 20:32:05 +01:00 committed by GitHub
commit 0e964c248a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -389,20 +389,15 @@ function compilePatternInfo(ir) {
}
function compileFontPathInfo(path) {
let data;
let buffer;
if (
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
FeatureTest.isFloat16ArraySupported
) {
buffer = new ArrayBuffer(path.length * 2);
data = new Float16Array(buffer);
} else {
buffer = new ArrayBuffer(path.length * 4);
data = new Float32Array(buffer);
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
assert(
FeatureTest.isFloat16ArraySupported
? path instanceof Float16Array
: path instanceof Float32Array,
"compileFontPathInfo: Unexpected path format."
);
}
data.set(path);
return buffer;
return path.slice().buffer;
}
export {