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:
Jonas Jenwald 2026-03-26 16:46:01 +01:00
parent 601d961fc3
commit 42566f40fb

View File

@ -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() {