File tree 1 file changed +16
-0
lines changed
addons/xterm-addon-ligatures/src
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,22 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
65
65
console . error ( err . name , err . message ) ;
66
66
}
67
67
}
68
+ // Latest proposal
69
+ else if ( 'queryLocalFonts' in window ) {
70
+ const fonts : Record < string , IFontMetadata [ ] > = { } ;
71
+ try {
72
+ const fontsIterator = await ( window as any ) . queryLocalFonts ( ) ; // await (navigator as unknown as IFontAccessNavigator).fonts.query();
73
+ for ( const metadata of fontsIterator ) {
74
+ if ( ! fonts . hasOwnProperty ( metadata . family ) ) {
75
+ fonts [ metadata . family ] = [ ] ;
76
+ }
77
+ fonts [ metadata . family ] . push ( metadata ) ;
78
+ }
79
+ fontsPromise = Promise . resolve ( fonts ) ;
80
+ } catch ( err : any ) {
81
+ console . error ( err . name , err . message ) ;
82
+ }
83
+ }
68
84
// Node environment or no font access API
69
85
else {
70
86
try {
You can’t perform that action at this time.
0 commit comments