Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Implementation completed for Interleaved 2 of 5 (ITF) barcode encoder:

  • Add Interleaved2of5 enum value to BarcodeTypes.cs
  • Add ITF validation regex pattern to RegexCache.cs (numeric-only)
  • Create Interleaved2of5Encoder.cs following existing encoder patterns
    • Even-length numeric validation
    • ITF encoding table (paired digit encoding)
    • Start/Stop patterns
    • Rendering logic with adaptive sizing
  • Add encoder factory entry in EncodersFactory.cs
  • Manual testing validated (playground test successful)
  • Comprehensive tests created for ITF encoder (53 tests, all passing)
  • Integration tests added for end-to-end validation
  • Full test suite passes: 667 tests, 98.53% line coverage
  • Documentation updated (README.md, docs/README.md, docs/api/barcode-types.md)
  • Copilot instructions updated (.github/copilot-instructions.md)
  • Final validation complete

Summary: Successfully implemented Interleaved 2 of 5 (ITF) barcode encoder with comprehensive tests, documentation, and 98.53% code coverage. The encoder supports even-length numeric input with proper validation, encoding, and rendering capabilities.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Add Interleaved 2 of 5 (ITF) barcode encoder</issue_title>
<issue_description>## Checklist (required)

  • I searched existing issues and discussions, and reviewed the README Roadmap to avoid duplicates.
  • This is a feature request (not a bug report or support question).
  • This request aligns with the scope of the BarcodeGenerator .NET library.

Summary / Problem to solve (required)

BarcodeGenerator currently lacks support for Interleaved 2 of 5 (ITF) barcode encoding. This limitation prevents users from generating barcodes commonly used for packaging, logistics, and warehouse operations.

Motivation / Use cases (required)

ITF barcodes are widely used in distribution and storage, especially for carton and pallet labeling. Their support would allow seamless integration into supply chain and inventory workflows.

Proposed solution / API (required)

Implement an ITF encoder supporting even-length numeric data, optional check digit, and input validation. Example usage:

using var barcode = new Barcode(options =>
{
    options.Type = BarcodeTypes.Interleaved2of5; // ITF type (to be implemented)
    options.Height = 40;
    options.Scaling = 2;
    options.Margins = 4;
    options.BackgroundColor = SKColors.White;
    options.ForegroundColor = SKColors.Black;
    options.RenderText = true;
    options.UseTypeface("Consolas", SKFontStyle.Bold);
});

string validatedCode = barcode.Encode("12345678"); // Should validate even-length numeric input
barcode.Export("output/itf_sample.png");

Alternatives considered

Manual encoding or using external libraries, which introduces dependencies and inconsistent APIs.

Area and scope

  • Area/category: Encoders
  • Symbology/types involved: Interleaved 2 of 5 (ITF)
  • Desired output format(s) (if relevant): PNG, JPEG

Compatibility / Breaking changes

Should be additive and not break existing APIs. If changes to shared interfaces are needed, document migration path.

Performance considerations

No major negative impact expected. ITF encoding is computationally similar to existing supported types.

Additional context / References

ITF is standardized in ISO/IEC 16390. Reference implementations: ZXing.Net, BarcodeLib, etc.

Willing to contribute?

  • Yes, I'm willing to help design/implement
  • No, I'm just suggesting the feature
    </issue_description>

<agent_instructions>Always remember that Barcode encoders options a immutable, BUT every single instance MUST be able to render different barcode that, based on the barcode type spec, might have different image sizes, so the rendering logic must both cache as much logic as possible to improve performances but also being able to adapt to transitive options/calculations.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Custom agent used: feature-agent
Main Copilot agent for feature issues in BarcodeGenerator. Implements features end-to-end and orchestrates sub-agents to keep code, docs, tests, and Copilot instructions always in sync.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 18, 2025
@TyKonKet
Copy link
Owner

@copilot Something went wrong, please try again

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.

[Feature]: Add Interleaved 2 of 5 (ITF) barcode encoder

2 participants