WhyNotHugo / python-barcode

㊙️ Create standard barcodes with Python. No external dependencies. 100% Organic Python.
http://python-barcode.rtfd.io/
MIT License
558 stars 123 forks source link

Added two feature flags and charset selection on init #223

Open fefc opened 5 months ago

fefc commented 5 months ago

Feature flag: enable_optimization To me it seems like the optimization could create a wrong barcode so I have added the ability to enable or disable the optimization Example: Say you would like to generate a CODE128C barcode with a payload like 995560. The optimization would remove the 99 from the barcode. If you then scan the barcode the content is 5560.

Feature flag: enable_hybrid_charset In some cases you might want to have a pure CODE128A, CODE128B or CODE128C barcode so I have added the ability to enable or disable the current way of generating barcode which allows hybrid charset.

Looking at some specs, hybrid char set is not really the standard: https://en.wikipedia.org/wiki/Code_128

All changes I've made don't change the current way of generating barcode unless you disable the new flags. It's 100% backwards compatible.