File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -3117,13 +3117,16 @@ var LibrarySDL = {
3117
3117
try {
3118
3118
var offscreenCanvas = new OffscreenCanvas ( 0 , 0 ) ;
3119
3119
SDL . ttfContext = offscreenCanvas . getContext ( '2d' ) ;
3120
- // Firefox support for OffscreenCanvas is still experimental, and it seems
3121
- // like CI might be creating a context here but one that is not entirely
3122
- // valid. Check that explicitly and fall back to a plain Canvas if we need
3123
- // to. See https://github.com/emscripten-core/emscripten/issues/16242
3124
- if ( typeof SDL . ttfContext . measureText != 'function' ) {
3125
- abort ( 'bad context' ) ;
3120
+ #if MIN_FIREFOX_VERSION < 128 // Conservative, not exact
3121
+ // According to https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D
3122
+ // OffscreenCanvasRenderingContext2D.measureText() appeared in
3123
+ // Chrome 69, Firefox 105 and Safari 16.4. Fall back to using regular
3124
+ // Canvas2D if OffscreenCanvas2D exists, but does not look workable.
3125
+ // https://github.com/emscripten-core/emscripten/issues/16242
3126
+ if ( ! SDL . ttfContext . measureText ) {
3127
+ throw 1 ; // no OffscreenCanvasRenderingContext2D.measureText
3126
3128
}
3129
+ #endif
3127
3130
} catch ( ex ) {
3128
3131
var canvas = /** @type {HTMLCanvasElement } */ ( document . createElement ( 'canvas' ) ) ;
3129
3132
SDL . ttfContext = canvas . getContext ( '2d' ) ;
Original file line number Diff line number Diff line change 1
1
{
2
- "a.out.js" : 246028 ,
3
- "a.out.nodebug.wasm" : 597755 ,
4
- "total" : 843783 ,
2
+ "a.out.js" : 246004 ,
3
+ "a.out.nodebug.wasm" : 597763 ,
4
+ "total" : 843759 ,
5
5
"sent" : [
6
6
" IMG_Init" ,
7
7
" IMG_Load" ,
You can’t perform that action at this time.
0 commit comments