Skip to content

Releases

1.3.0

Choose a tag to compare

@ronison ronison released this 19 Nov 13:51

Bars4J 1.3.0

Fixed

  • Matrix SVG/HTML canvas for rectangular symbols: the MatrixBarcodeFormat wrapper (Java and Node) sized both canvas dimensions from widthInModules, letterboxing rectangular matrix symbols — the PDF417 SVG carried a 564x564 canvas around a 564x48 symbol. Width and height are now computed separately from widthInModules/heightInModules; square formats (QRCode, Data Matrix, Aztec) are unaffected.
  • Node matrix toSvg document assembly still used the old Java wrapper format (viewBox, no fallback text); it now mirrors the current Java SvgDocument (fixed canvas, xMidYMid alignment, fallback text), so the matrix end-to-end SVG fixtures are byte-identical between Java and @bars4j/core again.
  • RenderSpec.fontSize now honoured by every output path — the SVG document style, the HTML snippet style and the raster label all follow the spec (defaults preserved: 14 px when unspecified).
  • Anti-aliased raster label glyphs: the human-readable label band now renders with text anti-aliasing enabled (grayscale), removing the hard jaggies on the label font.

Changed

  • Gallery trimmed to the README showcase samples: images/ now keeps only the 23 SVG samples presented in the README (and their locally generated PNG counterparts, still git-ignored); EAN5.svg and the EAN13-font-*.svg demo samples were removed from the repository.
  • images/PDF417.svg regenerated (564x48; the tracked sample predated the PDF417 encoder rewrite).
  • New MatrixCanvasTest pins the canvas-to-raster geometry parity for every matrix format.

Notes

  • Maven Central publishing is now fully automated (autoPublish=true + waitUntil=published): a published release deploys, validates and publishes on the Central Portal without manual approval.
  • @bars4j/core 1.3.0 ships the same conformance guarantees: 175 Node tests, 48/48 HTML snippets byte-identical with the Java output.

Full changelog: pr-1.1.0...pr-1.3.0

1.1.0

Choose a tag to compare

@ronison ronison released this 16 Nov 14:09

Bars4J 1.1.0

Added

  • Inline HTML/SVG snippet for the Node.js port (toHtml): the @bars4j/core package now offers the same entry points as the Java library — BarcodeGenerator.of(id).toHtml(text) for the natural size and toHtml(text, displayWidth, displayHeight) for an explicit display size. The snippet has no XML prologue, carries a viewBox (scales with its container), role="img" and an escaped aria-label, and its drawing markup is byte-for-byte identical to the golden-validated toSvg output. Verified against the Java implementation for all 24 registered formats, at natural and explicit display size (48/48 identical).
  • AGENTS.md integration guide for AI coding agents (format ids, output API, RenderSpec bounds, exceptions, JPMS notes, pitfalls).
  • Shared org.bars4j.encode.matrix.ecc layer (GfField + ReedSolomonCoder) unifying the GF(2^m) field and Reed-Solomon arithmetic across QR Code, Data Matrix and Aztec (~−214 duplicated lines; both GF(256) polynomials now documented and cached via GfField.of).
  • EAN5.svg added to the demo samples.

Changed

  • Linear renderers refactored behind a shared BarRect + LinearPainters pipeline (renderers now only decide geometry; raster/SVG painting is centralized), with a shared SvgDocument assembly for the standalone SVG output. Pixel-exact ink coverage preserved for all 20 linear formats.
  • Node 1D renderers mirror the Java BarRect pipeline (one absolute SVG subpath per element, inks separated per colour).

Fixed

  • PostNet SVG bars were drawn below the 12 px canvas (y=20..28); restored the bottom-aligned rule at the baseline.
  • ITF-14 wide ratio was hardcoded to 2.0, ignoring the format's registered 2.5 — the canvas shrank from 155 to 126 px; the ratio is now read from the spec.
  • module-info.java now declares requires java.logging;, restoring the modular build.
  • Data Matrix GF(256) polynomial comment corrected (0x12D = x^8+x^5+x^3+x^2+1; QR uses 0x11D).

Full changelog: pr-1.0.1...pr-1.1.0

1.0.1

Choose a tag to compare

@ronison ronison released this 12 Nov 18:09

Bars4J 1.0.1

Fixed

  • HRI label alignment on the scaled raster path: when the x-dimension was not an exact multiple of the minimum (e.g. the 0.26 default shown by the Swing demo), the bars were compressed but the human-readable text was drawn with unit-width slots — the last EAN/UPC digit drifted 1–2 px into the right-hand guard bars. Slot positions are now computed with the fractional module width in double precision, so the digits keep lining up with the bars for any x-dimension.
  • EAN/UPC slot positions are now relative to the leading quiet zone, keeping the label aligned for non-default quiet-zone widths.
  • The centred label no longer scales its font with the x-dimension, which could wipe the ITF-14 bottom bearer bar.

