Misaligned text inside UI
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
`0.15.0`
## What you did
Text inside button nodes are vertically unbalanced, despite setting `JustifyContent` and `AlignItems` correctly:

I'm using this font: https://poppyworks.itch.io/silver, a free font used in many popular games.
Here's a reproduction repo: https://github.com/musjj/bevy-font-bug
Here's the entire code:
```rust
use bevy::{prelude::*, text::FontSmoothing};
fn main() -> AppExit {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup_ui)
.run()
}
fn setup_ui(mut commands: Commands, asset_server: Res) {
commands.spawn((Camera2d, UiAntiAlias::Off));
commands
.spawn(Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
})
.with_children(|parent| {
parent
.spawn((
Button,
Node {
width: Val::Px(90.0),
height: Val::Px(28.0),
border: UiRect::all(Val::Px(2.0)),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
BorderColor(Color::WHITE),
BorderRadius::MAX,
BackgroundColor(Color::BLACK),
))
.with_child((
Text::new("Hello World"),
TextFont {
font: asset_server.load("Silver.ttf"),
font_size: 19.0,
font_smoothing: FontSmoothing::None,
},
TextColor(Color::WHITE),
));
});
}
```
## What went wrong
Text inside button nodes are not vertically aligned.
If there are any short-term solutions to this, please do let me know 🙂
Contributor guide
Assessment
This issue has not been assessed yet.