Skip to content

feat(registry): TLC39 (^BT) composite — barcodes complete (28/28)#119

Merged
u8array merged 3 commits into
mainfrom
feat/parser-bt-tlc39
Jun 1, 2026
Merged

feat(registry): TLC39 (^BT) composite — barcodes complete (28/28)#119
u8array merged 3 commits into
mainfrom
feat/parser-bt-tlc39

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented Jun 1, 2026

No description provided.

bwip-js has no native tlc39 encoder. TLC39 is a layout convention
that combines two standard symbols per the TIA/ATIS spec:
- Top: Code 39 carrying the 6-digit ECI, with a 'T' linkage flag
  appended to signal that a MicroPDF417 follows.
- Bottom: MicroPDF417 carrying the alphanumeric serial, with the
  leading 'S' data identifier stripped.

Compose both with stock bwip-js encoders and paint them onto a
single canvas via renderTlc39Canvas. BarcodeObject special-cases the
type so the standard buildBwipOptions / BCID pipeline never touches
it. Round-trip ZPL stays correct; Labelary preview is unaffected
(they don't support ^BT either).

Registry pair, parser ^BT handler, generator toZPL, 32 locale
entries, splitTlc39Content helper tests, parser round-trip tests.
Tripwire updated for 35 object types.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for the TLC39 barcode symbology (ZPL command ^BT), including custom canvas rendering to combine Code 39 and MicroPDF417, ZPL parsing and serialization, and localized UI panels. The review feedback highlights several opportunities for improvement: fully parsing and utilizing the narrow bar width (w1) parameter of the ^BT command, passing the dynamic canvas scale to the rendering helper to ensure crisp rendering at different zoom levels, adding a defensive check for empty content, correcting a documentation comment regarding the stacked layout order, and expanding test coverage to assert the parsed module width.

Comment thread src/lib/zplParser/context.ts
Comment thread src/lib/zplParser/context.ts
Comment thread src/lib/zplParser/handlers/barcodes.ts
Comment thread src/lib/zplParser/flushField.ts
Comment thread src/components/Canvas/BarcodeObject.tsx
Comment thread src/components/Canvas/bwipHelpers.ts
Comment thread src/components/Canvas/bwipHelpers.ts Outdated
Comment thread src/registry/tlc39.ts Outdated
Comment thread src/lib/zplParser.test.ts
u8array added 2 commits June 1, 2026 22:34
Parse ^BT w1 (Code 39 narrow bar width) into a dedicated
tlcModuleWidth field so an explicit value survives import instead
of being silently overwritten by the most recent ^BY; flushField
falls back to byModuleWidth only when w1 is absent.

Pipe the editor scale + dpmm into renderTlc39Canvas and pick the
bwip-js render scale via get1DBwipScale, matching the 1D-barcode
pattern so the composite stays crisp at any zoom level.

Defensive guard in splitTlc39Content against empty content. Fix
stack-order doc comment in tlc39.ts (was 'below Code 39', actual
layout is MicroPDF417 on top). Extend parser test to assert
moduleWidth and add a ^BY-fallback case.
- renderTlc39Canvas composites at dpmm-aware display px (was using a
  /4 mm heuristic that drifted at 12/24 dpmm); appends Code 39 "T"
  linkage flag only on successful MicroPDF render.
- Enforce TLC39's 4-column MicroPDF417 geometry via bwip-js `columns: 4`
  and snap requested rows to {4,6,8,10} (bwip-js throws otherwise).
- Honor `microPdfRows` prop in the renderer (was previously dead).
- Tighten ^BT h2 range to spec 1-10 (was 1-99) in parser, panel, schema.
- Add boundary, reject-out-of-range, r1-drop, no-serial round-trip,
  and snap-helper unit tests.
@u8array
Copy link
Copy Markdown
Owner Author

u8array commented Jun 1, 2026

/gemini revwiew

@gemini-code-assist
Copy link
Copy Markdown

Hello! It looks like you meant to invoke the /gemini review command. I have performed a review of your pull request, and here is my feedback:

Pull Request Review: TLC39 (^BT) Support

This is a well-implemented addition to the registry. Supporting the TLC39 composite barcode by manually composing the Code 39 and MicroPDF417 components on a canvas is a clever and effective workaround for the lack of native bwip-js support for this symbology.

Strengths:

  • Robust Implementation: The logic for splitting the content, handling the linkage flag, and rendering the composite canvas is clear and follows the TCIF specification.
  • Comprehensive Coverage: You have updated all necessary areas, including the UI, registry, localization files, and documentation.
  • Test Quality: The new tests in zplParser.test.ts and registry-isolation.test.ts provide good coverage for both the parsing logic and the registry integration.
  • Maintainability: The code adheres to the existing patterns in the repository, making it easy to integrate and maintain.

Minor Observations:

  • Localization: You have diligently updated all locale files, which is excellent for project consistency.
  • Error Handling: The renderTlc39Canvas function handles rendering failures gracefully, which is important for a robust UI.

Overall, this is a high-quality contribution. Great work on completing the barcode registry!

@u8array
Copy link
Copy Markdown
Owner Author

u8array commented Jun 1, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements support for the TLC39 barcode symbology (a composite of Code 39 and MicroPDF417), including ZPL parsing, rendering, localization, and properties panel integration. While the implementation is comprehensive and well-tested, three important issues were identified during the review: first, stretching the Code 39 and MicroPDF417 components to a shared width in bwipHelpers.ts distorts their module widths and can make the barcode unscannable; second, a missing import for bwipjs in bwipHelpers.ts will lead to a runtime ReferenceError; and third, emitting a redundant ^BY command in tlc39.ts introduces potential global side effects on subsequent barcodes and should be omitted.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/components/Canvas/bwipHelpers.ts
Comment thread src/components/Canvas/bwipHelpers.ts
Comment thread src/registry/tlc39.ts
@u8array u8array merged commit 2d2fdaa into main Jun 1, 2026
2 checks passed
@u8array u8array deleted the feat/parser-bt-tlc39 branch June 1, 2026 22:29
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.

1 participant