-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
bevy_text parley migration
#21940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
bevy_text parley migration
#21940
Conversation
…`Collection::register_fonts`.
…with the parley `FontContext`.
Replaced cosmic CacheKey with dummy GlyphCacheKey. New Parley Context wrapper resources `FontCx`, `LayoutCx`. New Swash context wrapper resource `ScaleCx`.
New ComputedTextBlock
…he it to compile.
Updated text2d example
… `FontFeature` list. The `From<&FontFeatures> for Vec<FontFeature>` impl has been removed, instead use the `FontFeatures::as_slice` method to access the list to pass to parley.
…ref, instead of returning a new instance.
|
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
|
It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note. Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes. |
|
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! 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. |
|
Just curious, what is the motivation for switching from cosmic-text to parley? I'm not very familiar with the intricacies of text rendering. |
…pe/bevy into bevy-text-parley-minimal
…h_texture`, and don't do antialiasing if None.
Objective
Minimal-ish
bevy_textmigration from cosmic-text to parley 0.7.Solution
Internally the
bevy_text::pipelinemodule has been completely rewritten.shape_textshapes the text.update_text_layout_infoupdates the glyph geometry for rendering and handles strikethrough and underline.The fields of
TextNodeFlagshave been renamed:needs_measure_fn->needs_shapingneeds_recompute->needs_relayoutThe public builder API is unchanged, but internally
FontFeaturesnow keeps a list of parleyFontFeatures.The
From<&FontFeatures> for cosmic_text::FontFeaturesimplementation has been removed. In its placeFontFeaturesnow has anas_slicemethod that returns a&[FontFeature]slice that can be passed directly to parley.Most of the other APIs and behaviours are unchanged.
Todo
I forgot about text anti-aliasing, support forbevy_text::FontSmoothing::Nonestill needs to be implemented.testbed_ui's text scene shows changes, need to look into why.Been a couple of weeks since I last worked on
bevy_text, so I probably forgot other things well.Testing
The tests and examples all seem to work correctly. Things to check out first would be change detection, malformed text hierarchies, empty text sections, default fonts, and the new-ish features like
FontFeatures(@hansler) andUnderlineandStrikethrough.Performance
yellow - this PR, red - main
For UI text layout is a three stage process
shape_text_systemui_layout_systemlayout_text_systemtext2d doesn't require measurement so there is only one system:
update_text2d_layout. It's slower than with cosmic-text, I'm not sure why. Maybe there is a problem with our cosmic-text text measurement implementation, and cosmic-text itself isn't slow?