Font lists#24378
Conversation
…to the font assets. When FontSource resolution failed because an asset wasn't yet loaded, `update_editable_text_styles` didn't resolve the FontSource again the next frame.
|
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. |
|
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. |
2 similar comments
|
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. |
|
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. |
…he loaded collection, instead of the asset path. Store the changed family ids and asset paths, and set the any TextFonts that refer to them as changed.
|
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
Add
FontSourcevariants to support ordered lists of fonts.Solution
The changes are mostly just boilerplate implementing the API. The lists are just handed off to Parley to resolve.
FontSourcevariantsCssandList.bevy_textuses the first available font in the list.FontSource::Csstakes a string in CSS font family format.FontSource::Listtakes a vector of family names and generic font families.FontSource::Generic(GenericFontFamily)enum replaces the individual variants for each generic family. Included short form constructors such asFontSource::serif()to be used instead ofFontSource::Generic(GenericFontFamily::Serif).update_editable_text_content_size. That function is a bit unpleasant now but I'm not sure if there's a nicer alternative to what it does.FontFamilyEntryandGenericFontFamilyenums, these just exist to be Bevy friendly types that are mapped internally to Parley'sFontFamilyNameandGenericFamilytypes.Testing
New example
font_lists:The first available font from the list (going downwards) is used to display each list. The Gabriola font isn't included with Bevy, so it's skipped.
With the "system_font_discovery" feature enabled, the Gabriola font (if present on your system) is used: