Send UnsupportedFeature notification when errors are ignored in FontFaceObject.getPathGenerator

This commit is contained in:
Jonas Jenwald 2018-06-13 11:02:10 +02:00
parent bf0db0fb72
commit 0958006713
2 changed files with 19 additions and 10 deletions

View file

@ -14,7 +14,8 @@
*/
import {
assert, bytesToString, isEvalSupported, shadow, string32, warn
assert, bytesToString, isEvalSupported, shadow, string32,
UNSUPPORTED_FEATURES, warn
} from '../shared/util';
function FontLoader(docId) {
@ -339,6 +340,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
function FontFaceObject(translatedData, { isEvalSupported = true,
disableFontFace = false,
ignoreErrors = false,
onUnsupportedFeature = null,
fontRegistry = null, }) {
this.compiledGlyphs = Object.create(null);
// importing translated data
@ -348,6 +350,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
this.isEvalSupported = isEvalSupported !== false;
this.disableFontFace = disableFontFace === true;
this.ignoreErrors = ignoreErrors === true;
this._onUnsupportedFeature = onUnsupportedFeature;
this.fontRegistry = fontRegistry;
}
FontFaceObject.prototype = {
@ -399,6 +402,9 @@ var FontFaceObject = (function FontFaceObjectClosure() {
if (!this.ignoreErrors) {
throw ex;
}
if (this._onUnsupportedFeature) {
this._onUnsupportedFeature({ featureId: UNSUPPORTED_FEATURES.font, });
}
warn(`getPathGenerator - ignoring character: "${ex}".`);
return this.compiledGlyphs[character] = function(c, size) {