Skip to content

feat: warn when a ZPL font has no mapping instead of substituting silently - #20

Open
mircis-stan wants to merge 1 commit into
GOODBOY008:mainfrom
mircis-stan:feat/warn-on-unmapped-font
Open

feat: warn when a ZPL font has no mapping instead of substituting silently#20
mircis-stan wants to merge 1 commit into
GOODBOY008:mainfrom
mircis-stan:feat/warn-on-unmapped-font

Conversation

@mircis-stan

Copy link
Copy Markdown
Contributor

An unknown font name (a ^CW-loaded letter, or garbage from malformed input) falls back to DejaVu Sans Mono with no signal, so a wrong-font layout regression is invisible until a human looks at the output — that's how the #18 bug went unnoticed. Known resident fonts (A, C, E–H, R, T–Z) keep their intentional substitution without log noise; only genuinely unmapped names warn.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the renderer’s ZPL font-to-TTF mapping behavior so that genuinely unmapped ZPL font names emit a warning instead of silently substituting a fallback font, helping catch wrong-font layout regressions earlier.

Changes:

  • Adds explicit handling for the remaining Zebra-resident fonts to keep intentional substitutions quiet.
  • Emits a warning to stderr when an unrecognized/unmapped ZPL font name is encountered, before substituting DejaVu Sans Mono.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/drawers/renderer.rs
Comment on lines +720 to +726
_ => {
eprintln!(
"labelize: no mapping for ZPL font '{}'; substituting DejaVu Sans Mono (layout may differ)",
name
);
FONT_DEJAVU_MONO
}
…ently

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.
@GOODBOY008
GOODBOY008 force-pushed the feat/warn-on-unmapped-font branch from 7c11943 to af90de2 Compare July 16, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants