-
-
Notifications
You must be signed in to change notification settings - Fork 133
Description
Add option to control light margin indicator (>) in EAN-13 barcodes
Problem Description
Currently, when generating EAN-13 barcodes with human-readable text enabled, python-barcode automatically adds a light margin indicator (>) character at the end of the barcode text. This is a valid standard practice, but there are use cases where users would want control over this feature.
Current Behavior
- EAN-13 barcodes with text display include the
>character as a light margin indicator - There's no option to remove this indicator while keeping other human-readable text
- The only workaround is to use
write_text=Falseand implement text separately
Expected Behavior
Provide an option to control the display of the light margin indicator independently from other human-readable text.
Proposed Solution
Add a new option called show_light_margin_indicator (or similar) that allows users to control this feature:
options = {
'write_text': True,
'show_light_margin_indicator': False # New option
}This option would default to True to maintain backward compatibility.
Use Cases
- Custom barcode designs where the light margin indicator conflicts with layout
- Integration with existing systems that handle quiet zones differently
- Creating minimal/clean barcode displays
- Maintaining consistent styling across different barcode types
Implementation Suggestions
The light margin indicator is likely added in the text rendering section of the EAN-13 implementation. The option would need to:
- Be added to the available options for EAN-13 barcodes
- Control whether the
>character is appended to the human-readable text - Be documented in the options section
Additional Context
The light margin indicator (>) serves as a visual reminder of the required quiet zone on the right side of the barcode. While it's a useful standard feature, providing an option to control its display would give users more flexibility without removing it entirely for backward compatibility.
Example Code
import barcode
from barcode.writer import ImageWriter
# Create barcode with light margin indicator (current default)
ean = barcode.get('ean13', '123456789012', writer=ImageWriter())
filename = ean.save('with_indicator', options={'write_text': True})
# Create barcode without light margin indicator (proposed)
options = {
'write_text': True,
'show_light_margin_indicator': False
}
ean = barcode.get('ean13', '123456789012', writer=ImageWriter())
filename = ean.save('without_indicator', options=options)Backward Compatibility
This feature would be completely backward compatible as the default value would maintain current behavior.