From af90de283c9db144e429732db3cc60bb989e3996 Mon Sep 17 00:00:00 2001 From: Mircea Stan Date: Tue, 14 Jul 2026 19:24:55 +0300 Subject: [PATCH] feat: warn when a ZPL font has no mapping instead of substituting silently An unknown font name (a ^CW-loaded letter, or garbage from malformed input) currently falls back to DejaVu Sans Mono with no signal, so a wrong-font layout regression is invisible until someone looks at the output. Known resident fonts keep their intentional substitutions without noise. --- src/drawers/renderer.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/drawers/renderer.rs b/src/drawers/renderer.rs index 004ec22..de4c9dc 100644 --- a/src/drawers/renderer.rs +++ b/src/drawers/renderer.rs @@ -751,7 +751,17 @@ fn get_ttf_font_data(name: &str) -> &'static [u8] { "0" => FONT_HELVETICA, "B" | "D" | "P" | "Q" | "S" => FONT_DEJAVU_BOLD, "GS" => FONT_GS, - _ => FONT_DEJAVU_MONO, + // Remaining Zebra-resident fonts intentionally substitute DejaVu Sans Mono. + "A" | "C" | "E" | "F" | "G" | "H" | "R" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" => { + FONT_DEJAVU_MONO + } + _ => { + eprintln!( + "labelize: no mapping for ZPL font '{}'; substituting DejaVu Sans Mono (layout may differ)", + name + ); + FONT_DEJAVU_MONO + } } }