Skip to content

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Oct 25, 2025

Objective

Follow up to the underline and strikethrough PRs:

  • Replace the quintuples stored in TextLayoutInfo::section_geometry with a struct with named fields.
  • Rename TextLayoutInfo::section_geometry because "section" in our terminology implies a one-to-one correspondence with text entities.
  • Add some basic helpers to construct the underline and strikethrough lines.
  • Seperate the thickness values for underline and strikethrough. This is needed for an API that allows users to set custom thicknesses.

Solution

  • New struct RunGeometry. RunGeometry holds the bounds and decoration geometry for each text run (a contiguous sequence of glyphs on a line that share text attributes). It has helper methods for placing underline and strikethrough.
  • Rename the section_geometry field to run_geometry and make it a Vec<RunGeometry>
  • RunGeometry has seperate underline_thickness and strikethrough_thickness values.

… store each run's bounds and decoration geometry.

Renamed `TextLayoutInfo::section_geometry` to `TextLayoutInfo::run_geometry`.
@ickshonpe ickshonpe added A-Text Rendering and layout for characters D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Oct 25, 2025
@alice-i-cecile alice-i-cecile added this to the 0.18 milestone Oct 25, 2025
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change, but do we need a migration guide? I intend to get this shipped for 0.18, and I'm not sure that the field existed back in 0.17 🤔

Copy link
Contributor

@DaAlbrecht DaAlbrecht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea the migration guide is not needed imo, this field did not exist: https://docs.rs/bevy/latest/bevy/text/struct.TextLayoutInfo.html

@ickshonpe
Copy link
Contributor Author

ickshonpe commented Oct 27, 2025

I like the change, but do we need a migration guide? I intend to get this shipped for 0.18, and I'm not sure that the field existed back in 0.17 🤔

I think we do a migration guide, but it needs a correction as the field was named section_rects in 0.17

@github-actions
Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-21656

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 29, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Oct 29, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 29, 2025
Merged via the queue into bevyengine:main with commit f2bbf8f Oct 29, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Text Rendering and layout for characters C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples 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.

3 participants