From 609ba91cc9e4b123bf5f9d3929cbac4fa24065af Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 14 Dec 2022 22:06:40 -0800 Subject: [PATCH] font: clear up some logging --- src/font/sprite/Face.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/font/sprite/Face.zig b/src/font/sprite/Face.zig index 0ce55b288..9a81a298b 100644 --- a/src/font/sprite/Face.zig +++ b/src/font/sprite/Face.zig @@ -21,6 +21,8 @@ const Sprite = font.sprite.Sprite; const Box = @import("Box.zig"); const underline = @import("underline.zig"); +const log = std.log.scoped(.font_sprite); + /// The cell width and height. width: u32, height: u32, @@ -48,7 +50,12 @@ pub fn renderGlyph( atlas: *font.Atlas, cp: u32, ) !font.Glyph { - if (std.debug.runtime_safety) assert(self.hasCodepoint(cp, null)); + if (std.debug.runtime_safety) { + if (!self.hasCodepoint(cp, null)) { + log.err("invalid codepoint cp={x}", .{cp}); + unreachable; // crash + } + } // Safe to ".?" because of the above assertion. return switch (Kind.init(cp).?) {