Barcode-Lib4J requires Java 9+

Java Class «LineageTwoWidth»

java.lang.Object
de.vwsoft.barcodelib4j.oned.Barcode
de.vwsoft.barcodelib4j.oned.LineageTwoWidth
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ImplCodabar, ImplCode11, ImplCode39, ImplITF

public abstract class LineageTwoWidth extends Barcode
Abstract class used as the basis for barcode types characterized by bars with only two distinct widths.

Such barcodes are commonly referred to as two-width barcodes.

The ratio between the two widths can typically be freely selected within the range from 2:1 to 3:1. The primary objective is to optimize scanning efficiency. A higher ratio tends to make it easier for the scanner to distinguish between wide and narrow bars. This feature thus allows the barcode to adapt to different conditions and ensures readability resilience against factors such as poor print quality, environmental influences or physical damage.

  • Field Details

    • DEFAULT_RATIO

      public static final float DEFAULT_RATIO
      The default value is 2.5F, corresponding to a ratio of 2.5:1.
  • Method Details

    • setRatio

      public void setRatio(float ratio)
      Description copied from class: Barcode
      Sets the ratio between the width of the wide bars and the width of the narrow bars in two-width barcode types. The value must be in the range 2.0F to 3.0F, corresponding to ratios of 2.0:1 to 3.0:1. If not explicitly set, the default ratio is DEFAULT_RATIO.
      Overrides:
      setRatio in class Barcode
      Parameters:
      ratio - the ratio between the width of the wide bars and the width of the narrow bars in the barcode symbol in the range 2.0F to 3.0F
    • getRatio

      public float getRatio()
      Description copied from class: Barcode
      Returns the ratio value.
      Overrides:
      getRatio in class Barcode
      Returns:
      the ratio value