diff --git a/src/core/core_utils.js b/src/core/core_utils.js index 287547616..3c4c129d5 100644 --- a/src/core/core_utils.js +++ b/src/core/core_utils.js @@ -275,28 +275,6 @@ function log2(x) { return x > 0 ? Math.ceil(Math.log2(x)) : 0; } -function readInt8(data, offset) { - return (data[offset] << 24) >> 24; -} - -function readInt16(data, offset) { - return ((data[offset] << 24) | (data[offset + 1] << 16)) >> 16; -} - -function readUint16(data, offset) { - return (data[offset] << 8) | data[offset + 1]; -} - -function readUint32(data, offset) { - return ( - ((data[offset] << 24) | - (data[offset + 1] << 16) | - (data[offset + 2] << 8) | - data[offset + 3]) >>> - 0 - ); -} - // Checks if ch is one of the following characters: SPACE, TAB, CR or LF. function isWhiteSpace(ch) { return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; @@ -804,10 +782,6 @@ export { ParserEOFException, parseXFAPath, PDF_VERSION_REGEXP, - readInt16, - readInt8, - readUint16, - readUint32, recoverJsURL, RESOURCES_KEYS_OPERATOR_LIST, RESOURCES_KEYS_TEXT_CONTENT, diff --git a/src/core/fonts.js b/src/core/fonts.js index 56591f0e7..291d67948 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -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) {