Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const EXPORT_DATA_PROPERTIES = [
"isType3Font",
"italic",
"loadedName",
"mimetype",
"missingFile",
"name",
"remeasure",
Expand Down Expand Up @@ -1050,7 +1049,6 @@ class Font {
constructor(name, file, properties, evaluatorOptions) {
this.name = name;
this.psName = null;
this.mimetype = null;
this.disableFontFace = evaluatorOptions.disableFontFace;
this.fontExtraProperties = evaluatorOptions.fontExtraProperties;

Expand Down Expand Up @@ -1165,8 +1163,6 @@ class Font {
/* falls through */
case "Type1":
case "CIDFontType0":
this.mimetype = "font/opentype";

const cff =
subtype === "Type1C" || subtype === "CIDFontType0C"
? new CFFFont(file, properties)
Expand All @@ -1181,8 +1177,6 @@ class Font {
case "OpenType":
case "TrueType":
case "CIDFontType2":
this.mimetype = "font/opentype";

// Repair the TrueType file. It is can be damaged in the point of
// view of the sanitizer
data = this.checkAndRepair(name, file, properties);
Expand Down
2 changes: 1 addition & 1 deletion src/display/font_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class FontFaceObject {
}

get mimetype() {
return this.#fontData.mimetype;
return this.missingFile ? null : "font/opentype";
}

get name() {
Expand Down
6 changes: 1 addition & 5 deletions src/display/obj_bin_transform_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,8 @@ class FontInfo {
return this.#readString(1);
}

get mimetype() {
return this.#readString(2);
}

get name() {
return this.#readString(3);
return this.#readString(2);
}

#getDataOffsets() {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/obj_bin_transform_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FONT_INFO {

static numbers = ["ascent", "descent"];

static strings = ["fallbackName", "loadedName", "mimetype", "name"];
static strings = ["fallbackName", "loadedName", "name"];

static OFFSET_NUMBERS = Math.ceil((this.bools.length * 2) / 8);

Expand Down
4 changes: 1 addition & 3 deletions test/unit/obj_bin_transform_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ describe("obj_bin_transform", function () {
fontMatrix: [1, 1, 1, 1, 1, 1],
fallbackName: "string",
loadedName: "string",
mimetype: "string",
name: "string",
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
uselessProp: "something",
Expand Down Expand Up @@ -124,7 +123,7 @@ describe("obj_bin_transform", function () {

describe("FontInfo", function () {
it("must roundtrip correctly for FontInfo", function () {
let sizeEstimate = 77; // fixed offset until the strings
let sizeEstimate = 67; // fixed offset until the strings
const { encoder } = InfoUtils;
sizeEstimate += 4 + 4 * (4 + encoder.encode("string").length);
sizeEstimate += 4 + 4; // cssFontInfo and systemFontInfo
Expand All @@ -148,7 +147,6 @@ describe("obj_bin_transform", function () {
expect(deserialized.fontMatrix).toEqual([1, 1, 1, 1, 1, 1]);
expect(deserialized.fallbackName).toEqual("string");
expect(deserialized.loadedName).toEqual("string");
expect(deserialized.mimetype).toEqual("string");
expect(deserialized.name).toEqual("string");
expect(Array.from(deserialized.data)).toEqual([
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
Expand Down
Loading