From 0506e773b835b9eb1086ad5b3711fa511c6c726f Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 17 Mar 2024 20:04:16 +0100 Subject: [PATCH] use chinese font ZCOOLQingKeHuangYou-Regular.ttf --- .gitignore | 3 +-- src/hud.rs | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 7fe30d4..b6b279f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ target -assets/raw -assets/restricted +assets/tmp diff --git a/src/hud.rs b/src/hud.rs index 7c811d2..54a2340 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -20,6 +20,7 @@ struct FPSUpdateTimer(Timer); fn setup( mut commands: Commands, settings: Res, + asset_server: Res, ) { let visibility = if settings.ar_active { Visibility::Inherited @@ -28,28 +29,23 @@ fn setup( }; let mut bundle_fps = TextBundle::from_sections([ TextSection::new( - "FPS: ", + "帧率 ", TextStyle { - //font: asset_server.load("fonts/FiraSans-Bold.ttf"), - font_size: 30.0, + font: asset_server.load("tmp/fonts/ZCOOLQingKeHuangYou-Regular.ttf"), + font_size: 50.0, + color: Color::GRAY, ..default() }, ), - TextSection::from_style(if cfg!(feature = "default_font") { + TextSection::new( + "", TextStyle { - font_size: 30.0, - color: Color::GOLD, + font: asset_server.load("tmp/fonts/ZCOOLQingKeHuangYou-Regular.ttf"), + font_size: 50.0, + color: Color::GRAY, ..default() } - } else { - // "default_font" feature is unavailable, load a font to use instead. - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 30.0, - color: Color::GOLD, - ..default() - } - }), + ), ]); bundle_fps.visibility = visibility; commands.spawn((