-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Update cosmic-text to 0.16 #22308
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
Update cosmic-text to 0.16 #22308
Conversation
This is mapped to cosmic-text's indentical `Hinting` enum. `Text` requires `FontHinting::Enabled`, `Text2d` requires `FontHinting::Disabled`.
|
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. |
# Objective Update the Cosmic Text dependency to 0.16. Fixes #22191 ## Solution There aren't any breaking changes with Cosmic Text version 0.16, but it does add font-hinting support. This is controlled in Bevy with a new component `FontHinting`. The `Text` component, which is normally used with physical pixel aligned text, now requires `FontHinting::Enabled`, and `Text2d`, which normally isn't pixel aligned, now requires `FontHinting::Disabled`. Hinting needs to be set per text block, not per text span entity, so it wouldn't be appropriate to add it as a field on `TextFont`. ## Testing `testbed_ui`'s text scene in main with cosmic-text 15: <img width="1924" height="1127" alt="cosmic-15" src="https://github.com/user-attachments/assets/0ee44e38-07b0-411b-9102-b7d28de0ffcd" /> The font names are meant to be rendered in their corresponding fonts but, as you can see, some names are rendered using the incorrect font. This is due to the ascii fastpath bug in cosmic-text 15, which is fixed in 16. `testbed_ui`'s text scene on this branch with cosmic-text 16: <img width="1924" height="1127" alt="cosmic-16" src="https://github.com/user-attachments/assets/549f9a21-e24d-422d-a9e2-eac902b2e054" /> Now each font's name is rendered using the correct font.
Objective
Update the Cosmic Text dependency to 0.16.
Fixes #22191
Solution
There aren't any breaking changes with Cosmic Text version 0.16, but it does add font-hinting support. This is controlled in Bevy with a new component
FontHinting. TheTextcomponent, which is normally used with physical pixel aligned text, now requiresFontHinting::Enabled, andText2d, which normally isn't pixel aligned, now requiresFontHinting::Disabled. Hinting needs to be set per text block, not per text span entity, so it wouldn't be appropriate to add it as a field onTextFont.Testing
testbed_ui's text scene in main with cosmic-text 15:The font names are meant to be rendered in their corresponding fonts but, as you can see, some names are rendered using the incorrect font. This is due to the ascii fastpath bug in cosmic-text 15, which is fixed in 16.
testbed_ui's text scene on this branch with cosmic-text 16:Now each font's name is rendered using the correct font.