mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-10-04 06:18:00 +02:00
Merge pull request #22059 from Snuffleupagus/FontInfo-rm-extra
Stop passing `extra` properties to the `FontInfo` class
This commit is contained in:
+1
-1
@@ -2787,7 +2787,7 @@ class WorkerTransport {
|
||||
break;
|
||||
}
|
||||
|
||||
const fontData = new FontInfo(exportedData);
|
||||
const fontData = new FontInfo(exportedData.buffer);
|
||||
const inspectFont =
|
||||
this._params.pdfBug && globalThis.FontInspector?.enabled
|
||||
? (font, url) => globalThis.FontInspector.fontAdded(font, url)
|
||||
|
||||
@@ -110,12 +110,9 @@ class FontInfo {
|
||||
|
||||
#view;
|
||||
|
||||
constructor({ buffer, extra }) {
|
||||
constructor(buffer) {
|
||||
this.#buffer = buffer;
|
||||
this.#view = new DataView(buffer);
|
||||
if (extra) {
|
||||
Object.assign(this, extra);
|
||||
}
|
||||
}
|
||||
|
||||
#readBoolean(index) {
|
||||
|
||||
@@ -129,7 +129,7 @@ describe("obj_bin_transform", function () {
|
||||
sizeEstimate += 4 + fontInfo.data.length;
|
||||
const buffer = compileFontInfo(fontInfo);
|
||||
expect(buffer.byteLength).toEqual(sizeEstimate);
|
||||
const deserialized = new FontInfo({ buffer });
|
||||
const deserialized = new FontInfo(buffer);
|
||||
expect(deserialized.black).toBeTrue();
|
||||
expect(deserialized.bold).toBeTrue();
|
||||
expect(deserialized.disableFontFace).toBeTrue();
|
||||
@@ -160,7 +160,7 @@ describe("obj_bin_transform", function () {
|
||||
cssFontInfo,
|
||||
systemFontInfo,
|
||||
});
|
||||
const deserialized = new FontInfo({ buffer });
|
||||
const deserialized = new FontInfo(buffer);
|
||||
expect(deserialized.cssFontInfo.fontWeight).toEqual("not a number");
|
||||
expect(deserialized.systemFontInfo.src).toEqual("source");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user