mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Add assert messages and print bad argument values in asserts (#5216)
Enabled the `missing_assert_message` lint * [x] I have followed the instructions in the PR template --------- Co-authored-by: Lucas Meurer <lucasmeurer96@gmail.com>
This commit is contained in:
@@ -91,8 +91,14 @@ impl FontImpl {
|
||||
scale_in_pixels: f32,
|
||||
tweak: FontTweak,
|
||||
) -> Self {
|
||||
assert!(scale_in_pixels > 0.0);
|
||||
assert!(pixels_per_point > 0.0);
|
||||
assert!(
|
||||
scale_in_pixels > 0.0,
|
||||
"scale_in_pixels is smaller than 0, got: {scale_in_pixels:?}"
|
||||
);
|
||||
assert!(
|
||||
pixels_per_point > 0.0,
|
||||
"pixels_per_point must be greater than 0, got: {pixels_per_point:?}"
|
||||
);
|
||||
|
||||
use ab_glyph::{Font, ScaleFont};
|
||||
let scaled = ab_glyph_font.as_scaled(scale_in_pixels);
|
||||
@@ -264,7 +270,7 @@ impl FontImpl {
|
||||
}
|
||||
|
||||
fn allocate_glyph(&self, glyph_id: ab_glyph::GlyphId) -> GlyphInfo {
|
||||
assert!(glyph_id.0 != 0);
|
||||
assert!(glyph_id.0 != 0, "Can't allocate glyph for id 0");
|
||||
use ab_glyph::{Font as _, ScaleFont};
|
||||
|
||||
let glyph = glyph_id.with_scale_and_position(
|
||||
|
||||
Reference in New Issue
Block a user