Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextTextureRenderer: Fix word wrap behavior that regressed in 2.10.0 #489

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

frank-weindel
Copy link
Contributor

@frank-weindel frank-weindel commented Jun 6, 2023

Behavior has been reverted back to pre-2.10.0 behavior while retaining the zero-width space functionality.

  • Moves textWrap() and measureText() methods to TextRendererUtils
    • Tests for both with the ability to mock up the C2D context version of measureText()
    • All direct context calls to measure text have been changed to use the util method.
    • The unit tests for textWrap() were originally written to pass for the original implementation prior to adding back the zero-width space functionality (plus a test for that)
  • Removes splitWords()
  • Moves tokenize() implementation for advanced renderer to TextRendererUtils w/ unit test

Todo

  • Implement
  • Unit tests
  • Integration test

Fixes

@frank-weindel frank-weindel changed the title TextTextureRenderer: Fix word wrap behavior that was regressed in 2.10.0 TextTextureRenderer: Fix word wrap behavior that regressed in 2.10.0 Jun 6, 2023
@frank-weindel
Copy link
Contributor Author

frank-weindel commented Jun 7, 2023

Test visually comparing 2.9 to this PR (2.10-new) showing that the original word wrap behavior is restored.

There is a difference when wordWrapWidth is set to 0, but this is due to #470 because the default maximum text texture width was changed from 2048 / 1 (Precision) = 2048 to 1920 (actual rendered pixel width of canvas). When the wordWrapWidth is set to 0, it automatically takes on the maximum texture width so that really long text will eventually break onto another line.

L2-Core-Text-Wrap-Fix-PR-489-test.mp4

@uguraslan uguraslan linked an issue Jun 19, 2023 that may be closed by this pull request
@erikhaandrikman erikhaandrikman changed the base branch from master to dev June 20, 2023 15:37
@uguraslan uguraslan added this to the July 2023 release milestone Jun 28, 2023
@frank-weindel frank-weindel merged commit e1fbd1a into dev Jun 28, 2023
@uguraslan uguraslan mentioned this pull request Jul 12, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression with rendering text that uses normal spaces
4 participants