Merge pull request #20986 from Snuffleupagus/FontInfo-readString-simplify

Reduce allocations in the `FontInfo.prototype.#readString` method (PR 20197 follow-up)
This commit is contained in:
Tim van der Meij 2026-03-26 20:34:03 +01:00 committed by GitHub
commit f52a50ba09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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