Skip to content

Commit 529d7fe

Browse files
fix: DotCode ensure height+width is odd per spec
When both dimensions are odd (sum is even), increment height by 1 to make it even, ensuring the sum is odd as required by AIM ISS DotCode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 35f0fed commit 529d7fe

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/encoders/dotcode.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,9 @@ export function encodeDotCode(text: string): boolean[][] {
162162
if (height % 2 === 0) height++;
163163

164164
// Ensure height + width is odd (DotCode constraint)
165-
// Currently both are odd, so sum is even. Adjust width by +2 to keep it odd
166-
// while making the sum odd.
165+
// Make one dimension even and one odd so their sum is odd
167166
if ((height + width) % 2 === 0) {
168-
width += 2;
167+
height++;
169168
}
170169

171170
// Pad data codewords to fill available data capacity

0 commit comments

Comments
 (0)