Skip to content

Commit 89dfdb5

Browse files
authored
Merge pull request #2748 from pmp-p/static-ftinit
wasm: unify pygame-web/pyodide/static Freetype init
2 parents fc49aa1 + c85a698 commit 89dfdb5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src_c/static.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "pygame.h"
1515
#include "Python.h"
1616

17+
#include <SDL_ttf.h>
18+
1719
#if defined(__EMSCRIPTEN__)
1820
#undef WITH_THREAD
1921
#endif
@@ -269,6 +271,12 @@ static struct PyModuleDef mod_pygame_static = {PyModuleDef_HEAD_INIT,
269271
PyMODINIT_FUNC
270272
PyInit_pygame_static()
271273
{
274+
// cannot fail here, and font_initialized is already set to 1 in font.c .
275+
TTF_Init();
276+
277+
// for correct input in wasm worker
278+
SDL_SetHint("SDL_EMSCRIPTEN_KEYBOARD_ELEMENT", "1");
279+
272280
load_submodule("pygame", PyInit_base(), "base");
273281
load_submodule("pygame", PyInit_constants(), "constants");
274282
load_submodule("pygame", PyInit_surflock(), "surflock");

0 commit comments

Comments
 (0)