3

I'm using Libre Barcode 128 from Google Fonts to generate barcodes on a webpage. If I wanted to encode a string so that it was properly displayed with this font, how would I do that?

For example, I know that code128 barcodes need a checksum of some kind, and start/stop characters. However, the Libre Barcode project has no documentation about how this is calculated, nor how their characters map to glyphs.

Barcodes generated using the font alone will not scan. What steps are necessary to implement Code 128 barcode generation using Libre Barcode Fonts?

Brian Anderson
  • 1,661
  • 1
  • 17
  • 27
xd1936
  • 1,038
  • 2
  • 9
  • 27
  • 1
    People are flagging this as "off topic", I don't understand why, it seems like a perfectly reasonable question. Can someone explain what I am missing? – TMB Nov 30 '17 at 22:12
  • They probably think your question is overly broad. This was the explanation 3 out of 4 times. - "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – TMB Nov 30 '17 at 22:13
  • 2
    They want to see this... "describe the problem and what has been done so far to solve it." – TMB Nov 30 '17 at 22:18
  • I think the problem is that it is impossible to create Code 128 barcodes that will scan without access to the start (B) and stop characters (which I found no mention of on the Libre Barcode Google font page) and you have to generate a checksum. My recommendation is find another Code 128 library or use the Libre Code 39 font which restricts you to uppercase alpha and numeric data. – Brian Anderson Dec 01 '17 at 00:35
  • 1
    This was fantastically helpful, thank you. I see the problem with the start/stop characters now, and have filed an issue on the Libre Barcode Github project asking for documentation. https://github.com/graphicore/librebarcode/issues/14 – xd1936 Dec 01 '17 at 18:26
  • Thanks, @xd1936. If you could edit your question to reflect the more specific concern you had with generating the checksum and the start and stop characters, I will try to get the question cleared from on-hold status so I can include a javascript snippet that calculates Code 128 checksums for input strings. Then we can get the Libre Barcode people more directed towards including support for the high ASCII codes for starting, stopping, etc. – Brian Anderson Dec 01 '17 at 21:45
  • Here's a codepen that solves the problem: https://codepen.io/notionovus/pen/BmvQJE . – Brian Anderson Dec 02 '17 at 17:59
  • 1
    here an open source implementation for generating start and stop https://github.com/Holger-Will/code-128-encoder – M.Ali El-Sayed Feb 08 '19 at 21:19

0 Answers0