BarcodeLib (Open-Source) Comprehensive Technical Analysis |
Part 3 of 19 |
19. Linear (1D) Barcode Symbologies: Conceptual Foundations |
19.1 Definition of Linear Barcodes |
1. Linear barcodes, also known as 1D barcodes, encode information along a single horizontal axis. |
2. Information is represented through: |
1. Alternating bars and spaces |
2. Varying widths |
3. The scanner interprets: |
1. Relative bar width |
2. Relative space width |
4. BarcodeLib supports several of the most widely used linear symbologies. |

|
19.2 Why Linear Barcodes Remain Relevant |
1. Despite the rise of 2D codes, linear barcodes remain dominant in: |
1. Retail |
2. Logistics |
3. Manufacturing |
2. Reasons include: |
1. Simpler scanners |
2. Faster decoding |
3. Lower printing tolerance requirements |
3. BarcodeLib strong support for linear codes makes it suitable for: |
1. Legacy systems |
2. Compliance-driven environments |

|
20. Code 39: Architecture and Encoding Rules |
20.1 Overview of Code 39 |
1. Code 39 is one of the oldest and simplest linear barcode symbologies. |
2. It supports: |
1. Uppercase letters A–Z |
2. Digits 0 |
3. A limited set of special characters |
3. Code 39 is: |
1. Self-checking |
2. Optional checksum-based |
20.2 Character Structure |
1. Each Code 39 character consists of: |
1. Nine elements |
2. Five bars |
3. Four spaces |
2. Among these: |
1. Three elements are wide |
2. Six elements are narrow |
3. BarcodeLib stores these patterns as: |
1. Hard-coded width sequences |
2. Boolean or numeric representations |
20.3 Start and Stop Characters |
1. Code 39 uses: |
1. The asterisk character (*) as both start and stop |
2. BarcodeLib automatically: |
1. Prepends start |
2. Appends stop |
3. Developers do not need to: |
1. Include the asterisk in input data |
20.4 Optional Checksum Handling |
1. Code 39 supports an optional Mod 43 checksum. |
2. BarcodeLib allows: |
1. Enabling or disabling checksum generation |
3. When enabled: |
1. Input characters are mapped to numeric values |
2. Values are summed |
3. Modulo 43 is applied |
4. The checksum character is: |
1. Appended before the stop character |
20.5 Implementation Characteristics in BarcodeLib |
1. Encoding is performed via: |
1. Lookup tables |
2. Direct pattern expansion |
2. No compression or optimization is applied. |
3. This favors: |
1. Readability |
2. Debuggability |
4. Output is deterministic and specification-aligned. |

|
21. Code 128: High-Density Linear Encoding |
21.1 Overview of Code 128 |
1. Code 128 is a high-density alphanumeric barcode. |
2. It supports: |
1. Full ASCII (027) |
3. It is widely used in: |
1. Logistics |
2. Shipping labels |
3. GS1-128 applications |
21.2 Code Sets A, B, and C |
1. Code 128 uses three code sets: |
1. Code Set A: Uppercase letters and control characters |
2. Code Set B: Uppercase and lowercase letters |
3. Code Set C: Numeric pairs (009) |
2. BarcodeLib implements: |
1. Dynamic code set switching |
2. Automatic optimization in many cases |
21.3 Start Codes and Switching Logic |
1. Encoding begins with a start code: |
1. Start A |
2. Start B |
3. Start C |
2. BarcodeLib selects the start code based on: |
1. Input content |
2. Numeric density |
3. During encoding: |
1. Switch codes may be inserted |
2. Shifts may be used temporarily |
21.4 Checksum Calculation |
1. Code 128 uses a weighted checksum: |
1. Start code has weight 1 |
2. Each subsequent symbol increments weight |
2. BarcodeLib computes: |
1. Weighted sum |
2. Modulo 103 |
3. The checksum symbol is: |
1. Appended before the stop symbol |
21.5 BarcodeLib Encoding Trade-Offs |
1. BarcodeLib prioritizes: |
1. Correctness |
2. Simplicity |
2. Advanced compression strategies: |
1. May not be fully optimal |
3. However: |
1. Generated barcodes remain fully compliant |
2. Scannability is excellent |

