From dfe462b0198206dc8bb6d9112681183642be7f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Tue, 25 Jul 2023 02:35:14 +0800 Subject: [PATCH] Update text example using default font (#9259) # Objective - Fixes https://github.com/bevyengine/bevy/issues/9233 --- examples/ui/text.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/ui/text.rs b/examples/ui/text.rs index ccc44f5095039..6db570f19c048 100644 --- a/examples/ui/text.rs +++ b/examples/ui/text.rs @@ -34,6 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res) { // 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, @@ -56,15 +57,17 @@ fn setup(mut commands: Commands, asset_server: Res) { 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,