Skip to content

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Jan 8, 2026

Objective

We don't need to collect the text components into TextPipeline's spans buffer, and then map them to Cosmic Text Attrs later. Instead we can create and collect the Attrs directly.

Solution

  • Store the cosmic text Attrs in TextPipeline::spans_buffer, instead of mapping the collected text components from the spans buffer afterwards.

  • Rename spans_buffer to sections_buffer. "Span" is potentially misleading as the root Text/Text2d's text and attributes are also collected into this buffer, not just the TextSpans.

  • Remove the FontFaceInfo type, as it is no longer used.

Testing

yellow = this PR, red = main 7a436e3

Screenshot 2026-01-08 101028
cargo run --example many_buttons --release --features="trace_tracy","debug" -- --text --recompute-text
many-text2d-update-text2d-layout
cargo run --example many_text2d --release --features="trace_tracy","debug" -- --recompute

…spans_buffer`, instead of mapping the collected text components from the spans buffer afterwards.

Renamed `spans_buffer` to `sections_buffer`, span is potentially misleading as the root `Text`/`Text2d`'s text and attributes are also collected into this buffer, not just the `TextSpan`s.

Removed the `FontFaceInfo` type  as it is no longer used.
@ickshonpe ickshonpe added A-Text Rendering and layout for characters C-Performance A change motivated by improving speed, memory usage or compile times 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-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 8, 2026
@ickshonpe ickshonpe changed the title The Cosmic Text attributes are now stored directly in `TextPipeline::… TextPipeline::update_buffer collect Attrs directly Jan 8, 2026
@alice-i-cecile alice-i-cecile added the X-Uncontroversial This work is generally agreed upon label Jan 8, 2026
@ickshonpe ickshonpe 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 Jan 9, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 10, 2026
Merged via the queue into bevyengine:main with commit e9b1fe3 Jan 10, 2026
38 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 C-Performance A change motivated by improving speed, memory usage or compile times 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 X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants