Repository navigation
Draw DataMatrix codes as vectors, encoded in pure Ruby - #105
Merged
Merged
Conversation
data_matrix encodes the data in ASCII encodation, digits two to a codeword, in the smallest of the 24 square ECC 200 sizes that holds it, with Reed-Solomon blocks interleaved as the larger sizes need, and draws it as one path and one fill with a one-module quiet zone. QR codes and DataMatrix share their drawing and, in Gamba's own API, one box. CI installs dmtx-utils, whose dmtxread reads every symbol the tests draw back from the rendered page. Assisted-by: Claude [Claude Code]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Carriers ask for a DataMatrix on parcel labels, and Gamba drew QR codes and linear barcodes but not that. This is the last part of #74, after QR codes in #103 and linear barcodes in #104. Closes #74.
data_matrixencodes the data as a square ECC 200 symbol and draws it as vector rectangles, with one path and one fill and no dependency.size(with its one-module quiet zone),module_size,at,position,vposition,quiet_zoneandcolor. There is nolevel: error correction is fixed by the size.draw_matrix_codeand, in Gamba's own API, one box.dmtxreadreads every test symbol back from the rendered page.Proof
test/data_matrix_test.rbreads 11 symbols back withdmtxreadfrom pages rendered at 150 dpi: a letter, digits, a URL, UTF-8 bytes, and random ASCII of 10 to 1500 characters on a seed, from 10×10 to 144×144. Sizes are pinned (6 digits fill a 10×10, 3116 fill a 144×144, 3117 raise), along with the one fill and the solid bottom edge's position in the content stream, and a box in Gamba's own API. In a scratch run, all 15 symbols I drew decoded, from one character to the largest size. The QR and barcode tests still pass.rake test: 1369 runs, 0 failures; RuboCop is clean.Generated by Claude Code