*Libre Barcode*

EAN 13 Manual

Available font variants:

The EAN 13 font implements all of the EAN/UPC symbology in GS1 General Specifications (version 20), get the PDF start at 5.2 Linear barcodes - EAN/UPC symbology specifications.

That is the symbol types:

Wikipedia has a bunch of relevant articles: EAN, EAN-8 and UPC

Contents

Usage TL;DR

The font aims to make barcode creation as simple as possible: Enter your digits, the font does all the rest. Don’t know the check digit? Use a “?” (question mark) as placeholder and the font will calculate it for you:

See the Expected Inputs for details.

Play with the interactive EAN 13 Encoder.

Usage Details

This sounds easy, however, in this symbology there’s no straight one to one mapping from digit entered to barcode symbol. Au contraire, each digit relates to 3 pattern variants (called Set A, B and C) which are used to codify additional information in the barcode, depending on how they are intermixed. Adding the special layout characteristics of the different symbol types and the requirements of the “Compatible” input method we end up with 13 different glyphs per digit. The complexity increases by the way different structuring “guard” patterns have to be inserted.

Standard Input Method

The preferred way to use this font is by the Expected Inputs, optionally with the question mark as placeholder to trigger check-digit calculation. This requires no step in-between and keeps the value of the barcode in the document, that means e.g. that full text search and copy and paste will keep working.

The rules to compose the correct barcodes from the Expected Inputs are implemented in the font as OpenType Feature namely by the calt “Contextual Alternates” feature.

“This feature should be active by default.”, says the spec, and a modern text rendering pipeline will execute it without problems by default. However, not all software is equally fit, and so there are currently different issues e.g. with Microsoft Office or Apple iOS Browsers and different approaches to mitigate them:

Fallback Input Method

For cases where there are no functioning OpenType features available, all glyphs of the font are encoded with a Unicode character-code, this makes them accessible directly. However, the input string becomes cryptic, it does not reflect the value that is associated with the barcode. Encoding by hand is not an option, and therefore a fallback encoder exists. The encoder takes the same numeric input as the font and outputs a string of characters that will render the exact same as the OpenType feature enabled version. This encoder uses the original font and is shaping (executing the OpenType features) in JavaScript (using Harfbuzz-JS), the resulting output glyphs are used to get their Unicode character-code. This way, the fallback encoder will always be en par with the font implementation. Low maintenance!

There’s a EAN 13 Encoder on this page and an EAN 13 Bulk Encoder for many codes.

Compatible Input Method

Another FLOSS font for the EAN/UPC family exists: grandzebu.net: The EAN 13 code. The Libre Barcode font uses an encoding compatible to the Grandzebu font. This means barcodes that are encoded for the Grandzebu font can also be displayed with the Libre Barcode font. And further, Grandzebu provides Visual Basic 6 encoder tools, that can also be used in a VBA macro linked to Excel or Word documents.

The downside is, that the compatible mode, in some cases, doesn’t have the subtlety as required by the spec, in terms of the barcode layout. Despite of the not optimal layout, the barcodes it can produce will still be perfectly readable for barcode scanners. Besides that, it also lacks the “Special Guard” bar pattern, which is required for UPC-E.

A compatible encoder is available, it works similar to the fallback encoder.

There’s a EAN 13 Encoder on this page and an EAN 13 Bulk Encoder for many codes.

Expected Inputs

The font is optimized for a range of inputs that make sense in the context of the EAN/UPC symbology:

What follows is a table of expected inputs. Inputs outside of these expected cases will not produce useful barcodes or unwanted effects.

