Skip to content

Conversation

dsgallups
Copy link
Contributor

@dsgallups dsgallups commented Oct 5, 2025

Objective

I was working on this and noticed a superior implementation in #16365. However, I am unsure of the general consensus on loading system fonts. This PR uses the existing Font asset to query the system directly for fonts.

Solution

  • Update Font to include a Font::System variant.
  • Update TextPlugin to include a load_system_fonts parameter

Testing

  • In terms of testing, this can vary wildly across platforms. Would like some advice on a general approach to satisfy the runners. I'm unsure what they've got haha
  • examples/system_fonts

Showcase

A font can be added with with the new Font::System variant:

let font: Handle<Font> = fonts.add(Font::System {
    families: vec![
        Family::Name("Liberation Sans".to_string()),
        Family::Name("Ubuntu".to_string()),
        Family::Name("Noto Sans".to_string()),
    ],
    weight: Weight::NORMAL,
    stretch: Stretch::Normal,
    style: Style::Normal,
});

Note

I would love to enable System Fonts through this PR or via #16365. Please let me know what I need to do to make this possible!

@dsgallups
Copy link
Contributor Author

Just found #14150 as well. I'm going to address the feedback there since my implementation appears pretty similar.

@dsgallups dsgallups force-pushed the dsgallups/system-fonts branch from 3dc0093 to 9a134a4 Compare October 5, 2025 12:02
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds A-Text Rendering and layout for characters M-Needs-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 5, 2025
Copy link
Contributor

github-actions bot commented Oct 5, 2025

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.

@alice-i-cecile alice-i-cecile added this to the 0.18 milestone Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Text Rendering and layout for characters M-Needs-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support using system fonts
2 participants