Merge pull request #16292 from calixteman/improve_cff_compiling

Avoid when it's possible to use Array.concat when compiling a CFF font
This commit is contained in:
calixteman 2023-04-14 21:17:53 +02:00 committed by GitHub
commit a44173ea51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1383,7 +1383,13 @@ class CFFCompiler {
data: [], data: [],
length: 0, length: 0,
add(data) { add(data) {
this.data = this.data.concat(data); if (data.length <= 65536) {
// The number of arguments is limited, hence we just take 65536 as
// limit because it isn't too high or too low.
this.data.push(...data);
} else {
this.data = this.data.concat(data);
}
this.length = this.data.length; this.length = this.data.length;
}, },
}; };