diff --git a/CHANGES b/CHANGES index 8095e279..93450571 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ XXXX-XX-XX +* The Data Matrix encoder was fixed to always emit the Macro 05/06 codeword in the first position. * The performance of the QR Code encoder was improved for data that mixes character classes, such as mixed-case text and URLs, by materialising each mode segment once when the mode changes rather than extending it character by character. diff --git a/src/datamatrix.ps.src b/src/datamatrix.ps.src index 6f6e1224..f2487005 100644 --- a/src/datamatrix.ps.src +++ b/src/datamatrix.ps.src @@ -976,6 +976,13 @@ begin % Compensate c40headerlength if any c40headerlength 0 gt { /c40headerlength c40headerlength 1 add def } if } if + % Macro 05/06 is only recognised when its codeword is first + msg 0 get //datamatrix.m05 eq msg 0 get //datamatrix.m06 eq or { + Avals msg 0 get get addtocws + /i 1 def + % Compensate c40headerlength if any + c40headerlength 0 gt { /c40headerlength c40headerlength 1 add def } if + } if { i msglen ge {exit} if //datamatrix.encfuncs mode get load exec diff --git a/tests/ps_tests/datamatrix.ps.test b/tests/ps_tests/datamatrix.ps.test index 5c0bb84e..f200d18b 100644 --- a/tests/ps_tests/datamatrix.ps.test +++ b/tests/ps_tests/datamatrix.ps.test @@ -68,7 +68,7 @@ } def -% Macro 05 +% Macro 05/06 { ([\)>^03005^029214^030^004) (debugcws parse) datamatrix % Short 05 @@ -78,6 +78,14 @@ ([\)>^03005^02921456^030^004) (debugcws parse) datamatrix % 05 with 6 in processed position 5 } [236 151 175 55 129] debugIsEqual +{ + ([\)>^03005^029AAAAAAA^030^004) (debugcws parse) datamatrix % 05 macro codeword must be first, so it precedes a C40 latch +} [236 230 89 191 89 191 254 66] debugIsEqual + +{ + ([\)>^03006^029tttttttt^030^004) (debugcws parse) datamatrix % 06 ahead of a Text latch +} [237 239 211 138 211 138 211 105] debugIsEqual + % Metrics loops