Rename num_font_atlases to len. (#9879)
# Objective Rename the `num_font_atlases` method of `FontAtlasSet` to `len`. All the function does is return the number of entries in its hashmap and the unnatural naming only makes it harder to discover. --- ## Changelog * Renamed the `num_font_atlases` method of `FontAtlasSet` to `len`. ## Migration Guide The `num_font_atlases` method of `FontAtlasSet` has been renamed to `len`.
This commit is contained in:
parent
e07c427dea
commit
9873c9745b
@ -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()
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ impl GlyphBrush {
|
|||||||
|
|
||||||
if !text_settings.allow_dynamic_font_size
|
if !text_settings.allow_dynamic_font_size
|
||||||
&& !font_atlas_warning.warned
|
&& !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());
|
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;
|
font_atlas_warning.warned = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user