From 3d4984997699e72646df3a4d68fc805a40a71c97 Mon Sep 17 00:00:00 2001 From: Jia-Han Wu Date: Sun, 14 Jul 2024 20:34:13 +0800 Subject: [PATCH] Fix intercharacter gap calculation in Code39View Modify the calculation of intercharacterGapCount in Code39View.swift: - Subtract 1 from the result of (barcode.count % 9) --- Sources/Code39/Code39View.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Code39/Code39View.swift b/Sources/Code39/Code39View.swift index 51cad95..2094a94 100644 --- a/Sources/Code39/Code39View.swift +++ b/Sources/Code39/Code39View.swift @@ -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() {