HomeWildfire Games

Fix text alignment handling of spaces around wrapping.

Description

Fix text alignment handling of spaces around wrapping.

Follows rP26889.

There is an issue with text-wrapping and word separators (aka spaces).
Because 0 A.D. collates the space after a word to the same TextCall, we occasionally need to ignore it when considering line-wrapping, because we don't want empty spaces on the right-side of right-aligned text.
However, the logic to handle this is currently broken and inconsistent.

The method introduced here uses the SFeedback structure to properly report it and generalises the checks.

Note that multiples spaces are not collapsed in 0 A.D., and for consistency the word-separator-collapsing behaviour is ignored.

Comments by: phosit, vlasdislavbelov

Fixes #6551

Differential Revision: https://code.wildfiregames.com/D4662

Event Timeline

vladislavbelov added inline comments.
/ps/trunk/source/gui/tests/test_CGUIText.h
37

g_VFS isn't included, broke PCH.

vladislavbelov added inline comments.Jun 3 2022, 6:31 PM
/ps/trunk/source/gui/tests/test_CGUIText.h
69

g_ScriptContext is also undefined.

Stan raised a concern with this commit.Jun 3 2022, 9:15 PM
This commit now has outstanding concerns.Jun 3 2022, 9:15 PM

Probably won't have time to fix it until Monday FYI

Stan resigned from this commit.Jun 6 2022, 11:48 PM
This commit no longer requires audit.Jun 6 2022, 11:48 PM