Skip to content

fix: hide FNC1 invocations from Code 128 text - #30

Merged
GOODBOY008 merged 2 commits into
GOODBOY008:mainfrom
Streetblock:feat/fix-code128-fnc1-display
Aug 12, 2026
Merged

fix: hide FNC1 invocations from Code 128 text#30
GOODBOY008 merged 2 commits into
GOODBOY008:mainfrom
Streetblock:feat/fix-code128-fnc1-display

Conversation

@Streetblock

@Streetblock Streetblock commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Closes #29

What changed

  • preserve Code 128 >8 invocations as FNC1 codewords in the encoded symbol
  • remove the invocation tokens from the human-readable interpretation line
  • retain the original GS1 parentheses and spacing in the displayed text
  • add an exact unit regression and a Labelary-backed golden fixture for ZPL mode D

Verification

  • cargo fmt --check
  • cargo test
  • 104/104 golden cases pass
  • new Labelary comparison: 0.74% pixel difference (GOOD, below 1%)

The remaining visual difference is caused by font metrics/canvas sizing, not by FNC1 encoding or display semantics.

@Streetblock
Streetblock force-pushed the feat/fix-code128-fnc1-display branch from d93b7c1 to 81f629a Compare August 12, 2026 09:13
@GOODBOY008
GOODBOY008 requested a balanced review from Copilot August 12, 2026 09:15

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

Fixes Code 128 mode D rendering so FNC1 invocations remain encoded but are hidden from human-readable text.

Changes:

  • Separates encoded and displayed mode D data.
  • Adds unit and golden regression coverage.
  • Records a 0.74% Labelary comparison.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/barcodes/code128.rs Prepares encoded and display values.
src/drawers/renderer.rs Renders the sanitized interpretation line.
tests/unit_barcodes.rs Adds exact transformation assertions.
tests/e2e_golden.rs Registers the golden test.
testdata/unit/code128_mode_d_fnc1.zpl Adds the regression fixture.
testdata/diffs/diff_report_unit.txt Records golden comparison results.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/e2e_golden.rs
}
#[test]
fn golden_code128_mode_d_fnc1() {
golden_zpl_with_tolerance("code128_mode_d_fnc1", 1.0);
@Streetblock

Copy link
Copy Markdown
Contributor Author

Good catch. The unit fixture path was overriding the requested 1% limit with the 8% unit default. I addressed the shared tolerance selection separately in #31, including a regression test and correct effective-tolerance reporting. This keeps the infrastructure fix independent from this Code 128 change.

@GOODBOY008

Copy link
Copy Markdown
Owner

@Streetblock I had patch a commit to fix text under barcode.

…on line

Labels improved:
- code128_mode_d_fnc1: 0.74% → 0.48%

Changes:
- src/drawers/renderer.rs: mode D (UCC/EAN) interpretation line now uses the
  embedded Helvetica Bold Condensed at 14.3×module with a 4px vertical offset,
  matching Labelary's larger condensed line font (~14×module ink height).
  Other barcode modes keep the standard DejaVu Mono @ 11×module — unchanged.
- testdata/diffs/: regenerated comparison/diff images and unit report.

Verified: unit report only this entry changed, labels report zero changes,
golden 104/104 pass.
@GOODBOY008
GOODBOY008 force-pushed the feat/fix-code128-fnc1-display branch from dbc13e5 to 784b150 Compare August 12, 2026 11:05
@GOODBOY008
GOODBOY008 merged commit f9df579 into GOODBOY008:main Aug 12, 2026
9 checks passed
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.

^BC mode D prints >8 FNC1 invocation in the interpretation line

3 participants