emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.83k stars 3.31k forks source link

SDL2_ttf 2.20.2 cause text to be 'blurry' #19547

Open Narkhos opened 1 year ago

Narkhos commented 1 year ago

Hi,

I have this result with the last version of SDL2_ttf:

image

The text is kind of 'blurry' on the first an last letters.

I downgraded the embeded sdl2_ttf to release-2.0.13 (in sdl2_ttf.py) and it render properly:

image

I don't know if it's an issue with the embeding of this version or if it's an issue in sdl2_ttf, so I post it here.

The project where I encounter the issue is this one: https://github.com/erik-larsen/emscripten-sdl2-ogles2 (it's not mine, but some examples I'm currently studying). The example is this one: https://github.com/erik-larsen/emscripten-sdl2-ogles2/blob/master/src/hello_text_ttf.cpp

Maybe it's an error in the soucecode of the example, but I can't tell.

Thank you for your help

Version of emscripten/emsdk: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.39 (36f871819b566281d160470a1ec4515f379e9f77) Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt) This is free and open source software under the MIT license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Failing command line in full:

Full link command and output with -v appended:

$ emcc -v -std=c++11 hello_text_ttf.cpp events.cpp camera.cpp -s USE_SDL=2 -s USE_SDL_TTF=2 -s FULL_ES2=1 -s WASM=0 --preload-file media/LiberationSansBold.ttf -o ..\hello_text_ttf.js
 "C:/SDKs/emsdk/upstream/bin\clang.exe" --version
 "C:/SDKs/emsdk/upstream/bin\clang++.exe" -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\freetype2 -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\SDL2 -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\harfbuzz -DTTF_USE_HARFBUZZ=1 --sysroot=C:\SDKs\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat -v -std=c++11 hello_text_ttf.cpp -c -o C:\Users\xavierdi\AppData\Local\Temp\emscripten_temp_7ombb2hw\hello_text_ttf_0.o
