diff --git a/crates/bevy_text/src/font_atlas_set.rs b/crates/bevy_text/src/font_atlas_set.rs index d4c2c9f5073ad..f0ca798d8934b 100644 --- a/crates/bevy_text/src/font_atlas_set.rs +++ b/crates/bevy_text/src/font_atlas_set.rs @@ -153,7 +153,13 @@ impl FontAtlasSet { }) } - pub fn num_font_atlases(&self) -> usize { + /// Returns the number of font atlases in this set + pub fn len(&self) -> usize { self.font_atlases.len() } + + /// Returns `true` if the font atlas set contains no elements + pub fn is_empty(&self) -> bool { + self.font_atlases.is_empty() + } } diff --git a/crates/bevy_text/src/glyph_brush.rs b/crates/bevy_text/src/glyph_brush.rs index 61a837303a26c..fe1e2d7203a1b 100644 --- a/crates/bevy_text/src/glyph_brush.rs +++ b/crates/bevy_text/src/glyph_brush.rs @@ -114,7 +114,7 @@ impl GlyphBrush { if !text_settings.allow_dynamic_font_size && !font_atlas_warning.warned - && font_atlas_set.num_font_atlases() > text_settings.max_font_atlases.get() + && font_atlas_set.len() > text_settings.max_font_atlases.get() { warn!("warning[B0005]: Number of font atlases has exceeded the maximum of {}. Performance and memory usage may suffer.", text_settings.max_font_atlases.get()); font_atlas_warning.warned = true;