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)
This commit is contained in:
Tero Laxström 2024-09-17 02:14:37 +03:00 committed by GitHub
parent cf5afecd9f
commit 522d82b21a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 82 additions and 88 deletions

View file

@ -36,7 +36,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let font = asset_server.load("fonts/FiraSans-Bold.ttf"); let font = asset_server.load("fonts/FiraSans-Bold.ttf");
let text_style = TextStyle { let text_style = TextStyle {
font: font.clone(), font: font.clone(),
font_size: 60.0, font_size: 50.0,
..default() ..default()
}; };
let text_justification = JustifyText::Center; let text_justification = JustifyText::Center;
@ -72,7 +72,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// Demonstrate text wrapping // Demonstrate text wrapping
let slightly_smaller_text_style = TextStyle { let slightly_smaller_text_style = TextStyle {
font, font,
font_size: 42.0, font_size: 35.0,
..default() ..default()
}; };
let box_size = Vec2::new(300.0, 200.0); let box_size = Vec2::new(300.0, 200.0);

View file

@ -123,7 +123,7 @@ fn setup(
// padding label text style // padding label text style
let text_style: TextStyle = TextStyle { let text_style: TextStyle = TextStyle {
font: font.clone(), font: font.clone(),
font_size: 50.0, font_size: 42.0,
..default() ..default()
}; };
@ -172,7 +172,7 @@ fn setup(
// label text style // label text style
let sampling_label_style = TextStyle { let sampling_label_style = TextStyle {
font, font,
font_size: 30.0, font_size: 25.0,
..default() ..default()
}; };

View file

@ -344,7 +344,7 @@ fn add_text<'a>(
label, label,
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 18.0, font_size: 15.0,
color, color,
}, },
)) ))

View file

@ -42,7 +42,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextBundle::from_section( TextBundle::from_section(
"", "",
TextStyle { TextStyle {
font_size: 18., font_size: 15.,
..default() ..default()
}, },
) )

View file

@ -66,7 +66,7 @@ fn setup(
TextBundle::from_section( TextBundle::from_section(
"Perceptual Roughness", "Perceptual Roughness",
TextStyle { TextStyle {
font_size: 36.0, font_size: 30.0,
..default() ..default()
}, },
) )
@ -82,7 +82,7 @@ fn setup(
text: Text::from_section( text: Text::from_section(
"Metallic", "Metallic",
TextStyle { TextStyle {
font_size: 36.0, font_size: 30.0,
..default() ..default()
}, },
), ),
@ -103,7 +103,7 @@ fn setup(
TextBundle::from_section( TextBundle::from_section(
"Loading Environment Map...", "Loading Environment Map...",
TextStyle { TextStyle {
font_size: 36.0, font_size: 30.0,
..default() ..default()
}, },
) )

View file

@ -186,7 +186,7 @@ fn setup_ui(mut commands: Commands) {
sections: vec![TextSection { sections: vec![TextSection {
value: "Loading...".to_owned(), value: "Loading...".to_owned(),
style: TextStyle { style: TextStyle {
font_size: 64.0, font_size: 53.0,
color: Color::BLACK, color: Color::BLACK,
..Default::default() ..Default::default()
}, },

View file

@ -229,10 +229,7 @@ fn spawn_text(mut commands: Commands) {
"Press arrow up to decrease the FOV of the world model.\n", "Press arrow up to decrease the FOV of the world model.\n",
"Press arrow down to increase the FOV of the world model." "Press arrow down to increase the FOV of the world model."
), ),
TextStyle { TextStyle::default(),
font_size: 25.0,
..default()
},
)); ));
}); });
} }

View file

@ -13,7 +13,7 @@ fn main() {
config: FpsOverlayConfig { config: FpsOverlayConfig {
text_config: TextStyle { text_config: TextStyle {
// Here we define size of our overlay // Here we define size of our overlay
font_size: 50.0, font_size: 42.0,
// We can also change color of the overlay // We can also change color of the overlay
color: Color::srgb(0.0, 1.0, 0.0), color: Color::srgb(0.0, 1.0, 0.0),
// If we want, we can use a custom font // If we want, we can use a custom font
@ -49,10 +49,7 @@ fn setup(mut commands: Commands) {
"Press 1 to change color of the overlay.\n", "Press 1 to change color of the overlay.\n",
"Press 2 to change size of the overlay." "Press 2 to change size of the overlay."
), ),
TextStyle { TextStyle::default(),
font_size: 25.0,
..default()
},
)); ));
}); });
} }

