SDL_ttf
SDL_ttf copied to clipboard
Rendering text fails when NOT initializing with SDL_INIT_GAMECONTROLLER
This is my current setup:
Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal Running in a virtualbox
I am using the official SDL2 packages from the Ubuntu repos -> libsdl2-ttf-2.0-0
I realized that my font is only visible when calling SDL_Init like this
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMECONTROLLER)
When I remove 'SDL_INIT_GAMECONTROLLER' my text is not rendered anymore.
Is this problem maybe related to this one: SDL_Init() with SDL_INIT_GAMECONTROLLER flag changes locale ?
I used the same code on past Ubuntu versions also with virtual box and it worked fine.
Looks strange, it works without using SDL_INIT_GAMECONTROLLER can you check with latest version of SDL2 and SDL2_ttf
It may take some time as I am currently quite busy... but I will try
I suspect this is just an environment issue with your VM.
This code in hid_init() is probably what's fixing your font rendering:
/* Set the locale if it's not set. */
locale = setlocale(LC_CTYPE, NULL);
if (!locale)
setlocale(LC_CTYPE, "");
If you do this in the shell before running your test program, does it work?
export LC_CTYPE=""
setlocale(LC_CTYPE, "");
That doesn't mean "set locale to the empty string", it means "set locale to something determined by looking at environment variables".
my font is only visible when...
What specific text are you rendering, and what specific API are you using to do it?
There hasn't been any response, so I'm going ahead and closing this. Feel free to reopen it if you come back with more information.