SDL2 - Inconsistencies In TTF Text Rendering When Resizing Game Window?(With Photo & Source)

Hi,

Jumped back to a very old SDL2 game project in preparation for a new game project with Unreal Engine.

We are currently using SDL2_TTF for TTF font text rendering in our SDL2 game project.
When the game is first run and in default window resolution size the text looks perfect.
When we maximize the game’s window and thus change resolution the text looks bad?

Please see example photo below:
http://tetristory.com/Stuff/TetriCrisis/Images/TC4T-SDL2_TTF-Issue-01.png
(left image is default game window resolution, right image is maximized game window)

Full SDL2 game project(including source) can be downloaded below:
http://tetristory.com/Stuff/TetriCrisis/Source/TC4T-WinLinux-Retail2.zip
(download has Windows EXE built and makefile to build on any Linux)

A Quick Look At The Text Rendering Code Is Below:
https://pastebin.com/gbLnxjur

Any help would be appreciated.
Thanks!

Jesse

Hi Again…

Putting a:
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" );
in the sources makes the text look better, but still not perfect?(see screenshot below)
http://tetristory.com/Stuff/TetriCrisis/Images/TC4T-SDL2_TTF-Issue-02.png
(text should have black outline, not the grey shown above)

Any ideas?
Thanks!

Jesse

Try adding this before your first call to SDL_CreateTextureFromSurface():

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");

Edit: I see you have already tried that. If it does not improve the quality sufficiently you will need to re-render the text at the larger font size required by the maximized window.

Hi,

Changing:
TTF_RenderText_Blended
to
TTF_RenderText_Solid
Made the text a little better.

http://tetristory.com/Stuff/TetriCrisis/Images/TC4T-SDL2_TTF-Issue-03.png

Thanks!

Jesse