File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/core/text-rendering/font-face-types Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export class WebTrFontFace extends TrFontFace {
4949 const determinedDescriptors = this . descriptors ;
5050
5151 // Convert TrFontFaceDescriptors to CSS FontFaceDescriptors
52- const cssDescriptors : FontFaceDescriptors = {
52+ let cssDescriptors : FontFaceDescriptors = {
5353 style : determinedDescriptors . style ,
5454 weight :
5555 typeof determinedDescriptors . weight === 'number'
@@ -61,6 +61,13 @@ export class WebTrFontFace extends TrFontFace {
6161 display : determinedDescriptors . display ,
6262 } ;
6363
64+ for ( const k in cssDescriptors ) {
65+ const key = k as keyof FontFaceDescriptors ;
66+ if ( cssDescriptors [ key ] === undefined ) {
67+ delete cssDescriptors [ key ] ;
68+ }
69+ }
70+
6471 const fontFace = new FontFace (
6572 fontFamily ,
6673 `url(${ fontUrlWithoutParentheses } )` ,
@@ -71,14 +78,12 @@ export class WebTrFontFace extends TrFontFace {
7178 fontFace
7279 . load ( )
7380 . then ( ( ) => {
74- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
7581 ( this . loaded as boolean ) = true ;
7682 this . emit ( 'loaded' ) ;
7783 } )
7884 . catch ( console . error ) ;
7985 } else {
8086 // Default font
81- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
8287 ( this . loaded as boolean ) = true ;
8388 this . emit ( 'loaded' ) ;
8489 }
You can’t perform that action at this time.
0 commit comments