mirror of
https://github.com/bevyengine/bevy.git
synced 2026-06-30 15:55:32 -04:00
b4e74debc8
# Objective Add font weight support. ## Solution * New `FontWeight` struct that newtypes a `u16`. * New `font: FontWeight` field on `TextFont`. * The weight attribute for the cosmic text buffer is set in `TextPipeline` during text updates. * Added a new font asset, `MonSans-VariableFont.ttf`. This needs a variable font for testing. # Doesn't support `lighter` and `bolder` as that would require text style inheritance, which we don't support yet. I added stretch and slant as well, but split them off from this PR. Swash only has limited variable-font support and there's no way to demonstrate that they work without other changes. ## Testing Added a basic example: ```cargo run --example font_weights``` ## Showcase <img width="671" height="845" alt="font_weights" src="https://github.com/user-attachments/assets/8a8686ac-faa8-442c-89d4-f56348a7e788" /> --------- Co-authored-by: Thierry Berger <contact@thierryberger.com>