declare let FontFace ; export function loadAsset ( player , entry , callback ) { player . getAssetData ( `assets/${ entry . storagePath }/asset.json` , "json" , ( err , data ) => { if ( data . isBitmap ) { const img = new Image ( ) ; img . onload = ( ) => { data . texture = new SupEngine . THREE . Texture ( img ) ; data . texture . needsUpdate = true ; if ( data . filtering === "pixelated" ) { data . texture . magFilter = SupEngine . THREE . NearestFilter ; data . texture . minFilter = SupEngine . THREE . NearestFilter ; } callback ( null , data ) ; } ; img . onerror = ( ) => { callback ( null , data ) ; } ; img . src = `${ player . dataURL }assets/${ entry . storagePath }/bitmap.dat` ; } else { data . name = `Font${ entry . id }` ; let font ; try { font = new FontFace ( data . name , `url(${ player . dataURL }assets/${ fixedEncodeURIComponent ( entry . storagePath ) }/font.dat)` ) ; ( < any > document ) . fonts . add ( font ) ; } catch ( e ) { } if ( font != null ) font . load ( ) . then ( ( ) => { callback ( null , data ) ; } , ( ) => { callback ( null , data ) ; } ) ; else callback ( null , data ) ; } } ) ; } function fixedEncodeURIComponent ( str ) { return str . split ( "/" ) . map ( ( part ) => encodeURIComponent ( part ) . replace ( /[!'()*]/g , ( c ) => `%${ c . charCodeAt ( 0 ) . toString ( 16 ) }` ) ) . join ( "/" ) ; } export function createOuterAsset ( player , asset ) { return new ( < any > window ) . Sup . Font ( asset ) ; }