Skip to content

Commit 3d49849

Browse files
committed
Fix intercharacter gap calculation in Code39View
Modify the calculation of intercharacterGapCount in Code39View.swift: - Subtract 1 from the result of (barcode.count % 9)
1 parent 760251b commit 3d49849

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Code39/Code39View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct Code39View: View {
1717

1818
public var body: some View {
1919
Canvas { context, size in
20-
let intercharacterGapCount = barcode.count % 9
20+
let intercharacterGapCount = (barcode.count % 9) - 1
2121
let narrowBarWidth = size.width / CGFloat(((((barcode.count - intercharacterGapCount) / 9) * 15) + intercharacterGapCount))
2222
var currentX: CGFloat = 0
2323
for (index, barWidth) in barcode.enumerated() {

0 commit comments

Comments
 (0)