clang version 17.0.0 (https://github.com/llvm/llvm-project c672c3fe05adbb590abc99da39143b55ad510538)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\SDKs\emsdk\upstream\bin
 (in-process)
 "C:\\SDKs\\emsdk\\upstream\\bin\\clang++.exe" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hello_text_ttf.cpp -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -debugger-tuning=gdb -v "-fcoverage-compilation-dir=C:\\tests\\wasm\\examples\\emscripten-sdl2-ogles2\\src" -resource-dir "C:\\SDKs\\emsdk\\upstream\\lib\\clang\\17" -D EMSCRIPTEN -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\freetype2" -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\SDL2" -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\harfbuzz" -D TTF_USE_HARFBUZZ=1 -isysroot "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include/wasm32-emscripten/c++/v1" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include/c++/v1" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\lib\\clang\\17\\include" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include/wasm32-emscripten" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include" -std=c++11 -fdeprecated-macro "-fdebug-compilation-dir=C:\\tests\\wasm\\examples\\emscripten-sdl2-ogles2\\src" -ferror-limit 19 -fmessage-length=202 -fvisibility=default -fgnuc-version=4.2.1 -fcxx-exceptions -fignore-exceptions -fexceptions -fcolor-diagnostics "-iwithsysroot/include\\compat" -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o "C:\\Users\\xavierdi\\AppData\\Local\\Temp\\emscripten_temp_7ombb2hw\\hello_text_ttf_0.o" -x c++ hello_text_ttf.cpp
clang -cc1 version 17.0.0 based upon LLVM 17.0.0git default target x86_64-pc-windows-msvc
ignoring nonexistent directory "C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\freetype2
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\SDL2
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\harfbuzz
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include\compat
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include/c++/v1
 C:\SDKs\emsdk\upstream\lib\clang\17\include
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include
End of search list.
 "C:/SDKs/emsdk/upstream/bin\clang++.exe" -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\freetype2 -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\SDL2 -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\harfbuzz -DTTF_USE_HARFBUZZ=1 --sysroot=C:\SDKs\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat -v -std=c++11 events.cpp -c -o C:\Users\xavierdi\AppData\Local\Temp\emscripten_temp_7ombb2hw\events_1.o
clang version 17.0.0 (https://github.com/llvm/llvm-project c672c3fe05adbb590abc99da39143b55ad510538)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\SDKs\emsdk\upstream\bin
 (in-process)
 "C:\\SDKs\\emsdk\\upstream\\bin\\clang++.exe" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name events.cpp -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -debugger-tuning=gdb -v "-fcoverage-compilation-dir=C:\\tests\\wasm\\examples\\emscripten-sdl2-ogles2\\src" -resource-dir "C:\\SDKs\\emsdk\\upstream\\lib\\clang\\17" -D EMSCRIPTEN -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\freetype2" -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\SDL2" -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\harfbuzz" -D TTF_USE_HARFBUZZ=1 -isysroot "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include/wasm32-emscripten/c++/v1" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include/c++/v1" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\lib\\clang\\17\\include" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include/wasm32-emscripten" -internal-isystem "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot/include" -std=c++11 -fdeprecated-macro "-fdebug-compilation-dir=C:\\tests\\wasm\\examples\\emscripten-sdl2-ogles2\\src" -ferror-limit 19 -fmessage-length=202 -fvisibility=default -fgnuc-version=4.2.1 -fcxx-exceptions -fignore-exceptions -fexceptions -fcolor-diagnostics "-iwithsysroot/include\\compat" -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o "C:\\Users\\xavierdi\\AppData\\Local\\Temp\\emscripten_temp_7ombb2hw\\events_1.o" -x c++ events.cpp
clang -cc1 version 17.0.0 based upon LLVM 17.0.0git default target x86_64-pc-windows-msvc
ignoring nonexistent directory "C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\freetype2
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\SDL2
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\harfbuzz
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include\compat
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include/c++/v1
 C:\SDKs\emsdk\upstream\lib\clang\17\include
 C:\SDKs\emsdk\upstream\emscripten\cache\sysroot/include
End of search list.
 "C:/SDKs/emsdk/upstream/bin\clang++.exe" -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\freetype2 -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\SDL2 -IC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\include\harfbuzz -DTTF_USE_HARFBUZZ=1 --sysroot=C:\SDKs\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat -v -std=c++11 camera.cpp -c -o C:\Users\xavierdi\AppData\Local\Temp\emscripten_temp_7ombb2hw\camera_2.o
clang version 17.0.0 (https://github.com/llvm/llvm-project c672c3fe05adbb590abc99da39143b55ad510538)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\SDKs\emsdk\upstream\bin
 (in-process)
 "C:\\SDKs\\emsdk\\upstream\\bin\\clang++.exe" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name camera.cpp -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -debugger-tuning=gdb -v "-fcoverage-compilation-dir=C:\\tests\\wasm\\examples\\emscripten-sdl2-ogles2\\src" -resource-dir "C:\\SDKs\\emsdk\\upstream\\lib\\clang\\17" -D EMSCRIPTEN -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\freetype2" -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\SDL2" -I "C:\\SDKs\\emsdk\\upstream\\emscripten\\cache\\sysroot\\include\\harfbuzz" -D TTF_USE_HARFBUZZ=1 -isysroot "C:\\SDKs\\emsdk\\ups "C:/SDKs/emsdk/upstream/bin\wasm-ld.exe" -o ..\hello_text_ttf.wasm C:\Users\xavierdi\AppData\Local\Temp\emscripten_temp_7ombb2hw\hello_text_ttf_0.o C:\Users\xavierdi\AppData\Local\Temp\emscripten_temp_7ombb2hw\events_1.o C:\Users\xavierdi\AppData\Local\Temp\emscripten_temp_7ombb2hw\camera_2.o -LC:\SDKs\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libSDL2_ttf.a C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libharfbuzz.a C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libSDL2.a C:\SDKs\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libfreetype.a -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr C:\Users\xavierdi\AppData\Local\Temp\tmp5wgqt55dlibemscripten_js_symbols.so --import-memory --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=malloc --export=free --export=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=16777216 --no-entry --max-memory=16777216 --stack-first
 "C:/SDKs/emsdk/upstream\bin\wasm-emscripten-finalize" --dyncalls-i64 --pass-arg=legalize-js-interface-exported-helpers ..\hello_text_ttf.wasm -o ..\hello_text_ttf.wasm --detect-features
 "C:/SDKs/emsdk/node/15.14.0_64bit/bin/node.exe" C:\SDKs\emsdk\upstream\emscripten\src\compiler.js C:\Users\xavierdi\AppData\Local\Temp\tmpo4p987yw.json
 "C:/SDKs/emsdk/upstream/bin\llvm-objcopy.exe" ..\hello_text_ttf.wasm ..\hello_text_ttf.wasm --remove-section=.debug* --remove-section=producers
 "C:/SDKs/emsdk/upstream\bin\wasm2js" --emscripten ..\hello_text_ttf.wasm --mvp-features --enable-threads --enable-bulk-memory --enable-mutable-globals --enable-sign-ext
sbc100 commented 1 month ago

I wonder if the freetype upgrade that is coming will help with this: https://github.com/emscripten-core/emscripten/pull/22585