Remove readUint32 usage from the isTrueTypeFile function

This is the only `readUint32` usage in the `src/core/fonts.js` file, and it can be trivially replaced with a string comparison.
This commit is contained in:
Jonas Jenwald 2026-04-10 17:08:44 +02:00
parent 169d8c9616
commit c92d4be973

View File

@ -62,7 +62,6 @@ import { FontRendererFactory } from "./font_renderer.js";
import { getFontBasicMetrics } from "./metrics.js";
import { GlyfTable } from "./glyf.js";
import { OpenTypeFileBuilder } from "./opentype_file_builder.js";
import { readUint32 } from "./core_utils.js";
import { Stream } from "./stream.js";
import { Type1Font } from "./type1_font.js";
@ -338,10 +337,9 @@ function ensureInt16(v) {
}
function isTrueTypeFile(file) {
const header = file.peekBytes(4);
return (
readUint32(header, 0) === 0x00010000 || bytesToString(header) === "true"
);
const header = file.peekBytes(4),
str = bytesToString(header);
return str === "\x00\x01\x00\x00" || str === "true";
}
function isTrueTypeCollectionFile(file) {