diff --git a/epaint/src/text/fonts.rs b/epaint/src/text/fonts.rs index f35f57c0..b69300b7 100644 --- a/epaint/src/text/fonts.rs +++ b/epaint/src/text/fonts.rs @@ -184,6 +184,12 @@ pub struct Fonts { impl Fonts { pub fn from_definitions(pixels_per_point: f32, definitions: FontDefinitions) -> Self { + assert!( + 0.0 < pixels_per_point && pixels_per_point < 100.0, + "pixels_per_point out of range: {}", + pixels_per_point + ); + // We want an atlas big enough to be able to include all the Emojis in the `TextStyle::Heading`, // so we can show the Emoji picker demo window. let mut atlas = TextureAtlas::new(2048, 64); diff --git a/epaint/src/texture_atlas.rs b/epaint/src/texture_atlas.rs index a1d114c1..1b3e1e36 100644 --- a/epaint/src/texture_atlas.rs +++ b/epaint/src/texture_atlas.rs @@ -82,7 +82,12 @@ impl TextureAtlas { /// On modern high-precision GPUs this is not needed. const PADDING: usize = 1; - assert!(w <= self.texture.width); + assert!( + w <= self.texture.width, + "Tried to allocate a {} wide glyph in a {} wide texture atlas", + w, + self.texture.width + ); if self.cursor.0 + w > self.texture.width { // New row: self.cursor.0 = 0;