mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-18 03:04:07 +02:00
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:
parent
169d8c9616
commit
c92d4be973
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user