Hi, I'm getting this error:
Assertion failed: (0) && "Could not load font file!", at: imgui_draw.cpp,1716,AddFontFromFileTTF
I have added a font in fonts folder beside the main.cpp file and compiled with
--preload-file fonts
set it with
ImFont* font = io.Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 16.0f);
emcc produced the .data file
also these options are not set or present
-s NO_FILESYSTEM=1 -DIMGUI_DISABLE_FILE_FUNCTIONS
font loads on Windows, having problems with Emscripten.
However issue also exists in emscripten example. I will look into it.
Thanks. The PR by @Oipo solves it, just curious about what the @font is for in the preload asset option.
@wini3d emscripten follows the convention of localdir@asset_file_dir. So the @/fonts part tells emscripten to place the misc/fonts directory at /fonts in the virtual filesystem. Loading it from the executable then requires using the /fonts path.
Most helpful comment
Also see https://github.com/ocornut/imgui/pull/2953