From d041be1062edc4a6aa1a1c3453db26edf213b474 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Fri, 19 Dec 2025 14:09:48 +0000 Subject: [PATCH 1/5] added more text cases to testbed_ui's text scene --- examples/testbed/ui.rs | 206 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index edba5ce0803bc..6bd48ab8a8310 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -237,6 +237,212 @@ mod text { TextSpan::new(""), ], )); + commands.spawn(( + Node { + left: px(100.), + top: px(400.), + ..Default::default() + }, + Text::new("FiraSans_"), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 40., + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("MonaSans_"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + ..default() + } + ), + ( + TextSpan::new("EBGaramond_"), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 40., + ..default() + }, + ), + ( + TextSpan::new("FiraMono"), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 40., + ..default() + }, + ), + ], + )); + commands.spawn(( + Node { + left: px(100.), + top: px(450.), + ..Default::default() + }, + Text::new("FiraSans "), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 40., + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("MonaSans "), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + ..default() + } + ), + ( + TextSpan::new("EBGaramond "), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 40., + ..default() + }, + ), + ( + TextSpan::new("FiraMono"), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 40., + ..default() + }, + ), + ], + )); + + commands.spawn(( + Node { + left: px(100.), + top: px(500.), + ..Default::default() + }, + Text::new("FiraSans "), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 40., + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("MonaSans_"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + ..default() + } + ), + ( + TextSpan::new("EBGaramond_"), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 40., + ..default() + }, + ), + ( + TextSpan::new(" FiraMono "), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 40., + ..default() + }, + ), + ], + )); + + commands.spawn(( + Node { + left: px(100.), + top: px(550.), + ..Default::default() + }, + Text::new("FiraSans"), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 40., + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + TextSpan::new(" "), + ( + TextSpan::new("MonaSans"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + ..default() + } + ), + TextSpan::new(" "), + ( + TextSpan::new("EBGaramond"), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 40., + ..default() + }, + ), + TextSpan::new(" "), + ( + TextSpan::new("FiraMono"), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 40., + ..default() + }, + ), + ], + )); + + commands.spawn(( + Node { + left: px(100.), + top: px(600.), + ..Default::default() + }, + Text::new("Fira Sans_"), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 40., + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("Mona Sans_"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + ..default() + } + ), + ( + TextSpan::new("EB Garamond_"), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 40., + ..default() + }, + ), + ( + TextSpan::new("Fira Mono"), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 40., + ..default() + }, + ), + ], + )); } } From 647708c2d6942497cb79fadd421656feecaf4a9d Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Fri, 19 Dec 2025 14:20:10 +0000 Subject: [PATCH 2/5] Added font weights case --- examples/testbed/ui.rs | 52 +++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index 6bd48ab8a8310..50b7d8108f11d 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -134,7 +134,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(250.), + top: px(230.), ..Default::default() }, Text::new("white "), @@ -162,7 +162,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(300.), + top: px(260.), ..Default::default() }, Text::new(""), @@ -197,7 +197,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(350.), + top: px(290.), ..Default::default() }, Text::new(""), @@ -240,7 +240,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(400.), + top: px(350.), ..Default::default() }, Text::new("FiraSans_"), @@ -280,7 +280,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(450.), + top: px(400.), ..Default::default() }, Text::new("FiraSans "), @@ -321,7 +321,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(500.), + top: px(450.), ..Default::default() }, Text::new("FiraSans "), @@ -362,7 +362,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(550.), + top: px(500.), ..Default::default() }, Text::new("FiraSans"), @@ -406,7 +406,7 @@ mod text { commands.spawn(( Node { left: px(100.), - top: px(600.), + top: px(550.), ..Default::default() }, Text::new("Fira Sans_"), @@ -443,6 +443,42 @@ mod text { ), ], )); + + commands.spawn(( + Node { + left: px(100.), + top: px(600.), + ..Default::default() + }, + Text::new("FontWeight(100)_"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + weight: FontWeight(100), + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("FontWeight(500)_"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + weight: FontWeight(500), + ..default() + } + ), + ( + TextSpan::new("FontWeight(900)"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 40., + weight: FontWeight(900), + ..default() + }, + ), + ], + )); } } From 4c5d788dcc97458dd57e2164cfe4ad8d80c862e7 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Fri, 19 Dec 2025 14:34:00 +0000 Subject: [PATCH 3/5] Remove space in one case --- examples/testbed/ui.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index 50b7d8108f11d..091466b45cc44 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -341,7 +341,7 @@ mod text { } ), ( - TextSpan::new("EBGaramond_"), + TextSpan::new("EBGaramond "), TextFont { font: asset_server.load("fonts/EBGaramond12-Regular.otf"), font_size: 40., @@ -349,7 +349,7 @@ mod text { }, ), ( - TextSpan::new(" FiraMono "), + TextSpan::new("FiraMono"), TextFont { font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 40., From d397af2ae5025544407734c608e7486e99436f88 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Fri, 19 Dec 2025 14:52:26 +0000 Subject: [PATCH 4/5] Reformat, add another weight test case. --- examples/testbed/ui.rs | 114 ++++++++++++++++++++++++++++++----------- 1 file changed, 84 insertions(+), 30 deletions(-) diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index 091466b45cc44..04755ea728d0e 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -194,10 +194,11 @@ mod text { ], )); + let mut top = 300.; commands.spawn(( Node { left: px(100.), - top: px(290.), + top: px(top), ..Default::default() }, Text::new(""), @@ -237,16 +238,18 @@ mod text { TextSpan::new(""), ], )); + + top += 35.; commands.spawn(( Node { left: px(100.), - top: px(350.), + top: px(top), ..Default::default() }, Text::new("FiraSans_"), TextFont { font: asset_server.load("fonts/FiraSans-Bold.ttf"), - font_size: 40., + font_size: 25., ..default() }, DespawnOnExit(super::Scene::Text), @@ -255,7 +258,7 @@ mod text { TextSpan::new("MonaSans_"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., ..default() } ), @@ -263,7 +266,7 @@ mod text { TextSpan::new("EBGaramond_"), TextFont { font: asset_server.load("fonts/EBGaramond12-Regular.otf"), - font_size: 40., + font_size: 25., ..default() }, ), @@ -271,22 +274,23 @@ mod text { TextSpan::new("FiraMono"), TextFont { font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 40., + font_size: 25., ..default() }, ), ], )); + top += 35.; commands.spawn(( Node { left: px(100.), - top: px(400.), + top: px(top), ..Default::default() }, Text::new("FiraSans "), TextFont { font: asset_server.load("fonts/FiraSans-Bold.ttf"), - font_size: 40., + font_size: 25., ..default() }, DespawnOnExit(super::Scene::Text), @@ -295,7 +299,7 @@ mod text { TextSpan::new("MonaSans "), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., ..default() } ), @@ -303,7 +307,7 @@ mod text { TextSpan::new("EBGaramond "), TextFont { font: asset_server.load("fonts/EBGaramond12-Regular.otf"), - font_size: 40., + font_size: 25., ..default() }, ), @@ -311,23 +315,24 @@ mod text { TextSpan::new("FiraMono"), TextFont { font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 40., + font_size: 25., ..default() }, ), ], )); + top += 35.; commands.spawn(( Node { left: px(100.), - top: px(450.), + top: px(top), ..Default::default() }, Text::new("FiraSans "), TextFont { font: asset_server.load("fonts/FiraSans-Bold.ttf"), - font_size: 40., + font_size: 25., ..default() }, DespawnOnExit(super::Scene::Text), @@ -336,7 +341,7 @@ mod text { TextSpan::new("MonaSans_"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., ..default() } ), @@ -344,7 +349,7 @@ mod text { TextSpan::new("EBGaramond "), TextFont { font: asset_server.load("fonts/EBGaramond12-Regular.otf"), - font_size: 40., + font_size: 25., ..default() }, ), @@ -352,23 +357,24 @@ mod text { TextSpan::new("FiraMono"), TextFont { font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 40., + font_size: 25., ..default() }, ), ], )); + top += 35.; commands.spawn(( Node { left: px(100.), - top: px(500.), + top: px(top), ..Default::default() }, Text::new("FiraSans"), TextFont { font: asset_server.load("fonts/FiraSans-Bold.ttf"), - font_size: 40., + font_size: 25., ..default() }, DespawnOnExit(super::Scene::Text), @@ -378,7 +384,7 @@ mod text { TextSpan::new("MonaSans"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., ..default() } ), @@ -387,7 +393,7 @@ mod text { TextSpan::new("EBGaramond"), TextFont { font: asset_server.load("fonts/EBGaramond12-Regular.otf"), - font_size: 40., + font_size: 25., ..default() }, ), @@ -396,23 +402,24 @@ mod text { TextSpan::new("FiraMono"), TextFont { font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 40., + font_size: 25., ..default() }, ), ], )); + top += 35.; commands.spawn(( Node { left: px(100.), - top: px(550.), + top: px(top), ..Default::default() }, Text::new("Fira Sans_"), TextFont { font: asset_server.load("fonts/FiraSans-Bold.ttf"), - font_size: 40., + font_size: 25., ..default() }, DespawnOnExit(super::Scene::Text), @@ -421,7 +428,7 @@ mod text { TextSpan::new("Mona Sans_"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., ..default() } ), @@ -429,7 +436,7 @@ mod text { TextSpan::new("EB Garamond_"), TextFont { font: asset_server.load("fonts/EBGaramond12-Regular.otf"), - font_size: 40., + font_size: 25., ..default() }, ), @@ -437,23 +444,24 @@ mod text { TextSpan::new("Fira Mono"), TextFont { font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 40., + font_size: 25., ..default() }, ), ], )); + top += 35.; commands.spawn(( Node { left: px(100.), - top: px(600.), + top: px(top), ..Default::default() }, Text::new("FontWeight(100)_"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., weight: FontWeight(100), ..default() }, @@ -463,7 +471,7 @@ mod text { TextSpan::new("FontWeight(500)_"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., weight: FontWeight(500), ..default() } @@ -472,13 +480,59 @@ mod text { TextSpan::new("FontWeight(900)"), TextFont { font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), - font_size: 40., + font_size: 25., weight: FontWeight(900), ..default() }, ), ], )); + + top += 35.; + commands.spawn(( + Node { + left: px(100.), + top: px(top), + ..Default::default() + }, + Text::new("FiraSans_"), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 25., + weight: FontWeight(900), + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("MonaSans_"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 25., + weight: FontWeight(700), + ..default() + } + ), + ( + TextSpan::new("EBGaramond_"), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 25., + weight: FontWeight(500), + ..default() + }, + ), + ( + TextSpan::new("FiraMono"), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 25., + weight: FontWeight(300), + ..default() + }, + ), + ], + )); } } From 65fca842b9a8c1e415963aee61582a1189dd0571 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Fri, 19 Dec 2025 19:21:00 +0000 Subject: [PATCH 5/5] add a test case to text scene with tabs --- examples/testbed/ui.rs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index 04755ea728d0e..5aebbab3420fa 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -533,6 +533,48 @@ mod text { ), ], )); + + top += 35.; + commands.spawn(( + Node { + left: px(100.), + top: px(top), + ..Default::default() + }, + Text::new("FiraSans\t"), + TextFont { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 25., + ..default() + }, + DespawnOnExit(super::Scene::Text), + children![ + ( + TextSpan::new("MonaSans\t"), + TextFont { + font: asset_server.load("fonts/MonaSans-VariableFont.ttf"), + font_size: 25., + ..default() + } + ), + ( + TextSpan::new("EBGaramond\t"), + TextFont { + font: asset_server.load("fonts/EBGaramond12-Regular.otf"), + font_size: 25., + ..default() + }, + ), + ( + TextSpan::new("FiraMono"), + TextFont { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: 25., + ..default() + }, + ), + ], + )); } }