@@ -244,12 +244,21 @@ export function EnrichedMathItemMixin<N, T, D, B extends Constructor<AbstractMat
244244 */
245245 public attachSpeech ( document : MathDocument < N , T , D > ) {
246246 if ( this . state ( ) >= STATE . ATTACHSPEECH ) return ;
247+ if ( this . isEscaped || ! document . options . enableEnrichment ) {
248+ this . state ( STATE . ATTACHSPEECH ) ;
249+ return ;
250+ }
247251 let [ speech , braille ] = this . existingSpeech ( ) ;
248252 let [ newSpeech , newBraille ] = [ '' , '' ] ;
249253 if ( ! speech || ! braille ||
250254 document . options . enableSpeech || document . options . enableBraille ) {
251- [ newSpeech , newBraille ] = this . generatorPool . computeSpeech (
252- this . typesetRoot , this . toMathML ( this . root , this ) ) ;
255+ try {
256+ [ newSpeech , newBraille ] = this . generatorPool . computeSpeech (
257+ this . typesetRoot , this . toMathML ( this . root , this ) ) ;
258+ if ( newSpeech ) {
259+ newSpeech = buildSpeech ( newSpeech ) [ 0 ] ;
260+ }
261+ } catch ( _e ) { }
253262 }
254263 speech = speech || newSpeech ;
255264 braille = braille || newBraille ;
@@ -359,6 +368,7 @@ export function EnrichedMathDocumentMixin<N, T, D, B extends MathDocumentConstru
359368 ...BaseDocument . OPTIONS ,
360369 enableEnrichment : true ,
361370 enableSpeech : true ,
371+ enableBraille : true ,
362372 enrichError : ( doc : EnrichedMathDocument < N , T , D > ,
363373 math : EnrichedMathItem < N , T , D > ,
364374 err : Error ) => doc . enrichError ( doc , math , err ) ,
0 commit comments