Barcode Generation

Barcode Fonts Explained: When Can a Font Make a Scannable Barcode?

Learn how barcode fonts and encoders work, compare Code 39 and Code 128 examples, and check a printed symbol against its original data.

Share
Table of contents

A barcode font can turn correctly prepared text into bars, but installing a font alone does not guarantee a valid or readable barcode. You must choose a symbology your system accepts, prepare the data according to that particular font’s instructions, render it at a suitable size, and scan the result back to the original value. Some fonts need an encoder to add the information required by the symbology.

The path is source data → font-specific preparation or encoder → barcode font → printed or rendered symbol → scan and compare. A barcode-looking pattern is only an intermediate result.

What a font does—and what it does not do

A barcode font maps characters to visual patterns. An encoder prepares data for a particular font and symbology; depending on the combination, it may add start and stop information, select a code set, and calculate a check character. The receiving scanner must support the symbology and send data in a form your application expects.

A font does not issue a registered product identifier, create an inventory record, or prove a label meets a retailer’s requirements. If your task requires a UPC, an assigned GTIN and the correct UPC encoding rules matter separately from the choice of font.

Code 39 and Code 128: two different preparations

Question Libre Barcode 39 plain variant Libre Barcode 128
Input Supports uppercase letters, digits, certain punctuation and space. The author’s encoder prepares the input for the font.
Preparation The author instructs users to wrap the input in asterisks. The encoder selects code sets as needed and calculates a checksum character before the stop symbol.
Important limitation Extended characters require the extended variant and compatible scanner interpretation. Typing ordinary text and merely changing the font does not perform the documented encoding step.

These are instructions for the named Libre Barcode fonts, not a universal recipe for every font. Other implementations can use different character mappings, optional checks or encoders. Follow the documentation that accompanies the exact font and the receiving application’s requirements. [1][2]

A Code 39 illustration

Suppose your original internal value is AB-12. The Libre Barcode 39 plain-font input would be *AB-12*: the asterisks supply the start and stop characters for that font. Apply the specified font to the prepared text, then scan the rendered or printed result and compare the decoded data with AB-12. [1]

This is an illustrative input, not a barcode we generated or tested. Asterisks are not an instruction to alter the source record or to add them to Code 128 data. Keep the original value in a separate field so you can compare it with the scan.

The Libre Barcode project also warns that some scanners interpret extended Code 39 as ordinary Code 39 and may return the underlying character pairs rather than the intended lowercase or special character. Test the exact input and scanner configuration if you need extended characters. [1]

A Code 128 illustration

For Libre Barcode 128, enter the intended value into a compatible encoder first. The project describes an encoder that selects among Code Sets A, B and C and calculates the checksum; copy the encoded output and render it with the matching font. [2] The encoded text may look unlike the original value in an ordinary font. Do not edit that intermediate string by hand or use an encoder made for an unrelated font without checking compatibility.

A practical workflow

  1. Confirm the job. What data should the scan return, and which barcode types does the receiving scanner and application support? For regulated or retailer labels, ask for the applicable specification and identifier.
  2. Preserve the source. Store identifiers as text where necessary, including leading zeros. Microsoft explains that spreadsheet conversion can remove leading zeros; if data has already changed, return to the trusted source. [3]
  3. Choose the font and encoder together. Check the license, supported characters, required preparation, output and application support. Install the font from its trusted source and follow that font’s instructions.
  4. Prepare and render. For Libre Barcode 39 plain, for example, use the author’s asterisk syntax for supported input. For Libre Barcode 128, run the matching encoder before applying the font. Preserve the unencoded source separately.
  5. Print or render at the intended size. Leave the quiet zones required by the chosen symbology and application. Check that the document or export has retained the intended font and has not clipped or distorted the symbol.
  6. Scan and compare. Use the intended scanner and application. Compare every character—including zeros, case, spaces and punctuation—with the source, then confirm that the correct record opens. For batches, test representative values and reconcile the output before applying labels.

A successful scan is evidence for that sample and setup. If a trading partner requires a formal quality grade, arrange the appropriate verification; a phone scan alone does not establish that grade. [4]

If the symbol does not scan or returns the wrong data

  • It looks like bars but will not scan: Check that the correct font is actually applied and that the font-specific start/stop or encoder step was completed. Confirm the scanner has the symbology enabled.
  • Some characters are wrong: Check the font’s character set and whether an extended mode is required and enabled on the scanner. Compare the source, prepared string and scan output.
  • Zeros disappear: Inspect import, spreadsheet formatting and export. Restore the original value from the source before recreating the symbol. [3]
  • It reads on screen but not on the label: Check actual printed size, contrast, quiet zones, clipping, stock and print quality. Repeat the test on the target label and scanner.
  • The value reads correctly but opens the wrong item: Investigate duplicates and the mapping in the receiving system; a font cannot correct a mismatched record.

References

[1] Libre Barcode Project. Code 39. https://graphicore.github.io/librebarcode/documentation/code39.html

[2] Libre Barcode Project. Code 128. https://graphicore.github.io/librebarcode/documentation/code128.html

[3] Microsoft Support. Keeping leading zeros and large numbers. https://support.microsoft.com/en-us/excel/keeping-leading-zeros-and-large-numbers

[4] GS1. 1D Barcode Verification Process Implementation Guideline. https://www.gs1.org/docs/barcodes/GS1_Bar_Code_Verification.pdf