mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Reduce allocations in the FontInfo.prototype.#readString method (PR 20197 follow-up)
Looking at the very similar `CssFontInfo.prototype.#readString` and `SystemFontInfo.prototype.#readString` methods they decode using the data as-is, but the `FontInfo.prototype.#readString` method for some reason copies the data into a new `Uint8Array` first; fixes yet another bug/inefficiency in PR 20197.
This commit is contained in:
parent
601d961fc3
commit
42566f40fb
@ -247,9 +247,9 @@ class FontInfo {
|
||||
offset += this.#view.getUint32(offset) + 4;
|
||||
}
|
||||
const length = this.#view.getUint32(offset);
|
||||
const stringData = new Uint8Array(length);
|
||||
stringData.set(new Uint8Array(this.#buffer, offset + 4, length));
|
||||
return this.#decoder.decode(stringData);
|
||||
return this.#decoder.decode(
|
||||
new Uint8Array(this.#buffer, offset + 4, length)
|
||||
);
|
||||
}
|
||||
|
||||
get fallbackName() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user