mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-02 20:37:21 +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 { getFontBasicMetrics } from "./metrics.js";
|
||||||
import { GlyfTable } from "./glyf.js";
|
import { GlyfTable } from "./glyf.js";
|
||||||
import { OpenTypeFileBuilder } from "./opentype_file_builder.js";
|
import { OpenTypeFileBuilder } from "./opentype_file_builder.js";
|
||||||
import { readUint32 } from "./core_utils.js";
|
|
||||||
import { Stream } from "./stream.js";
|
import { Stream } from "./stream.js";
|
||||||
import { Type1Font } from "./type1_font.js";
|
import { Type1Font } from "./type1_font.js";
|
||||||
|
|
||||||
@ -338,10 +337,9 @@ function ensureInt16(v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isTrueTypeFile(file) {
|
function isTrueTypeFile(file) {
|
||||||
const header = file.peekBytes(4);
|
const header = file.peekBytes(4),
|
||||||
return (
|
str = bytesToString(header);
|
||||||
readUint32(header, 0) === 0x00010000 || bytesToString(header) === "true"
|
return str === "\x00\x01\x00\x00" || str === "true";
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTrueTypeCollectionFile(file) {
|
function isTrueTypeCollectionFile(file) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user