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, | ||||
|               disableFontFace: params.disableFontFace, | ||||
|               ignoreErrors: params.ignoreErrors, | ||||
|               onUnsupportedFeature: this._onUnsupportedFeature.bind(this), | ||||
|               fontRegistry, | ||||
|             }); | ||||
|             var fontReady = (fontObjs) => { | ||||
| @ -1987,15 +1988,7 @@ var WorkerTransport = (function WorkerTransportClosure() { | ||||
|         } | ||||
|       }, this); | ||||
| 
 | ||||
|       messageHandler.on('UnsupportedFeature', function(data) { | ||||
|         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('UnsupportedFeature', this._onUnsupportedFeature, this); | ||||
| 
 | ||||
|       messageHandler.on('JpegDecode', function(data) { | ||||
|         if (this.destroyed) { | ||||
| @ -2061,6 +2054,16 @@ var WorkerTransport = (function WorkerTransportClosure() { | ||||
|       }, 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() { | ||||
|       return this.messageHandler.sendWithPromise('GetData', null); | ||||
|     }, | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user