From 28cc618fcdff3993a080db420931ae83d9327da6 Mon Sep 17 00:00:00 2001 From: Xavier Vargas Date: Fri, 4 Nov 2022 20:21:54 -0700 Subject: [PATCH 1/2] allow for dynamic font sizes --- examples/ui/ui_scaling.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/ui/ui_scaling.rs b/examples/ui/ui_scaling.rs index e2b6d1468a463..008a992060a19 100644 --- a/examples/ui/ui_scaling.rs +++ b/examples/ui/ui_scaling.rs @@ -1,6 +1,6 @@ //! This example illustrates the [`UIScale`] resource from `bevy_ui`. -use bevy::{prelude::*, utils::Duration}; +use bevy::{prelude::*, text::TextSettings, utils::Duration}; const SCALE_TIME: u64 = 400; @@ -10,6 +10,10 @@ struct ApplyScaling; fn main() { App::new() .add_plugins(DefaultPlugins) + .insert_resource(TextSettings { + allow_dynamic_font_size: true, + ..default() + }) .insert_resource(TargetScale { start_scale: 1.0, target_scale: 1.0, From c00161f301848dc5ec674218c52eb16bee543fb0 Mon Sep 17 00:00:00 2001 From: Xavier Vargas Date: Fri, 4 Nov 2022 20:22:42 -0700 Subject: [PATCH 2/2] Expand error text to be more descriptive on potential causes --- crates/bevy_text/src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_text/src/error.rs b/crates/bevy_text/src/error.rs index bf6e4e774cc47..bf45a1129ed9c 100644 --- a/crates/bevy_text/src/error.rs +++ b/crates/bevy_text/src/error.rs @@ -7,6 +7,6 @@ pub enum TextError { NoSuchFont, #[error("failed to add glyph to newly-created atlas {0:?}")] FailedToAddGlyph(GlyphId), - #[error("exceeded {0:?} available TextAltases for font. This can be caused by using an excessive number of font sizes. If you are changing font sizes dynamically consider using Transform::scale to modify the size. If you need more font sizes modify TextSettings.max_font_atlases." )] + #[error("exceeded {0:?} available TextAltases for font. This can be caused by using an excessive number of font sizes or ui scaling. If you are changing font sizes or ui scaling dynamically consider using Transform::scale to modify the size. If you need more font sizes modify TextSettings.max_font_atlases." )] ExceedMaxTextAtlases(usize), }