Repository navigation
0.8.0
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 sizeThe 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.charToIntno longer leaks aNumberFormatException, 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
RenderSpeccolours are honoured end-to-end — raster, SVG and human-readable text (previously ignored for linear formats). - DPI metadata: PNG embeds a
pHYschunk 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 everyGraphics2D, holder idiom across the legacy painters, a synchronized immutableBarcodeRegistryand 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