From d67518e3834e612fc673d7b0e837d10a6bf92683 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:24:55 +0900 Subject: [PATCH] Update fonts.rs --- crates/epaint/src/text/fonts.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index df583c96727..7eaff1c8875 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -620,10 +620,11 @@ impl FontsImpl { /// Get the right font implementation from size and [`FontFamily`]. pub fn font(&mut self, font_id: &FontId) -> &mut Font { - let FontId { size, family } = font_id; + let FontId { mut size, family } = font_id; + size = size.at_least(0.1).at_most(2048.0); self.sized_family - .entry((OrderedFloat(*size), family.clone())) + .entry((OrderedFloat(size), family.clone())) .or_insert_with(|| { let fonts = &self.definitions.families.get(family); let fonts = fonts @@ -631,7 +632,7 @@ impl FontsImpl { let fonts: Vec> = fonts .iter() - .map(|font_name| self.font_impl_cache.font_impl(*size, font_name)) + .map(|font_name| self.font_impl_cache.font_impl(size, font_name)) .collect(); Font::new(fonts)