Skip to content

Fix text measurement algorithm#8425

Merged
alice-i-cecile merged 2 commits intobevyengine:mainfrom
nicoburns:fix/text-measurement-algorithm
Apr 17, 2023
Merged

Fix text measurement algorithm#8425
alice-i-cecile merged 2 commits intobevyengine:mainfrom
nicoburns:fix/text-measurement-algorithm

Conversation

@nicoburns
Copy link
Contributor

@nicoburns nicoburns commented Apr 17, 2023

Objective

Followup to #7779 which tweaks the actual text measurement algorithm to be more robust.

Before:

Screenshot 2023-04-17 at 18 12 05

After:

Screenshot 2023-04-17 at 18 41 40

(note extra space taken up in header in before example)

Solution

  • Text layout of horizontal text (currently the only kind of text we support) is now based solely on the layout constraints in the horizontal axis. It ignores constraints in the vertical axis and computes vertical size based on wrapping subject to the horizontal axis constraints.
  • I've also added a paragraph to the grid example for testing / demo purposes.

@nicoburns nicoburns requested a review from Weibye April 17, 2023 17:45
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets labels Apr 17, 2023
@alice-i-cecile alice-i-cecile added this to the 0.11 milestone Apr 17, 2023
@nicoburns nicoburns force-pushed the fix/text-measurement-algorithm branch from 826b61f to 267e2d4 Compare April 17, 2023 18:10
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 17, 2023
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Apr 17, 2023
Merged via the queue into bevyengine:main with commit 919919c Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants