Skip to content

Commit 522d82b

Browse files
authored
Fixing text sizes for examples (#15190)
# Objective - Fixes #14265 ## Solution - Go through Pixel Eagle examples (and examples all in all) - If default size is used it is usually left there - If size of font is touched try dividing with 1.2 and round it to nearest whole number ## Testing - Run example before and after - Make sure examples text are readable or like before cosmic-text change --- ## Showcase Before: ![image](https://github.com/user-attachments/assets/beb2d5af-d1ee-4c2c-89c4-8e59c53b53b4) After: ![image](https://github.com/user-attachments/assets/fef28a8d-dc26-4e0e-9870-6b216de906e8)
1 parent cf5afec commit 522d82b

38 files changed

+82
-88
lines changed

examples/2d/text2d.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
3636
let font = asset_server.load("fonts/FiraSans-Bold.ttf");
3737
let text_style = TextStyle {
3838
font: font.clone(),
39-
font_size: 60.0,
39+
font_size: 50.0,
4040
..default()
4141
};
4242
let text_justification = JustifyText::Center;
@@ -72,7 +72,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
7272
// Demonstrate text wrapping
7373
let slightly_smaller_text_style = TextStyle {
7474
font,
75-
font_size: 42.0,
75+
font_size: 35.0,
7676
..default()
7777
};
7878
let box_size = Vec2::new(300.0, 200.0);

examples/2d/texture_atlas.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn setup(
123123
// padding label text style
124124
let text_style: TextStyle = TextStyle {
125125
font: font.clone(),
126-
font_size: 50.0,
126+
font_size: 42.0,
127127
..default()
128128
};
129129

@@ -172,7 +172,7 @@ fn setup(
172172
// label text style
173173
let sampling_label_style = TextStyle {
174174
font,
175-
font_size: 30.0,
175+
font_size: 25.0,
176176
..default()
177177
};
178178

examples/3d/color_grading.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ fn add_text<'a>(
344344
label,
345345
TextStyle {
346346
font: font.clone(),
347-
font_size: 18.0,
347+
font_size: 15.0,
348348
color,
349349
},
350350
))

examples/3d/load_gltf_extras.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
4242
TextBundle::from_section(
4343
"",
4444
TextStyle {
45-
font_size: 18.,
45+
font_size: 15.,
4646
..default()
4747
},
4848
)

examples/3d/pbr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn setup(
6666
TextBundle::from_section(
6767
"Perceptual Roughness",
6868
TextStyle {
69-
font_size: 36.0,
69+
font_size: 30.0,
7070
..default()
7171
},
7272
)
@@ -82,7 +82,7 @@ fn setup(
8282
text: Text::from_section(
8383
"Metallic",
8484
TextStyle {
85-
font_size: 36.0,
85+
font_size: 30.0,
8686
..default()
8787
},
8888
),
@@ -103,7 +103,7 @@ fn setup(
103103
TextBundle::from_section(
104104
"Loading Environment Map...",
105105
TextStyle {
106-
font_size: 36.0,
106+
font_size: 30.0,
107107
..default()
108108
},
109109
)

examples/asset/multi_asset_sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn setup_ui(mut commands: Commands) {
186186
sections: vec![TextSection {
187187
value: "Loading...".to_owned(),
188188
style: TextStyle {
189-
font_size: 64.0,
189+
font_size: 53.0,
190190
color: Color::BLACK,
191191
..Default::default()
192192
},

examples/camera/first_person_view_model.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,7 @@ fn spawn_text(mut commands: Commands) {
229229
"Press arrow up to decrease the FOV of the world model.\n",
230230
"Press arrow down to increase the FOV of the world model."
231231
),
232-
TextStyle {
233-
font_size: 25.0,
234-
..default()
235-
},
232+
TextStyle::default(),
236233
));
237234
});
238235
}

examples/dev_tools/fps_overlay.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() {
1313
config: FpsOverlayConfig {
1414
text_config: TextStyle {
1515
// Here we define size of our overlay
16-
font_size: 50.0,
16+
font_size: 42.0,
1717
// We can also change color of the overlay
1818
color: Color::srgb(0.0, 1.0, 0.0),
1919
// If we want, we can use a custom font
@@ -49,10 +49,7 @@ fn setup(mut commands: Commands) {
4949
"Press 1 to change color of the overlay.\n",
5050
"Press 2 to change size of the overlay."
5151
),
52-
TextStyle {
53-
font_size: 25.0,
54-
..default()
55-
},
52+
TextStyle::default(),
5653
));
5754
});
5855
}

