DavBfr / dart_barcode

Barcode generation library
https://pub.dev/packages/barcode
Apache License 2.0
132 stars 41 forks source link

Fix for #52 Genererating invalid Aztec in some cases (Usually an 'A' is at the positions where it breaks) #60

Closed teklund closed 1 year ago

teklund commented 1 year ago

What?

Attempt to resolve: #52 Genererating invalid Aztec in some cases (Usually an 'A' is at the positions where it breaks)

Why?

In some cases the generated aztec is invalid which causes some scanner apps to either read them incorrectly or not recognise them.

How?

In the previous version of the code in aztec.dart, trying to generate a character by latching or switching to its mode in _updateStateForChar() could occur even when charInMode was 0. The if-statement in _updateStateForChar() has now been changed so this can only occur when charInMode is larger than 0. The same fix has also been seen in other implementations of the ZXing-library for generating aztec, such as, https://github.com/zxing-cpp/zxing-cpp and https://github.com/micjahn/ZXing.Net.

A new version of the gold 256.svg, that is used in 'Barcode Aztec'-test, has also been generated with the new code.

Testing?

Run flutter test in the lib-folder.

Concerns?

Aztec rendering changed but is now aligned with ZXing and is working for odd case binaries

DavBfr commented 1 year ago

Merged, thanks!