feather : `InheritableFont` should be overrideable to change font size
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version and features
- Using bevy 0.19.0, with `bevy_feathers` feature.
## What you did
I wanted feather buttons with bigger font, so I tried to override the `InheritableFont` for my button :
```rust
#[derive(SceneComponent, Default, Clone)]
#[scene(MyButtonProps)]
pub struct MyButton;
impl MyButton {
fn scene(props: MyButtonProps) -> impl Scene {
bsn! {
@FeathersButton {
@caption: bsn! { Text({props.label}) }
}
InheritableFont {
font_size: px(32),
weight: FontWeight::SEMIBOLD,
}
BorderColor::all(BUTTON_BORDER_COLOR)
}
}
}
```
## What went wrong
I don't fully understand how `bsn!` macro works, but I supposed that it would patch the `InheritableFont` from `FeathersButton`, but the button text font still use the feather configuration instead of the one I provide.
Using bevy-egui-inspector, I can see that the `InheritableFont` component is correctly set for MyButton. Looking to `\bevy_feathers-0.19.0\src\font_styles.rs`, I can see that the `on_changed_font` system is called only on the insertion of the `InheritableFont` component. So, I suppose that the `bsn!` macro first insert the `InheritableFont` component, and then replace it later. This might be Looking to `\bevy_feathers-0.19.0\src\font_styles.rs`.
Is there a way do change the feather button font ? Is it possible to add an observer to also replace the `Propagate` component on `Replace` ? Or do I have to change the way to create my own button ?
Contributor guide
Research direction
Reproduce the provided `FeathersButton` and `InheritableFont` example, then inspect `bevy_feathers-0.19.0/src/font_styles.rs`, especially the `on_changed_font` system and its handling of component insertion or replacement. Determine how an overridden font should propagate to the button text; done means the example applies the requested 32px semibold font instead of the feather configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100