Don't update the text buffer in `text_system`
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_infotoTextPipeline. This method updates the givenTextLayoutInfowithout performing any shaping. - Call
update_text_layout_infoinstead ofqueue_textfromtext_system. - Only query for
TextFont, instead of the fullTextUiReader.
The next step is to remove TextPipeline::queue_text. I didn't do that here as it's a fairly large refactor and I have a bunch of other open text PRs I'd like to get merged first.
Testing
yellow = this PR, red = main
cargo run --example many_glyphs --release --features trace_tracy,debug -- --no-text2d --recompute-text
cargo run --example many_buttons --release --features trace_tracy,debug -- --text --respawn
Makes sense to me. Thanks for including the traces, seems like a pretty big win.
The benchmark is very synthetic, most applications aren't going to redraw multiple pages of text every frame, so it's not nearly so exciting in practice unfortunately. I've got a couple more PRs to come though, everything together should add up to a nice improvement.