|
22. EAN-13: Retail-Oriented Encoding |
22.1 Overview of EAN-13 |
1. EAN-13 is the dominant retail barcode outside North America. |
2. It encodes: |
1. 13 numeric digits |
3. The structure includes: |
1. Number system digit |
2. Manufacturer code |
3. Product code |
4. Check digit |
22.2 Left and Right Encoding Sets |
1. EAN-13 uses: |
1. Left-side odd parity |
2. Left-side even parity |
3. Right-side encoding |
2. Parity is determined by: |
1. The first digit |
3. BarcodeLib implements: |
1. Parity pattern lookup |
2. Digit-wise encoding |
22.3 Guard Bars |
1. EAN-13 includes: |
1. Left guard |
2. Center guard |
3. Right guard |
2. BarcodeLib hard-codes: |
1. Guard patterns |
3. Guard bars are: |
1. Taller than data bars |
2. Essential for scanner synchronization |
22.4 Check Digit Calculation |
1. The EAN-13 check digit uses: |
1. Weighted sum |
2. Alternating weights of 1 and 3 |
2. BarcodeLib: |
1. Calculates the digit automatically |
3. Input data typically excludes: |
1. The check digit |

|
23. UPC-A and UPC-E |
23.1 UPC-A Structure |
1. UPC-A encodes: |
1. 12 numeric digits |
2. It is structurally similar to EAN-13. |
3. BarcodeLib: |
1. Reuses EAN encoding logic |
2. Applies UPC-specific rules |
23.2 UPC-E Compression |
1. UPC-E is a compressed form of UPC-A. |
2. It reduces: |
1. Barcode width |
3. Compression rules depend on: |
1. Manufacturer code patterns |
4. BarcodeLib: |
1. Expands UPC-E internally |
2. Encodes using UPC-A logic |
23.3 Implementation Notes |
1. UPC-E support is more complex. |
2. BarcodeLib: |
1. Validates compression eligibility |
2. Rejects invalid inputs |
3. This avoids: |
1. Ambiguous decoding |
2. Retail system rejection |

|
24. Interleaved 2 of 5 (ITF) |
24.1 Overview of ITF |
1. Interleaved 2 of 5 encodes: |
1. Numeric-only data |
2. Digits are encoded in pairs: |
1. One digit in bars |
2. One digit in spaces |
3. It is common in: |
1. Carton labeling |
2. Warehouse logistics |
24.2 Even-Length Requirement |
1. ITF requires: |
1. An even number of digits |
2. BarcodeLib: |
1. Enforces this rule strictly |
3. Odd-length inputs result in: |
1. Immediate exceptions |
24.3 Start and Stop Patterns |
1. ITF uses: |
1. Narrow bar start |
2. Wide bar stop |
2. BarcodeLib: |
1. Uses fixed-width ratios |
3. No dynamic ratio adjustment is performed. |

|
25. Codabar |
25.1 Codabar Characteristics |
1. Codabar supports: |
1. Numeric digits |
2. Limited punctuation |
2. It is used in: |
1. Libraries |
2. Blood banks |
3. Codabar includes: |
1. Explicit start and stop characters |
25.2 BarcodeLib Codabar Handling |
1. BarcodeLib: |
1. Requires explicit start/stop characters |
2. This differs from: |
1. Some other symbologies |
3. This design choice: |
1. Matches original Codabar specifications |

|
26. PostNet and Similar Postal Codes |
26.1 Overview |
1. PostNet is a numeric barcode used for: |
1. Postal routing |
2. It uses: |
1. Tall and short bars |
3. BarcodeLib implements: |
1. Bar-height-based encoding |
26.2 Check Digit Logic |
1. PostNet uses: |
1. Modulo 10 checksum |
2. BarcodeLib: |
1. Automatically appends checksum bar |

|
27. Rendering Implications for Linear Barcodes |
27.1 Bar Width Precision |
1. Linear barcodes are highly sensitive to: |
1. Width variation |
2. BarcodeLib: |
1. Calculates pixel widths explicitly |
3. No anti-aliasing is applied by default. |
27.2 Quiet Zones |
1. Quiet zones are: |
1. Mandatory blank areas |
2. BarcodeLib includes: |
1. Default margins |
3. Developers can: |
1. Adjust margins manually |

|
28. Limitations of Linear Barcode Support |
28.1 Missing Industrial Variants |
1. BarcodeLib does not natively support: |
1. All GS1 variants |
2. Specialized industrial codes |
2. These can be: |
1. Added manually |
2. Implemented via extension |
28.2 No Dynamic Ratio Adaptation |
1. BarcodeLib uses: |
1. Fixed wide-to-narrow ratios |
2. It does not: |
1. Adapt ratios for poor print environments |

|
29. Transition to Two-Dimensional Codes |
29.1 Why 2D Codes Matter |
1. 2D barcodes offer: |
1. Higher capacity |
2. Error correction |
2. BarcodeLib includes: |
1. Limited 2D support |
2. Specific symbologies |
29.2 Next Part Overview |
1. Part 4 will explore: |
1. Two-dimensional barcode symbologies |
2. Encoding logic differences |
3. Structural complexity compared to 1D codes |