View file

@ -180,7 +180,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
TextBundle::from_section( TextBundle::from_section(
"Score:", "Score:",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.5, 0.5, 1.0), color: Color::srgb(0.5, 0.5, 1.0),
..default() ..default()
}, },
@ -414,7 +414,7 @@ fn display_score(mut commands: Commands, game: Res<Game>) {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
format!("Cake eaten: {}", game.cake_eaten), format!("Cake eaten: {}", game.cake_eaten),
TextStyle { TextStyle {
font_size: 80.0, font_size: 67.0,
color: Color::srgb(0.5, 0.5, 1.0), color: Color::srgb(0.5, 0.5, 1.0),
..default() ..default()
}, },

View file

@ -40,7 +40,7 @@ const GAP_BETWEEN_BRICKS: f32 = 5.0;
const GAP_BETWEEN_BRICKS_AND_CEILING: f32 = 20.0; const GAP_BETWEEN_BRICKS_AND_CEILING: f32 = 20.0;
const GAP_BETWEEN_BRICKS_AND_SIDES: f32 = 20.0; const GAP_BETWEEN_BRICKS_AND_SIDES: f32 = 20.0;
const SCOREBOARD_FONT_SIZE: f32 = 40.0; const SCOREBOARD_FONT_SIZE: f32 = 33.0;
const SCOREBOARD_TEXT_PADDING: Val = Val::Px(5.0); const SCOREBOARD_TEXT_PADDING: Val = Val::Px(5.0);
const BACKGROUND_COLOR: Color = Color::srgb(0.9, 0.9, 0.9); const BACKGROUND_COLOR: Color = Color::srgb(0.9, 0.9, 0.9);

View file

@ -110,7 +110,7 @@ fn setup(
let font = asset_server.load("fonts/FiraSans-Bold.ttf"); let font = asset_server.load("fonts/FiraSans-Bold.ttf");
let text_style = TextStyle { let text_style = TextStyle {
font: font.clone(), font: font.clone(),
font_size: 30.0, font_size: 25.0,
..default() ..default()
}; };
commands.spawn(( commands.spawn((

View file

@ -179,7 +179,7 @@ mod game {
TextBundle::from_section( TextBundle::from_section(
"Will be back to the menu shortly...", "Will be back to the menu shortly...",
TextStyle { TextStyle {
font_size: 80.0, font_size: 67.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}, },
@ -194,7 +194,7 @@ mod game {
TextSection::new( TextSection::new(
format!("quality: {:?}", *display_quality), format!("quality: {:?}", *display_quality),
TextStyle { TextStyle {
font_size: 60.0, font_size: 50.0,
color: BLUE.into(), color: BLUE.into(),
..default() ..default()
}, },
@ -202,7 +202,7 @@ mod game {
TextSection::new( TextSection::new(
" - ", " - ",
TextStyle { TextStyle {
font_size: 60.0, font_size: 50.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}, },
@ -210,7 +210,7 @@ mod game {
TextSection::new( TextSection::new(
format!("volume: {:?}", *volume), format!("volume: {:?}", *volume),
TextStyle { TextStyle {
font_size: 60.0, font_size: 50.0,
color: LIME.into(), color: LIME.into(),
..default() ..default()
}, },
@ -401,7 +401,7 @@ mod menu {
..default() ..default()
}; };
let button_text_style = TextStyle { let button_text_style = TextStyle {
font_size: 40.0, font_size: 33.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}; };
@ -437,7 +437,7 @@ mod menu {
TextBundle::from_section( TextBundle::from_section(
"Bevy Game Menu UI", "Bevy Game Menu UI",
TextStyle { TextStyle {
font_size: 80.0, font_size: 67.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}, },
@ -527,7 +527,7 @@ mod menu {
}; };
let button_text_style = TextStyle { let button_text_style = TextStyle {
font_size: 40.0, font_size: 33.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}; };
@ -593,7 +593,7 @@ mod menu {
..default() ..default()
}; };
let button_text_style = TextStyle { let button_text_style = TextStyle {
font_size: 40.0, font_size: 33.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}; };
@ -697,7 +697,7 @@ mod menu {
..default() ..default()
}; };
let button_text_style = TextStyle { let button_text_style = TextStyle {
font_size: 40.0, font_size: 33.0,
color: TEXT_COLOR, color: TEXT_COLOR,
..default() ..default()
}; };

View file

@ -78,7 +78,7 @@ fn setup(mut commands: Commands) {
// Spawns the UI that will show the user prompts. // Spawns the UI that will show the user prompts.
let text_style = TextStyle { let text_style = TextStyle {
font_size: 50.0, font_size: 42.0,
..default() ..default()
}; };
commands commands
@ -266,7 +266,7 @@ struct LoadingScreen;
// Spawns the necessary components for the loading screen. // Spawns the necessary components for the loading screen.
fn load_loading_screen(mut commands: Commands) { fn load_loading_screen(mut commands: Commands) {
let text_style = TextStyle { let text_style = TextStyle {
font_size: 80.0, font_size: 67.0,
..default() ..default()
}; };

View file

@ -193,7 +193,7 @@ fn build_stepping_hint(mut commands: Commands) {
commands.spawn((TextBundle::from_sections([TextSection::new( commands.spawn((TextBundle::from_sections([TextSection::new(
hint_text, hint_text,
TextStyle { TextStyle {
font_size: 18.0, font_size: 15.0,
color: FONT_COLOR, color: FONT_COLOR,
..default() ..default()
}, },

View file

@ -153,7 +153,7 @@ fn infotext_system(mut commands: Commands) {
TextBundle::from_section( TextBundle::from_section(
"Nothing to see in this window! Check the console output!", "Nothing to see in this window! Check the console output!",
TextStyle { TextStyle {
font_size: 50.0, font_size: 42.0,
..default() ..default()
}, },
) )

View file

@ -371,7 +371,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Play", "Play",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },
@ -403,7 +403,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Tutorial", "Tutorial",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },
@ -504,7 +504,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Paused", "Paused",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },
@ -536,7 +536,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"TURBO MODE", "TURBO MODE",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.3, 0.1), color: Color::srgb(0.9, 0.3, 0.1),
..default() ..default()
}, },
@ -578,7 +578,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Move the bevy logo with the arrow keys", "Move the bevy logo with the arrow keys",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.3, 0.3, 0.7), color: Color::srgb(0.3, 0.3, 0.7),
..default() ..default()
}, },
@ -586,7 +586,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Press T to enter TURBO MODE", "Press T to enter TURBO MODE",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.3, 0.3, 0.7), color: Color::srgb(0.3, 0.3, 0.7),
..default() ..default()
}, },
@ -595,7 +595,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Press SPACE to pause", "Press SPACE to pause",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.3, 0.3, 0.7), color: Color::srgb(0.3, 0.3, 0.7),
..default() ..default()
}, },
@ -604,7 +604,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Press ESCAPE to return to the menu", "Press ESCAPE to return to the menu",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.3, 0.3, 0.7), color: Color::srgb(0.3, 0.3, 0.7),
..default() ..default()
}, },
@ -635,7 +635,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Press SPACE to resume", "Press SPACE to resume",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.3, 0.3, 0.7), color: Color::srgb(0.3, 0.3, 0.7),
..default() ..default()
}, },
@ -644,7 +644,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Press ESCAPE to return to the menu", "Press ESCAPE to return to the menu",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.3, 0.3, 0.7), color: Color::srgb(0.3, 0.3, 0.7),
..default() ..default()
}, },

View file

@ -276,7 +276,7 @@ fn setup_menu(mut commands: Commands) {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Play", "Play",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },

View file

@ -81,7 +81,7 @@ fn setup_menu(mut commands: Commands) {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Play", "Play",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },

View file

@ -186,7 +186,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Play", "Play",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },
@ -241,7 +241,7 @@ mod ui {
parent.spawn(TextBundle::from_section( parent.spawn(TextBundle::from_section(
"Paused", "Paused",
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
..default() ..default()
}, },

View file

@ -80,7 +80,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut time: ResMu
)); ));
// info UI // info UI
let font_size = 40.; let font_size = 33.;
commands commands
.spawn(NodeBundle { .spawn(NodeBundle {

View file

@ -311,7 +311,7 @@ fn setup_sticks(
}); });
// text // text
let style = TextStyle { let style = TextStyle {
font_size: 16., font_size: 13.,
..default() ..default()
}; };
parent.spawn(( parent.spawn((
@ -392,7 +392,7 @@ fn setup_triggers(
text: Text::from_section( text: Text::from_section(
format!("{:.3}", 0.), format!("{:.3}", 0.),
TextStyle { TextStyle {
font_size: 16., font_size: 13.,
..default() ..default()
}, },
), ),

View file

@ -87,7 +87,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Button", "Button",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
}, },
)); ));

View file

@ -100,7 +100,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut state: ResM
"a", "a",
TextStyle { TextStyle {
font: font_handle, font: font_handle,
font_size: 60.0, font_size: 50.0,
color: YELLOW.into(), color: YELLOW.into(),
}, },
)); ));

View file

@ -147,7 +147,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res<AssetServer>) {
"A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely.", "A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely.",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 16.0, font_size: 13.0,
..default() ..default()
}, },
)); ));

View file

@ -166,7 +166,7 @@ fn spawn_text(
"Bevy", "Bevy",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 120.0, font_size: 100.0,
..default() ..default()
}, },
)); ));

View file

@ -59,7 +59,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"(0.0, 0.0)", "(0.0, 0.0)",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
}, },
), ),