Full changelog: pr-1.0.0...pr-1.0.1

1.0.0

Choose a tag to compare

@ronison ronison released this 12 Nov 17:37

Bars4J 1.0.0

HRI label alignment fix

The human-readable digits of the EAN/UPC formats are now drawn digit-by-digit in fixed 7-module slots (the canonical HRI positions), so the label no longer collides with the right guard bars regardless of JDK font metrics.

New rendering options

  • RenderSpec now accepts the quiet zone width (modules per side, default 10) and the human-readable label font size (default 14).
  • SwingDemo exposes the new options plus a fixed Colours panel.

Legacy API removed

The retired legacy API (Barcode, BarcodeFactory, BarcodeComponent, org.bars4j.paint, legacy encoders) has been removed. Use the unified BarcodeGenerator facade — see the README migration examples.

Full changelog: pr-0.9.0...pr-1.0.0

0.9.0

Choose a tag to compare

@ronison ronison released this 12 Nov 13:27

What's Changed

Security hardening

This release hardens the rendering pipeline against untrusted input:

  • XSS: untrusted text is now escaped in every legacy painter, so SVG/HTML output is safe even when the human-readable label contains markup characters.
  • Text cap: text longer than 4000 characters (globally settable/resettable via setMaxTextLength/resetMaxTextLength) now throws the library's checked exceptions instead of producing unbounded output — in both Java and Node.
  • RenderSpec bounds: barWidth (≤ 100), barHeight (≤ 10 000) and moduleSize (≤ 100) are validated in Java and Node, with integer checks on the Node side.
  • Code 128 is encoded with a fixed charset (ISO-8859-1) in both implementations, removing platform-dependent default-charset behaviour.
  • CI: all GitHub Actions are pinned by commit SHA and npm is pinned to 11.5.1 in the workflows.
  • Registry: register() no longer allows shadowing a registered format id, and id normalisation uses an explicit locale (Locale.ROOT) in Java.
  • module-info exports are narrowed to the public API surface.