Main Symbols
EAN-13
Pattern
D = a digit
DDDDDDDDDDDDD or DDDDDDDDDDDD?
Example 0012345678905 or 001234567890?
Description 13 digits, the last digit is the check digit.
Code 001234567890?
EAN-8
Pattern
D = a digit
DDDDDDDD or DDDDDDD?
Example 12345670 or 1234567?
Description 8 digits, the last digit is the check digit.
Code 1234567?
UPC-A
Pattern
D = a digit
DDDDDDDDDDDD or DDDDDDDDDDD?
Example 012345678905 or 01234567890?
Description 12 digits, the last digit is the check digit.
Code 01234567890?
UPC-E short input
Pattern
D = a digit
xDDDDDDD or xDDDDDD?
Example x1234558 or x123455?
Description "x" (lower case x) and 7 digits, the last digit is the check digit.
Code x123455?
UPC-E long input
Pattern
D = a digit
XDDDDDDDDDDDD or XDDDDDDDDDDD?
Example X098400000751 or X09840000075?
Description "X" (upper case X) and 12 digits, the last digit is the check digit.
NOTE: UPC-E is a compressed "zero-suppressed" form of certain UPC-A codes that start with a zero and feature four or five zeros in a row starting from certain positions. Not all possible 12-digit inputs can be compressed into UPC-E and if not possible the font will also fail to create a functional barcode. This input method is maybe most useful to test if a UPC-A code qualifies as UPC-E.
Code X09840000075?
Add Ons
The add on symbols are not meant to stand-alone, however, there's a method to produce them by prefixing them with a "-" (minus sign).
2-digit
Pattern
D = a digit
-DD
Example -34
Description "-" (minus sign) and 2 digits.
Code -34
5-digit
Pattern
D = a digit
-DDDDD
Example -87613
Description "-" (minus sign) and 5 digits.
Code -87613
Main Symbols + Add Ons
EAN13, UPC-A and UPC-E can be expanded by an Add-On. Input is done by simply adding two or five digits directly after the main symbol. EAN-8 does not support Add-Ons.
EAN13 - 2-digit
Pattern
D = a digit
DDDDDDDDDDDDDDD or DDDDDDDDDDDD?DD
Example 001234567890512 or 001234567890?12
Description 15 digits or 12 digits, a question mark and 2 digits.
Code 001234567890?12
EAN13 - 5-digit
Pattern
D = a digit
DDDDDDDDDDDDDDDDDD or DDDDDDDDDDDD?DDDD
Example 001234567890512987 or 001234567890?12987
Description 18 digits or 12 digits, a question mark and 5 digits.
Code 001234567890?12987
UPC-A - 2-digit
Pattern
D = a digit
DDDDDDDDDDDDDD or DDDDDDDDDDD?DD
Example 01234567890512 or 01234567890?12
Description 14 digits or 11 digits, a question mark and 2 digits.
Code 01234567890?12
UPC-A - 5-digit
Pattern
D = a digit
DDDDDDDDDDDDDDDDD or DDDDDDDDDDD?DDDDD
Example 01234567890512987 or 01234567890?12987
Description 17 digits or 11 digits, a question mark and 5 digits
Code 01234567890?12987
UPC-E short - 2-digit
Pattern
D = a digit
xDDDDDDDDD or xDDDDDD?DD
Example x123455883 or x123455?83
Description "x" and 9 digits or "x" and 6 digits, a question mark and 2 digits.
Code x123455?83
UPC-E short - 5-digit
Pattern
D = a digit
xDDDDDDDDDDDD or xDDDDDD?DDDDD
Example x123455883045 or x123455?83045
Description "x" and 12 digits or "x" and 6 digits, a question mark and 5 digits.
Code x123455?83045
UPC-E long - 2-digit
Pattern
D = a digit
XDDDDDDDDDDDDDD or XDDDDDDDDDDD?DD
Example X04567000008062 or X04567000008?62
Description "X" and 14 digits or "X" and 11 digits, a question mark and 2 digits.
Code X04567000008?62
UPC-E long - 5-digit
Pattern
D = a digit
XDDDDDDDDDDDDDDDDD or XDDDDDDDDDDD?DDDDD
Example X09840000075183611 or X09840000075?83611
Description "X" and 17 digits or "X" 11 and digits, a question mark and 5 digits.
Code X09840000075?83611

There’s an EAN 13 Technical Testing page with many examples.

There’s also an EAN 13 Bulk Encoder for many codes.

EAN 13 Encoder

Standard Input Method

Z

Fallback Input Method

Z

Compatible Input Method

Z

With the Grandzebu font:

Z