Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of code creation, avoiding to many charset switch. #232

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wopozka
Copy link

@wopozka wopozka commented Jul 6, 2024

FCN1 char is defined the same in all three encodings. The current implementation switched encodings multiple times, even if the whole code could be created with encoding C. According to GS1 spec the whole barcode (including Quiet Zones) should not be longer than 165 mm (6.5"), thus any additional symbol added to the code resulted in longer code. This PR optimizes the proces of code creation, avoiding encoding switch.

  1. For code128, starding encoding set to C
  2. Added function that determines whether the char is FNC1 char - defined the same in all three encodings
  3. _maybe_switch_charset recognizes that FNC1 char is defined in all three encodings, and avoids changing encodings
  4. added testcases for new functionality.

…results in shorter code which according to GS1 spec should not be longer than 165 mm (6.5")

1) For code128, starding encoding set to C
2) Added function that determines whether the char is FNC1 char - defined the same in all three encodings
3) _maybe_switch_charset recognizes that FNC1 char is defined in all three encodings, and avoids changing encodings
4) added testcases for new functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant