Skip to content

Commit

Permalink
Update text example using default font (#9259)
Browse files Browse the repository at this point in the history
# Objective

- Fixes #9233
  • Loading branch information
lewiszlw authored and cart committed Aug 10, 2023
1 parent c0e4950 commit 987d0aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/ui/text.rs
Expand Up @@ -34,6 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// Accepts a `String` or any type that converts into a `String`, such as `&str`
"hello\nbevy!",
TextStyle {
// This font is loaded and will be used instead of the default font.
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 100.0,
color: Color::WHITE,
Expand All @@ -56,15 +57,17 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextSection::new(
"FPS: ",
TextStyle {
// This font is loaded and will be used instead of the default font.
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 60.0,
color: Color::WHITE,
},
),
TextSection::from_style(TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 60.0,
color: Color::GOLD,
// If no font is specified, it will use the default font.
..default()
}),
]),
FpsText,
Expand Down

0 comments on commit 987d0aa

Please sign in to comment.