Skip to content

Commit 8883529

Browse files
committed
use DefaultFont in text example
1 parent ace79bd commit 8883529

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/ui/text.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
use bevy::{
77
diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin},
88
prelude::*,
9+
text::DefaultFont,
910
};
1011

1112
fn main() {
1213
App::new()
1314
.add_plugins(DefaultPlugins)
1415
.add_plugin(FrameTimeDiagnosticsPlugin::default())
16+
.insert_resource(DefaultFont {
17+
// Configure a default font that will be applied to all text node without a specified font
18+
path: Some("fonts/FiraMono-Medium.ttf".into()),
19+
})
1520
.add_startup_system(setup)
1621
.add_system(text_update_system)
1722
.add_system(text_color_system)
@@ -70,7 +75,8 @@ fn setup(mut commands: Commands) {
7075
},
7176
),
7277
TextSection::from_style(TextStyle {
73-
font: "fonts/FiraMono-Medium.ttf".into(),
78+
// Use the default font instead of manually specifying a font
79+
font: default(),
7480
font_size: 60.0,
7581
color: Color::GOLD,
7682
}),

0 commit comments

Comments
 (0)