Skip to content

Commit f52a50b

Browse files
Merge pull request #20986 from Snuffleupagus/FontInfo-readString-simplify
Reduce allocations in the `FontInfo.prototype.#readString` method (PR 20197 follow-up)
2 parents 8531947 + 42566f4 commit f52a50b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/display/obj_bin_transform_display.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ class FontInfo {
247247
offset += this.#view.getUint32(offset) + 4;
248248
}
249249
const length = this.#view.getUint32(offset);
250-
const stringData = new Uint8Array(length);
251-
stringData.set(new Uint8Array(this.#buffer, offset + 4, length));
252-
return this.#decoder.decode(stringData);
250+
return this.#decoder.decode(
251+
new Uint8Array(this.#buffer, offset + 4, length)
252+
);
253253
}
254254

255255
get fallbackName() {

0 commit comments

Comments
 (0)