Rendering fixes

  • EAN/UPC labels are padded defensively before fixed-offset substring calls, so short labels can no longer crash with StringIndexOutOfBoundsException.
  • The human-readable text area now honours the RenderSpec background via a new spec-aware paintTextSvg / paintTextWithSpec (previously hardcoded #fff, which broke the visual on dark backgrounds) — in both pipelines.
  • SVG output emits preserveAspectRatio="xMidYMid meet" and normalises #fff to #ffffff (goldens regenerated accordingly).

Improved

  • The user RenderSpec is now fully propagated through the Node linear format: colours from the user spec reach the bar renderers and the text renderers, matching the Java behaviour end-to-end.
  • The Node package-lock.json is back in sync with package.json.

Tests

  • SecurityHardeningTest (12 tests) covers the spec bounds, the text cap, the registry rule, label padding and legacy XSS escaping.
  • A new Node test verifies spec colours in the raster pixels and SVG fills — 729 Java tests + the performance integration test, 98 Node tests, all green.

Full Changelog: pr-0.8.0...pr-0.9.0

0.8.0

Choose a tag to compare

@ronison ronison released this 11 Nov 18:23

What's Changed

New: inline HTML/SVG embedding (toHtml)

Every registered format (1D and 2D) can now be rendered as an SVG snippet ready to be pasted directly into a web page — no XML prologue, no generator comment, no fallback text — with a viewBox (so it scales with its container), role="img" and an aria-label:

String html = BarcodeGenerator.of("EAN13").toHtml("789100031550");
// paste directly inside <body>...</body>

String sized = BarcodeGenerator.of("CODE128").toHtml("Bars4J-128", 300, 100); // explicit px size

The drawing markup inside the snippet is byte-for-byte identical to the validated toSvg output (guarded by a parity test across all 24 formats). toSvg and the raster output are unchanged.

Fixed

  • Encoder bugs across the 1D and matrix encoders: null-text handling now throws the library's checked exceptions, EANEncoder.charToInt no longer leaks a NumberFormatException, Code 11 check-digit pairs and the Code 39 full-ASCII shift handling are corrected.
  • The orphan moveto in the width-coded SVG path (zm2 0 0h1 → zm2 0h1) is fixed.
  • &, < and > are now escaped in the human-readable SVG text (Code 128's charset allows them, which used to break the markup).

Improved

  • The RenderSpec colours are honoured end-to-end — raster, SVG and human-readable text (previously ignored for linear formats).
  • DPI metadata: PNG embeds a pHYs chunk and JPEG a JFIF density tag, so generated images carry their true physical size (GIF has no DPI support).
  • BarcodeComponent (Swing): null text is rejected, state is validated before mutation, getPreferredSize() derives from the rendered image and the last valid image is kept on failure.
  • Resource hygiene: dispose() on every Graphics2D, holder idiom across the legacy painters, a synchronized immutable BarcodeRegistry and try-with-resources in the demo.

Tests

  • 77 new tests covering the HTML snippet (structure, parity with toSvg, spec colours, escaping), encoder spec vectors (Code 11, PostNet, UPC-E, Code 39 Extended, PDF417, ECI/GBK, QR fullwidth), raster/SVG colour conformance and the Swing component — 717 unit tests + the performance integration test, all green.

Full Changelog: pr-0.7.3...pr-0.8.0

0.7.3

Choose a tag to compare

@ronison ronison released this 11 Nov 15:02

What's Changed

  • Keep a 2px gap between the bars and the human-readable text in the raster (PNG) output for EAN13, EAN8, UPCA, UPCE and EAN5. SVG output is unchanged.
  • Root README now has a Quick Start covering both the Java and the Node.js versions.
  • The Node README no longer carries the npm publishing instructions.

Full Changelog: pr-0.7.2...pr-0.7.3

Bars4J 0.7.2

Choose a tag to compare

@ronison ronison released this 11 Nov 12:51

Bars4J 0.7.2

Maintenance release aligned across Java and Node, and the first release that ships the built Java
jars as downloadable assets.

Java

  • org.bars4j:bars4j:0.7.2 published to GitHub Packages.
  • Release assets now include the built jars: bars4j-0.7.2.jar (library) and
    bars4j-0.7.2-sources.jar (sources).
  • The Maven publish workflow now attaches the jars to the release automatically.

Node.js / TypeScript (@bars4j/core)

  • @bars4j/core@0.7.2 published to the public npm registry via trusted publishing (OIDC) with
    automatic provenance — no npm token is stored in the repository.

CI fixes

  • Maven publish triggers only on the release published event (no more duplicate runs).
  • Node publish uses OIDC only (token secret removed) and upgrades npm so trusted publishing works.

Bars4J 0.7.1

Choose a tag to compare

@ronison ronison released this 10 Nov 20:01

Bars4J 0.7.1

Patch release that carries the same content as 0.7.0 — the initial 0.7.0 Maven deploy hit an
existing artifact version in GitHub Packages — published with the Maven workflow fixed to run a
single time per release.

Contents

  • Node.js / TypeScript port (@bars4j/core), including 1D + 2D formats, SVG and raster output,
    demos, a bars4j CLI and Node CI/publish workflows. See the
    0.7.0 release notes for details.
  • Maven publish fix: the workflow now triggers only on the release published event (instead of
    published + created), so a release no longer produces duplicate runs that race to deploy the
    same artifact version (409 Conflict).

Notes

  • Java and Node versions are aligned at 0.7.1.
  • The Java sources are unchanged.

Bars4J 0.7.0

Choose a tag to compare

@ronison ronison released this 10 Nov 19:42

Bars4J 0.7.0

Adds a complete Node.js/TypeScript port of the library, published as
@bars4j/core on npm, while keeping the Java library
and its golden fixtures in sync.

Node.js / TypeScript port (node/)

  • 1D: all 20 linear formats with byte-for-byte identical SVG output.
  • 2D: QRCode, Data Matrix, PDF417 and Aztec, including their SVG output.
  • Raster: dependency-free ARGB geometry and PNG export; the optional
    @napi-rs/canvas backend draws the
    human-readable text.
  • Demos and CLI: npm run demo / npm run demo:qrcode and a bars4j command-line tool.
  • Packaging and CI: npm metadata, Node CI (Node 22/24, npm pack check, demo smoke test) and a
    publish workflow using npm trusted publishing.
  • Verified with 96 tests against the shared Java goldens: 1D SVG goldens, 1D raster image
    fingerprints, 2D module-matrix/SVG goldens and an all-formats smoke test.
  • New fixtures under src/test/resources/golden/matrix (2D matrices, 2D SVGs, QR Kanji case),
    generated from the unmodified Java implementation.

Notes

  • The Node package requires Node.js 22.18+ and needs no build step (native TypeScript type stripping).
  • The Java sources are unchanged.