libsdl-org / SDL_ttf

Support for TrueType (.ttf) font files with Simple Directmedia Layer.
zlib License
343 stars 116 forks source link

Text is shifted off-center when wrapped using TTF_WRAPPED_ALIGN_CENTER #350

Open Marmotus opened 3 months ago

Marmotus commented 3 months ago

Hello! I've been enjoying my time using SDL a bunch and just noticed something that is causing me a slight issue. It seems like spaces are left over when text is wrapped, causing the text to be shifted a bit off-center. I've attached two images that hopefully demonstrate what I mean. The first one is when the text is too short to wrap, and the second one is when the text has been wrapped.

Example 1

Example 2

Would it be possible to change this behavior to trim trailing spaces like that?

Thank you all for the great library, by the way. 🙏😁

slouken commented 3 months ago

Yep!