Send UnsupportedFeature
notification when errors are ignored in FontFaceObject.getPathGenerator
This commit is contained in:
parent
bf0db0fb72
commit
0958006713
@ -1885,6 +1885,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||||||
isEvalSupported: params.isEvalSupported,
|
isEvalSupported: params.isEvalSupported,
|
||||||
disableFontFace: params.disableFontFace,
|
disableFontFace: params.disableFontFace,
|
||||||
ignoreErrors: params.ignoreErrors,
|
ignoreErrors: params.ignoreErrors,
|
||||||
|
onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
|
||||||
fontRegistry,
|
fontRegistry,
|
||||||
});
|
});
|
||||||
var fontReady = (fontObjs) => {
|
var fontReady = (fontObjs) => {
|
||||||
@ -1987,15 +1988,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
messageHandler.on('UnsupportedFeature', function(data) {
|
messageHandler.on('UnsupportedFeature', this._onUnsupportedFeature, this);
|
||||||
if (this.destroyed) {
|
|
||||||
return; // Ignore any pending requests if the worker was terminated.
|
|
||||||
}
|
|
||||||
let loadingTask = this.loadingTask;
|
|
||||||
if (loadingTask.onUnsupportedFeature) {
|
|
||||||
loadingTask.onUnsupportedFeature(data.featureId);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
messageHandler.on('JpegDecode', function(data) {
|
messageHandler.on('JpegDecode', function(data) {
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
@ -2061,6 +2054,16 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onUnsupportedFeature({ featureId, }) {
|
||||||
|
if (this.destroyed) {
|
||||||
|
return; // Ignore any pending requests if the worker was terminated.
|
||||||
|
}
|
||||||
|
let loadingTask = this.loadingTask;
|
||||||
|
if (loadingTask.onUnsupportedFeature) {
|
||||||
|
loadingTask.onUnsupportedFeature(featureId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getData: function WorkerTransport_getData() {
|
getData: function WorkerTransport_getData() {
|
||||||
return this.messageHandler.sendWithPromise('GetData', null);
|
return this.messageHandler.sendWithPromise('GetData', null);
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
assert, bytesToString, isEvalSupported, shadow, string32, warn
|
assert, bytesToString, isEvalSupported, shadow, string32,
|
||||||
|
UNSUPPORTED_FEATURES, warn
|
||||||
} from '../shared/util';
|
} from '../shared/util';
|
||||||
|
|
||||||
function FontLoader(docId) {
|
function FontLoader(docId) {
|
||||||
@ -339,6 +340,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
|
|||||||
function FontFaceObject(translatedData, { isEvalSupported = true,
|
function FontFaceObject(translatedData, { isEvalSupported = true,
|
||||||
disableFontFace = false,
|
disableFontFace = false,
|
||||||
ignoreErrors = false,
|
ignoreErrors = false,
|
||||||
|
onUnsupportedFeature = null,
|
||||||
fontRegistry = null, }) {
|
fontRegistry = null, }) {
|
||||||
this.compiledGlyphs = Object.create(null);
|
this.compiledGlyphs = Object.create(null);
|
||||||
// importing translated data
|
// importing translated data
|
||||||
@ -348,6 +350,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
|
|||||||
this.isEvalSupported = isEvalSupported !== false;
|
this.isEvalSupported = isEvalSupported !== false;
|
||||||
this.disableFontFace = disableFontFace === true;
|
this.disableFontFace = disableFontFace === true;
|
||||||
this.ignoreErrors = ignoreErrors === true;
|
this.ignoreErrors = ignoreErrors === true;
|
||||||
|
this._onUnsupportedFeature = onUnsupportedFeature;
|
||||||
this.fontRegistry = fontRegistry;
|
this.fontRegistry = fontRegistry;
|
||||||
}
|
}
|
||||||
FontFaceObject.prototype = {
|
FontFaceObject.prototype = {
|
||||||
@ -399,6 +402,9 @@ var FontFaceObject = (function FontFaceObjectClosure() {
|
|||||||
if (!this.ignoreErrors) {
|
if (!this.ignoreErrors) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
if (this._onUnsupportedFeature) {
|
||||||
|
this._onUnsupportedFeature({ featureId: UNSUPPORTED_FEATURES.font, });
|
||||||
|
}
|
||||||
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
||||||
|
|
||||||
return this.compiledGlyphs[character] = function(c, size) {
|
return this.compiledGlyphs[character] = function(c, size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user