mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-01 20:07:22 +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;
|
offset += this.#view.getUint32(offset) + 4;
|
||||||
}
|
}
|
||||||
const length = this.#view.getUint32(offset);
|
const length = this.#view.getUint32(offset);
|
||||||
const stringData = new Uint8Array(length);
|
return this.#decoder.decode(
|
||||||
stringData.set(new Uint8Array(this.#buffer, offset + 4, length));
|
new Uint8Array(this.#buffer, offset + 4, length)
|
||||||
return this.#decoder.decode(stringData);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get fallbackName() {
|
get fallbackName() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user