From 717d1051e063e0f4d6b93454bb1e38311176e44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Asensio=20Garc=C3=ADa?= Date: Sat, 3 Sep 2022 15:46:49 +0200 Subject: [PATCH] Don't panic if unsupported char --- Cargo.toml | 2 +- src/binary/logger.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 61c2b95d..3717f06f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ rand = { version = "0.8.4", optional = true, default-features = false } rand_chacha = { version = "0.3.1", optional = true, default-features = false } [dependencies.noto-sans-mono-bitmap] -version = "0.1.2" +version = "0.1.6" default-features = false features = ["regular", "size_14"] optional = true diff --git a/src/binary/logger.rs b/src/binary/logger.rs index b5ea78f5..7a72671e 100644 --- a/src/binary/logger.rs +++ b/src/binary/logger.rs @@ -108,7 +108,10 @@ impl Logger { if self.y_pos >= (self.height() - BITMAP_LETTER_WIDTH) { self.clear(); } - let bitmap_char = get_bitmap(c, FontWeight::Regular, BitmapHeight::Size14).unwrap(); + let bitmap_char = get_bitmap(c, FontWeight::Regular, BitmapHeight::Size14) + .unwrap_or( + get_bitmap('■', FontWeight::Regular, BitmapHeight::Size14).unwrap() + ); self.write_rendered_char(bitmap_char); } }