Skip to content

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Nov 28, 2025

Objective

Text is shaped in measure_text_system. When the schedule reaches text_system there's no need to reupdate the cosmic-text buffer a second time. text_system should only be updating any stale TextLayoutInfo components.

Solution

  • Add a new method update_text_layout_info to TextPipeline. This method updates the given TextLayoutInfo without performing any shaping.
  • Call update_text_layout_info instead of queue_text from text_system.
  • Only query for TextFont, instead of the full TextUiReader.

There are some more changes that seem desirable, the glyph info updates should probably be done in measure_system for instance, but I'll leave those for followup PRs.

Testing

yellow = this PR, red = main

cargo run --example many_glyphs --release --features trace_tracy,debug -- --no-text2d --recompute-text
Screenshot 2025-11-28 130411
cargo run --example many_buttons --release --features trace_tracy,debug -- --text --respawn
Screenshot 2025-11-28 145240

@ickshonpe ickshonpe added C-Performance A change motivated by improving speed, memory usage or compile times A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 28, 2025
- Replaced `TextReader` param with a query for `TextFont`
- Instead of pushing the span info and then retrieving it again with last_mut, push it at the end of the loop.
- Removed `Entity` from `text_system`'s `text_query`.
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 A-UI Graphical user interfaces, styles, layouts, and widgets C-Performance A change motivated by improving speed, memory usage or compile times D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant