2121 <div class =" screen-console" >
2222 <div
2323 class =" console-console"
24- :style =" 'font-family: ' + typeface + ', inherit'"
24+ :style =" 'font-family: ' + typefaces + ', inherit'"
2525 >
2626 <h2 style =" display : none " >Console</h2 >
2727
@@ -117,15 +117,15 @@ import { consoleScreenKeys } from "./screen_console_keys.js";
117117import " ./screen_console.css" ;
118118import " xterm/css/xterm.css" ;
119119
120- const termTypeFace = " PureNerdFont" ;
121- const termFallbackTypeFace = " monospace" ;
120+ const termTypeFaces = " PureNerdFont, Hack " ;
121+ const termFallbackTypeFace = " \" Cascadia Code \" , monospace" ;
122122const termTypeFaceLoadTimeout = 3000 ;
123123const termTypeFaceLoadError =
124- ' Remote font " ' +
125- termTypeFace +
126- ' " is unavailable, using " ' +
124+ ' Remote font ' +
125+ termTypeFaces +
126+ ' is unavailable, using ' +
127127 termFallbackTypeFace +
128- ' " instead until the remote font is loaded' ;
128+ ' instead until the remote font is loaded' ;
129129const termDefaultFontSize = 16 ;
130130const termMinFontSize = 8 ;
131131const termMaxFontSize = 36 ;
@@ -142,7 +142,7 @@ class Term {
142142 allowTransparency: false ,
143143 cursorBlink: true ,
144144 cursorStyle: " block" ,
145- fontFamily: termTypeFace + " , " + termFallbackTypeFace,
145+ fontFamily: termTypeFaces + " , " + termFallbackTypeFace,
146146 fontSize: this .fontSize ,
147147 logLevel: process .env .NODE_ENV === " development" ? " info" : " off" ,
148148 theme: {
@@ -416,7 +416,7 @@ export default {
416416 return {
417417 screenKeys: consoleScreenKeys,
418418 term: new Term (this .control ),
419- typeface : termTypeFace ,
419+ typefaces : termTypeFaces ,
420420 runner: null ,
421421 eventHandlers: {
422422 keydown: null ,
@@ -456,25 +456,22 @@ export default {
456456 this .deinit ();
457457 },
458458 methods: {
459- loadRemoteFont (typeface , timeout ) {
460- return Promise .all ([
461- new FontFaceObserver (typeface).load (null , timeout),
462- new FontFaceObserver (typeface, {
459+ loadRemoteFont (typefaces , timeout ) {
460+ const tfs = typefaces .split (" ," );
461+ let observers = [];
462+ for (let v in tfs) {
463+ observers .push (new FontFaceObserver (tfs[v].trim ()).load (null , timeout))
464+ observers .push (new FontFaceObserver (tfs[v].trim (), {
463465 weight: " bold" ,
464- }).load (null , timeout),
465- ]);
466+ }).load (null , timeout))
467+ }
468+ return Promise .all (observers);
466469 },
467- async retryLoadRemoteFont (typeface , timeout , onSuccess ) {
470+ async retryLoadRemoteFont (typefaces , timeout , onSuccess ) {
468471 const self = this ;
469-
470472 for (;;) {
471- if (self .term .destroyed ()) {
472- return ;
473- }
474-
475473 try {
476- onSuccess (await self .loadRemoteFont (typeface, timeout));
477-
474+ onSuccess (await self .loadRemoteFont (typefaces, timeout));
478475 return ;
479476 } catch (e) {
480477 // Retry
@@ -483,41 +480,29 @@ export default {
483480 },
484481 async openTerm (root , callbacks ) {
485482 const self = this ;
486-
487483 try {
488- await self .loadRemoteFont (termTypeFace, termTypeFaceLoadTimeout);
489-
484+ await self .loadRemoteFont (termTypeFaces, termTypeFaceLoadTimeout);
490485 if (self .term .destroyed ()) {
491486 return ;
492487 }
493-
494488 root .innerHTML = " " ;
495-
496489 self .term .init (root);
497-
498490 return ;
499491 } catch (e) {
500492 // Ignore
501493 }
502-
503494 if (self .term .destroyed ()) {
504495 return ;
505496 }
506-
507497 root .innerHTML = " " ;
508-
509498 callbacks .warn (termTypeFaceLoadError, false );
510-
511499 self .term .setFont (termFallbackTypeFace);
512500 self .term .init (root);
513-
514- self .retryLoadRemoteFont (termTypeFace, termTypeFaceLoadTimeout, () => {
501+ self .retryLoadRemoteFont (termTypeFaces, termTypeFaceLoadTimeout, () => {
515502 if (self .term .destroyed ()) {
516503 return ;
517504 }
518-
519- self .term .setFont (termTypeFace);
520-
505+ self .term .setFont (termTypeFaces);
521506 callbacks .warn (termTypeFaceLoadError, true );
522507 });
523508 },
0 commit comments