Skip to content

Commit

Permalink
Fix intercharacter gap calculation in Code39View
Browse files Browse the repository at this point in the history
Modify the calculation of intercharacterGapCount in Code39View.swift:
- Subtract 1 from the result of (barcode.count % 9)
  • Loading branch information
jiahan-wu committed Jul 14, 2024
1 parent 760251b commit 3d49849
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Code39/Code39View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public struct Code39View: View {

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

0 comments on commit 3d49849

Please sign in to comment.