File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
lib/components/DynamicFonts Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -173,4 +173,23 @@ export default class DynamicFonts {
173
173
public async isFontDownloaded ( fontName : string , fontExtension : FontExtension ) : Promise < boolean > {
174
174
return await this . fontDownloader . isFontDownloaded ( fontName , fontExtension ) ;
175
175
}
176
+
177
+ public async isFontFamilyDownloaded ( rootUri : string ,
178
+ fontNames : string [ ] ,
179
+ fontExtension : FontExtension ,
180
+ fontNamePrefix ?: string ) : Promise < boolean > {
181
+ const fonts : GetFontInput [ ] = fontNames . map ( fontName =>
182
+ this . buildFontData ( rootUri , fontName , fontExtension , fontNamePrefix ) ) ;
183
+ try {
184
+ const areDownloaded = await Promise . all ( fonts
185
+ . filter ( font => font )
186
+ . map ( font => {
187
+ return this . fontDownloader . isFontDownloaded ( font . fontName , font . fontExtension ) ;
188
+ } ) ) ;
189
+ return Promise . resolve ( areDownloaded . every ( v => v === true ) ) ;
190
+ } catch ( error ) {
191
+ this . log ( `isFontFamilyDownloaded failed error:` , error ) ;
192
+ return Promise . resolve ( false ) ;
193
+ }
194
+ }
176
195
}
You can’t perform that action at this time.
0 commit comments