examples/games/alien_cake_addict.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
180180
TextBundle::from_section(
181181
"Score:",
182182
TextStyle {
183-
font_size: 40.0,
183+
font_size: 33.0,
184184
color: Color::srgb(0.5, 0.5, 1.0),
185185
..default()
186186
},
@@ -414,7 +414,7 @@ fn display_score(mut commands: Commands, game: Res<Game>) {
414414
parent.spawn(TextBundle::from_section(
415415
format!("Cake eaten: {}", game.cake_eaten),
416416
TextStyle {
417-
font_size: 80.0,
417+
font_size: 67.0,
418418
color: Color::srgb(0.5, 0.5, 1.0),
419419
..default()
420420
},

examples/games/breakout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const GAP_BETWEEN_BRICKS: f32 = 5.0;
4040
const GAP_BETWEEN_BRICKS_AND_CEILING: f32 = 20.0;
4141
const GAP_BETWEEN_BRICKS_AND_SIDES: f32 = 20.0;
4242

43-
const SCOREBOARD_FONT_SIZE: f32 = 40.0;
43+
const SCOREBOARD_FONT_SIZE: f32 = 33.0;
4444
const SCOREBOARD_TEXT_PADDING: Val = Val::Px(5.0);
4545

4646
const BACKGROUND_COLOR: Color = Color::srgb(0.9, 0.9, 0.9);

examples/games/desk_toy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn setup(
110110
let font = asset_server.load("fonts/FiraSans-Bold.ttf");
111111
let text_style = TextStyle {
112112
font: font.clone(),
113-
font_size: 30.0,
113+
font_size: 25.0,
114114
..default()
115115
};
116116
commands.spawn((

examples/games/game_menu.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ mod game {
179179
TextBundle::from_section(
180180
"Will be back to the menu shortly...",
181181
TextStyle {
182-
font_size: 80.0,
182+
font_size: 67.0,
183183
color: TEXT_COLOR,
184184
..default()
185185
},
@@ -194,23 +194,23 @@ mod game {
194194
TextSection::new(
195195
format!("quality: {:?}", *display_quality),
196196
TextStyle {
197-
font_size: 60.0,
197+
font_size: 50.0,
198198
color: BLUE.into(),
199199
..default()
200200
},
201201
),
202202
TextSection::new(
203203
" - ",
204204
TextStyle {
205-
font_size: 60.0,
205+
font_size: 50.0,
206206
color: TEXT_COLOR,
207207
..default()
208208
},
209209
),
210210
TextSection::new(
211211
format!("volume: {:?}", *volume),
212212
TextStyle {
213-
font_size: 60.0,
213+
font_size: 50.0,
214214
color: LIME.into(),
215215
..default()
216216
},
@@ -401,7 +401,7 @@ mod menu {
401401
..default()
402402
};
403403
let button_text_style = TextStyle {
404-
font_size: 40.0,
404+
font_size: 33.0,
405405
color: TEXT_COLOR,
406406
..default()
407407
};
@@ -437,7 +437,7 @@ mod menu {
437437
TextBundle::from_section(
438438
"Bevy Game Menu UI",
439439
TextStyle {
440-
font_size: 80.0,
440+
font_size: 67.0,
441441
color: TEXT_COLOR,
442442
..default()
443443
},
@@ -527,7 +527,7 @@ mod menu {
527527
};
528528

529529
let button_text_style = TextStyle {
530-
font_size: 40.0,
530+
font_size: 33.0,
531531
color: TEXT_COLOR,
532532
..default()
533533
};
@@ -593,7 +593,7 @@ mod menu {
593593
..default()
594594
};
595595
let button_text_style = TextStyle {
596-
font_size: 40.0,
596+
font_size: 33.0,
597597
color: TEXT_COLOR,
598598
..default()
599599
};
@@ -697,7 +697,7 @@ mod menu {
697697
..default()
698698
};
699699
let button_text_style = TextStyle {
700-
font_size: 40.0,
700+
font_size: 33.0,
701701
color: TEXT_COLOR,
702702
..default()
703703
};

examples/games/loading_screen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn setup(mut commands: Commands) {
7878

7979
// Spawns the UI that will show the user prompts.
8080
let text_style = TextStyle {
81-
font_size: 50.0,
81+
font_size: 42.0,
8282
..default()
8383
};
8484
commands
@@ -266,7 +266,7 @@ struct LoadingScreen;
266266
// Spawns the necessary components for the loading screen.
267267
fn load_loading_screen(mut commands: Commands) {
268268
let text_style = TextStyle {
269-
font_size: 80.0,
269+
font_size: 67.0,
270270
..default()
271271
};
272272

examples/games/stepping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn build_stepping_hint(mut commands: Commands) {
193193
commands.spawn((TextBundle::from_sections([TextSection::new(
194194
hint_text,
195195
TextStyle {
196-
font_size: 18.0,
196+
font_size: 15.0,
197197
color: FONT_COLOR,
198198
..default()
199199
},

examples/scene/scene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn infotext_system(mut commands: Commands) {
153153
TextBundle::from_section(
154154
"Nothing to see in this window! Check the console output!",
155155
TextStyle {
156-
font_size: 50.0,
156+
font_size: 42.0,
157157
..default()
158158
},
159159
)

examples/state/computed_states.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ mod ui {
371371
parent.spawn(TextBundle::from_section(
372372
"Play",
373373
TextStyle {
374-
font_size: 40.0,
374+
font_size: 33.0,
375375
color: Color::srgb(0.9, 0.9, 0.9),
376376
..default()
377377
},
@@ -403,7 +403,7 @@ mod ui {
403403
parent.spawn(TextBundle::from_section(
404404
"Tutorial",
405405
TextStyle {
406-
font_size: 40.0,
406+
font_size: 33.0,
407407
color: Color::srgb(0.9, 0.9, 0.9),
408408
..default()
409409
},
@@ -504,7 +504,7 @@ mod ui {
504504
parent.spawn(TextBundle::from_section(
505505
"Paused",
506506
TextStyle {
507-
font_size: 40.0,
507+
font_size: 33.0,
508508
color: Color::srgb(0.9, 0.9, 0.9),
509509
..default()
510510
},
@@ -536,7 +536,7 @@ mod ui {
536536
parent.spawn(TextBundle::from_section(
537537
"TURBO MODE",
538538
TextStyle {
539-
font_size: 40.0,
539+
font_size: 33.0,
540540
color: Color::srgb(0.9, 0.3, 0.1),
541541
..default()
542542
},
@@ -578,15 +578,15 @@ mod ui {
578578
parent.spawn(TextBundle::from_section(
579579
"Move the bevy logo with the arrow keys",
580580
TextStyle {
581-
font_size: 40.0,
581+
font_size: 33.0,
582582
color: Color::srgb(0.3, 0.3, 0.7),
583583
..default()
584584
},
585585
));
586586
parent.spawn(TextBundle::from_section(
587587
"Press T to enter TURBO MODE",
588588
TextStyle {
589-
font_size: 40.0,
589+
font_size: 33.0,
590590
color: Color::srgb(0.3, 0.3, 0.7),
591591
..default()
592592
},
@@ -595,7 +595,7 @@ mod ui {
595595
parent.spawn(TextBundle::from_section(
596596
"Press SPACE to pause",
597597
TextStyle {
598-
font_size: 40.0,
598+
font_size: 33.0,
599599
color: Color::srgb(0.3, 0.3, 0.7),
600600
..default()
601601
},
@@ -604,7 +604,7 @@ mod ui {
604604
parent.spawn(TextBundle::from_section(
605605
"Press ESCAPE to return to the menu",
606606
TextStyle {
607-
font_size: 40.0,
607+
font_size: 33.0,
608608
color: Color::srgb(0.3, 0.3, 0.7),
609609
..default()
610610
},
@@ -635,7 +635,7 @@ mod ui {
635635
parent.spawn(TextBundle::from_section(
636636
"Press SPACE to resume",
637637
TextStyle {
638-
font_size: 40.0,
638+
font_size: 33.0,
639639
color: Color::srgb(0.3, 0.3, 0.7),
640640
..default()
641641
},
@@ -644,7 +644,7 @@ mod ui {
644644
parent.spawn(TextBundle::from_section(
645645
"Press ESCAPE to return to the menu",
646646
TextStyle {
647-
font_size: 40.0,
647+
font_size: 33.0,
648648
color: Color::srgb(0.3, 0.3, 0.7),
649649
..default()
650650
},

examples/state/custom_transitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fn setup_menu(mut commands: Commands) {
276276
parent.spawn(TextBundle::from_section(
277277
"Play",
278278
TextStyle {
279-
font_size: 40.0,
279+
font_size: 33.0,
280280
color: Color::srgb(0.9, 0.9, 0.9),
281281
..default()
282282
},

examples/state/states.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn setup_menu(mut commands: Commands) {
8181
parent.spawn(TextBundle::from_section(
8282
"Play",
8383
TextStyle {
84-
font_size: 40.0,
84+
font_size: 33.0,
8585
color: Color::srgb(0.9, 0.9, 0.9),
8686
..default()
8787
},

0 commit comments

Comments
 (0)