mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
Update text example using default font (#9259)
# Objective - Fixes https://github.com/bevyengine/bevy/issues/9233
This commit is contained in:
parent
c0e4950e80
commit
987d0aa501
1 changed files with 4 additions and 1 deletions
|
@ -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`
|
// Accepts a `String` or any type that converts into a `String`, such as `&str`
|
||||||
"hello\nbevy!",
|
"hello\nbevy!",
|
||||||
TextStyle {
|
TextStyle {
|
||||||
|
// This font is loaded and will be used instead of the default font.
|
||||||
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
|
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
|
||||||
font_size: 100.0,
|
font_size: 100.0,
|
||||||
color: Color::WHITE,
|
color: Color::WHITE,
|
||||||
|
@ -56,15 +57,17 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
TextSection::new(
|
TextSection::new(
|
||||||
"FPS: ",
|
"FPS: ",
|
||||||
TextStyle {
|
TextStyle {
|
||||||
|
// This font is loaded and will be used instead of the default font.
|
||||||
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
|
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
|
||||||
font_size: 60.0,
|
font_size: 60.0,
|
||||||
color: Color::WHITE,
|
color: Color::WHITE,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextSection::from_style(TextStyle {
|
TextSection::from_style(TextStyle {
|
||||||
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
|
|
||||||
font_size: 60.0,
|
font_size: 60.0,
|
||||||
color: Color::GOLD,
|
color: Color::GOLD,
|
||||||
|
// If no font is specified, it will use the default font.
|
||||||
|
..default()
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
FpsText,
|
FpsText,
|
||||||
|
|
Loading…
Reference in a new issue