Skip to content

Font lists#24378

Open
ickshonpe wants to merge 19 commits into
bevyengine:mainfrom
ickshonpe:font-lists
Open

Font lists#24378
ickshonpe wants to merge 19 commits into
bevyengine:mainfrom
ickshonpe:font-lists

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented May 21, 2026

Objective

Add FontSource variants 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.

  • New FontSource variants Css and List. bevy_text uses the first available font in the list.
    • FontSource::Css takes a string in CSS font family format.
    • FontSource::List takes a vector of family names and generic font families.
  • New FontSource::Generic(GenericFontFamily) enum replaces the individual variants for each generic family. Included short form constructors such as FontSource::serif() to be used instead of FontSource::Generic(GenericFontFamily::Serif).
  • Updated the font queries in 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.
  • New FontFamilyEntry and GenericFontFamily enums, these just exist to be Bevy friendly types that are mapped internally to Parley's FontFamilyName and GenericFamily types.

Testing

New example font_lists:

cargo run --example font_lists
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:

cargo run --example font_lists --features="system_font_discovery"
font_lists_system

@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-24378

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.

@kfc35 kfc35 added C-Feature A new feature, making something new possible A-Text Rendering and layout for characters S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 21, 2026
@ickshonpe ickshonpe added the D-Straightforward Simple bug fixes and API improvements, docs, test and examples label May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-24378

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
@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-24378

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.

@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-24378

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.

ickshonpe added 4 commits May 22, 2026 15:04
…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.
@github-actions
Copy link
Copy Markdown
Contributor

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!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-24378

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.

@ickshonpe ickshonpe added the M-Deliberate-Rendering-Change An intentional change to how tests and examples are rendered label May 22, 2026
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 C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Deliberate-Rendering-Change An intentional change to how tests and examples are rendered S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants