mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-30 10:57:21 +02:00
Set the correct data if compilation fails in the CFFFont constructor
The `CFFFont.prototype.data` should contain a `Uint8Array`, however if compilation failed it was being set to a `Stream` instance which will thus fail elsewhere in the font-code. *Please note:* This was found by code inspection, since I don't have a PDF document that's fixed by this change.
This commit is contained in:
parent
521f4dc554
commit
b65eedc636
@ -28,11 +28,12 @@ class CFFFont {
|
|||||||
this.seacs = this.cff.seacs;
|
this.seacs = this.cff.seacs;
|
||||||
try {
|
try {
|
||||||
this.data = compiler.compile();
|
this.data = compiler.compile();
|
||||||
} catch {
|
} catch (ex) {
|
||||||
warn("Failed to compile font " + properties.loadedName);
|
warn(`Failed to compile font "${properties.loadedName}": "${ex}".`);
|
||||||
// There may have just been an issue with the compiler, set the data
|
// There may have just been an issue with the compiler, set the data
|
||||||
// anyway and hope the font loaded.
|
// anyway and hope the font loaded.
|
||||||
this.data = file;
|
file.reset();
|
||||||
|
this.data = file.getBytes();
|
||||||
}
|
}
|
||||||
this._createBuiltInEncoding();
|
this._createBuiltInEncoding();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user