Skip to content

Commit 987d0aa

Browse files
lewiszlwcart
authored andcommitted
Update text example using default font (#9259)
# Objective - Fixes #9233
1 parent c0e4950 commit 987d0aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/ui/text.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
3434
// Accepts a `String` or any type that converts into a `String`, such as `&str`
3535
"hello\nbevy!",
3636
TextStyle {
37+
// This font is loaded and will be used instead of the default font.
3738
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
3839
font_size: 100.0,
3940
color: Color::WHITE,
@@ -56,15 +57,17 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
5657
TextSection::new(
5758
"FPS: ",
5859
TextStyle {
60+
// This font is loaded and will be used instead of the default font.
5961
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
6062
font_size: 60.0,
6163
color: Color::WHITE,
6264
},
6365
),
6466
TextSection::from_style(TextStyle {
65-
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
6667
font_size: 60.0,
6768
color: Color::GOLD,
69+
// If no font is specified, it will use the default font.
70+
..default()
6871
}),
6972
]),
7073
FpsText,

0 commit comments

Comments
 (0)