1
0
Fork
You've already forked python-barcode
0

Adds support for longer guard bar to EAN13 and EAN8 #100

Merged
Governa merged 6 commits from feature/longer_guard_bar into master 2020年12月24日 13:56:54 +01:00
Governa commented 2020年12月23日 19:06:41 +01:00 (Migrated from github.com)
Copy link

This PR tries to partially solve Issue #11

Adds a parameter to both classes that controls if we want longer guard
bars and then while building the code to be generated, use "G" instead of
"1" in those places we will need to have a longer bar.

During the write, interpret every "G" the same as "1" but add an height
factor to the mod list. To avoid changing the entire code base to add a
height parameter, set the self.module_height for every bar generated.

This PR tries to partially solve Issue #11 Adds a parameter to both classes that controls if we want longer guard bars and then while building the code to be generated, use "G" instead of "1" in those places we will need to have a longer bar. During the write, interpret every "G" the same as "1" but add an height factor to the mod list. To avoid changing the entire code base to add a height parameter, set the self.module_height for every bar generated.
codecov[bot] commented 2020年12月23日 19:07:22 +01:00 (Migrated from github.com)
Copy link

Codecov Report

Merging #100 (a806aa3) into master (7a15b8a) will increase coverage by 1.12%.
The diff coverage is 98.55%.

Impacted file tree graph

@@ Coverage Diff @@
## master #100 +/- ##
==========================================
+ Coverage 81.82% 82.95% +1.12% 
==========================================
 Files 15 15 
 Lines 787 839 +52 
==========================================
+ Hits 644 696 +52 
 Misses 143 143 
Impacted Files Coverage Δ
barcode/ean.py 91.42% <96.87%> (+2.27%) ⬆️
barcode/__init__.py 95.83% <100.00%> (+0.18%) ⬆️
barcode/writer.py 94.97% <100.00%> (+0.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a15b8a...a806aa3. Read the comment docs.

# [Codecov](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=h1) Report > Merging [#100](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=desc) (a806aa3) into [master](https://codecov.io/gh/WhyNotHugo/python-barcode/commit/7a15b8ae1327a194634ab385e88f433f738dc8e0?el=desc) (7a15b8a) will **increase** coverage by `1.12%`. > The diff coverage is `98.55%`. [![Impacted file tree graph](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100/graphs/tree.svg?width=650&height=150&src=pr&token=5jRKlKcg2C)](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #100 +/- ## ========================================== + Coverage 81.82% 82.95% +1.12% ========================================== Files 15 15 Lines 787 839 +52 ========================================== + Hits 644 696 +52 Misses 143 143 ``` | [Impacted Files](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [barcode/ean.py](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100/diff?src=pr&el=tree#diff-YmFyY29kZS9lYW4ucHk=) | `91.42% <96.87%> (+2.27%)` | :arrow_up: | | [barcode/\_\_init\_\_.py](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100/diff?src=pr&el=tree#diff-YmFyY29kZS9fX2luaXRfXy5weQ==) | `95.83% <100.00%> (+0.18%)` | :arrow_up: | | [barcode/writer.py](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100/diff?src=pr&el=tree#diff-YmFyY29kZS93cml0ZXIucHk=) | `94.97% <100.00%> (+0.73%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=footer). Last update [7a15b8a...a806aa3](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/100?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
WhyNotHugo (Migrated from github.com) reviewed 2020年12月23日 20:21:54 +01:00
WhyNotHugo (Migrated from github.com) left a comment
Copy link

Many thanks for you contribution! This has been a much requested improvement, and this PR looks really good!

The SVGs look great. The PNGs have two issues.

First of, the spacing between the barcode and the text seems to be a wee bit too much, and the text it at the very border -- maybe spacing should be reduced when using guards. This is clearer when seeing the images on non-white background:

image

image

Many thanks for you contribution! This has been a much requested improvement, and this PR looks really good! The SVGs look great. The PNGs have two issues. First of, the spacing between the barcode and the text seems to be a wee bit too much, and the text it at the very border -- maybe spacing should be reduced when using guards. This is clearer when seeing the images on non-white background: ![image](https://user-images.githubusercontent.com/730811/103030618-12ce2000-4554-11eb-9867-1b99ff3317c6.png) ![image](https://user-images.githubusercontent.com/730811/103030627-15c91080-4554-11eb-9547-aa24595d0453.png)
WhyNotHugo (Migrated from github.com) commented 2020年12月23日 20:18:29 +01:00
Copy link

Looks like images are rendered with the guards slightly "fatter" in their lower end.

image

Making the white lines the same length as the G-lines seems to fix it.

 mlist.append((-c, 1.1))
Looks like images are rendered with the guards slightly "fatter" in their lower end. ![image](https://user-images.githubusercontent.com/730811/103030281-668c3980-4553-11eb-98e5-dbe6029cf79b.png) Making the white lines the same length as the G-lines seems to fix it. ```suggestion mlist.append((-c, 1.1)) ```
WhyNotHugo commented 2020年12月23日 20:22:26 +01:00 (Migrated from github.com)
Copy link

Oh, you can ignore the code-style errors if you want, I can fix those when merging anyway.

Oh, you can ignore the code-style errors if you want, I can fix those when merging anyway.
Governa commented 2020年12月24日 02:48:38 +01:00 (Migrated from github.com)
Copy link

I've created another PR #101 that fixes all problems with PNG x SVG and some more.

I've created another PR #101 that fixes all problems with PNG x SVG and some more.
Governa commented 2020年12月24日 02:59:06 +01:00 (Migrated from github.com)
Copy link

PR #100 (this one) with PR #101 should fix #11

PR #100 (this one) with PR #101 should fix #11
WhyNotHugo commented 2020年12月24日 13:56:34 +01:00 (Migrated from github.com)
Copy link

Looks good, thanks for implementing this, it's been much requested!

Looks good, thanks for implementing this, it's been much requested!
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
WhyNotHugo/python-barcode!100
Reference in a new issue
WhyNotHugo/python-barcode
No description provided.
Delete branch "feature/longer_guard_bar"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?