View file

@ -44,7 +44,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
}; };

View file

@ -37,7 +37,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
// This font is loaded and will be used instead of the default font. // 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: 80.0, font_size: 67.0,
..default() ..default()
}, },
) // Set the justification of the Text ) // Set the justification of the Text
@ -61,13 +61,13 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
// This font is loaded and will be used instead of the default font. // 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: 50.0, font_size: 42.0,
..default() ..default()
}, },
), ),
TextSection::from_style(if cfg!(feature = "default_font") { TextSection::from_style(if cfg!(feature = "default_font") {
TextStyle { TextStyle {
font_size: 40.0, font_size: 33.0,
color: GOLD.into(), color: GOLD.into(),
// If no font is specified, the default font (a minimal subset of FiraMono) will be used. // If no font is specified, the default font (a minimal subset of FiraMono) will be used.
..default() ..default()
@ -76,7 +76,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// "default_font" feature is unavailable, load a font to use instead. // "default_font" feature is unavailable, load a font to use instead.
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"), font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 40.0, font_size: 33.0,
color: GOLD.into(), color: GOLD.into(),
} }
}), }),

View file

@ -60,7 +60,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"This is\ntext with\nline breaks\nin the top left.", "This is\ntext with\nline breaks\nin the top left.",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 30.0, font_size: 25.0,
..default() ..default()
}, },
) )
@ -68,7 +68,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
builder.spawn(TextBundle::from_section( builder.spawn(TextBundle::from_section(
"This text is right-justified. The `JustifyText` component controls the horizontal alignment of the lines of multi-line text relative to each other, and does not affect the text node's position in the UI layout.", TextStyle { "This text is right-justified. The `JustifyText` component controls the horizontal alignment of the lines of multi-line text relative to each other, and does not affect the text node's position in the UI layout.", TextStyle {
font: font.clone(), font: font.clone(),
font_size: 30.0, font_size: 25.0,
color: YELLOW.into(), color: YELLOW.into(),
}, },
) )
@ -83,7 +83,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"This\ntext has\nline breaks and also a set width in the bottom left.", "This\ntext has\nline breaks and also a set width in the bottom left.",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 30.0, font_size: 25.0,
..default() ..default()
}, },
) )
@ -110,7 +110,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"This text is very long, has a limited width, is center-justified, is positioned in the top right and is also colored pink.", "This text is very long, has a limited width, is center-justified, is positioned in the top right and is also colored pink.",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.8, 0.2, 0.7), color: Color::srgb(0.8, 0.2, 0.7),
}, },
) )
@ -126,7 +126,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"This text is left-justified and is vertically positioned to distribute the empty space equally above and below it.", "This text is left-justified and is vertically positioned to distribute the empty space equally above and below it.",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 35.0, font_size: 29.0,
color: YELLOW.into(), color: YELLOW.into(),
}, },
) )
@ -142,7 +142,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"This text is fully justified and is positioned in the same way.", "This text is fully justified and is positioned in the same way.",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 35.0, font_size: 29.0,
color: GREEN_YELLOW.into(), color: GREEN_YELLOW.into(),
}, },
) )
@ -159,7 +159,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"", "",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 25.0, font_size: 21.0,
..default() ..default()
}, },
), ),
@ -167,7 +167,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"\nThis text changes in the bottom right", "\nThis text changes in the bottom right",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 25.0, font_size: 21.0,
..default() ..default()
}, },
), ),
@ -183,33 +183,33 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
"\nThis text changes in the bottom right - ", "\nThis text changes in the bottom right - ",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 25.0, font_size: 21.0,
color: RED.into(), color: RED.into(),
}, },
), ),
TextSection::from_style(TextStyle { TextSection::from_style(TextStyle {
font: font.clone(), font: font.clone(),
font_size: 25.0, font_size: 21.0,
color: ORANGE_RED.into(), color: ORANGE_RED.into(),
}), }),
TextSection::new( TextSection::new(
" fps, ", " fps, ",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 12.0, font_size: 10.0,
color: YELLOW.into(), color: YELLOW.into(),
}, },
), ),
TextSection::from_style(TextStyle { TextSection::from_style(TextStyle {
font: font.clone(), font: font.clone(),
font_size: 25.0, font_size: 21.0,
color: LIME.into(), color: LIME.into(),
}), }),
TextSection::new( TextSection::new(
" ms/frame", " ms/frame",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 50.0, font_size: 42.0,
color: BLUE.into(), color: BLUE.into(),
}, },
), ),
@ -217,7 +217,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
" this text has negative fontsize", " this text has negative fontsize",
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: -50.0, font_size: -42.0,
color: BLUE.into(), color: BLUE.into(),
}, },
), ),

View file

@ -50,7 +50,7 @@ fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 14.0, font_size: 12.0,
..default() ..default()
}; };

View file

@ -45,7 +45,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Button 1", "Button 1",
TextStyle { TextStyle {
font: font_handle.clone(), font: font_handle.clone(),
font_size: 40.0, font_size: 33.0,
// Alpha channel of the color controls transparency. // Alpha channel of the color controls transparency.
color: Color::srgba(1.0, 1.0, 1.0, 0.2), color: Color::srgba(1.0, 1.0, 1.0, 0.2),
}, },
@ -71,7 +71,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Button 2", "Button 2",
TextStyle { TextStyle {
font: font_handle.clone(), font: font_handle.clone(),
font_size: 40.0, font_size: 33.0,
// Alpha channel of the color controls transparency. // Alpha channel of the color controls transparency.
color: Color::srgba(1.0, 1.0, 1.0, 0.2), color: Color::srgba(1.0, 1.0, 1.0, 0.2),
}, },

View file

@ -76,7 +76,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Text Example", "Text Example",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 30.0, font_size: 25.0,
..default() ..default()
}, },
), ),
@ -132,7 +132,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Scrolling list", "Scrolling list",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 25., font_size: 21.,
..default() ..default()
}, },
), ),

View file

@ -24,7 +24,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default()); commands.spawn(Camera2dBundle::default());
let text_style = TextStyle { let text_style = TextStyle {
font_size: 16., font_size: 13.,
color: Color::BLACK, color: Color::BLACK,
..default() ..default()
}; };

View file

@ -106,7 +106,7 @@ fn setup(
"Button", "Button",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
}, },
)); ));

View file

@ -90,7 +90,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Button", "Button",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0, font_size: 33.0,
color: Color::srgb(0.9, 0.9, 0.9), color: Color::srgb(0.9, 0.9, 0.9),
}, },
)); ));

View file

@ -33,7 +33,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
"Hit 'P' then scroll/click around!", "Hit 'P' then scroll/click around!",
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 100.0, // Nice and big so you can see it! font_size: 83.0, // Nice and big so you can see it!
..default() ..default()
}, },
) )

View file

@ -56,7 +56,7 @@ fn setup(mut commands: Commands) {
TextBundle::from_section( TextBundle::from_section(
"Example text", "Example text",
TextStyle { TextStyle {
font_size: 30.0, font_size: 25.0,
..default() ..default()
}, },
) )

View file

@ -48,7 +48,7 @@ fn setup_ui(mut commands: Commands) {
TextBundle::from_section( TextBundle::from_section(
"Resolution", "Resolution",
TextStyle { TextStyle {
font_size: 50.0, font_size: 42.0,
..default() ..default()
}, },
), ),