HomeWildfire Games

Fix text alignment handling of spaces around wrapping.
AuditedrP26915

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
Stan raised a concern with this commit.Aug 22 2022, 2:31 PM
Stan added a subscriber: Stan.

Before the patch


After the patch

This commit now has outstanding concerns.Aug 22 2022, 2:32 PM

What menu is that?

phosit added a subscriber: phosit.Aug 22 2022, 4:29 PM

What menu is that?

settings > options
in russian

phosit added inline comments.Aug 22 2022, 9:39 PM
/ps/trunk/source/gui/CGUIText.cpp
207

removing the change from this line does fix it but it's not a good solution.

Stan accepted this commit.Aug 30 2022, 7:49 PM
All concerns with this commit have now been addressed.Aug 30 2022, 7:49 PM
phosit raised a concern with this commit.Sep 28 2022, 10:41 AM

Valgrind reports uninitialized reads. m_EndsWithSpace is sometimes not initialized.

This commit now has outstanding concerns.Sep 28 2022, 10:41 AM
phosit accepted this commit.Oct 22 2022, 8:31 PM
All concerns with this commit have now been addressed.Oct 22 2022, 8:31 PM