graphicore / librebarcode

Libre Barcode: barcode fonts for various barcode standards.
https://graphicore.github.io/librebarcode
SIL Open Font License 1.1
425 stars 25 forks source link

Document Use of code128 Generation in Libre Barcode 128 #14

Closed leoherzog closed 5 years ago

leoherzog commented 6 years ago

This is a great project, keep up the good work!

If I was to use the Libre Barcode 128 font in my web project, there is no documentation anywhere as to how to generate a code128 checksum, convert a string to code128, or what the start/stop characters are in your font. Please consider adding some documentation to this project's README, because simply applying your font to a span of text will not render a scannable barcode. Thanks!

homerggg commented 6 years ago

For your information, I found out that the following are the start and stop characters : Ì and Î.

leoherzog commented 6 years ago

Thanks for the info!

If I have a string that's *0123456* in Libre Barcode 39, it renders a scannable code.

If I do Ì0123456Î in Libre Barcode 128, I haven't had any luck.

I guess I'll stick with 39 for the time being...

graphicore commented 6 years ago

Sorry for responding slowly.

@xd1936 for code 128 you'll need a generator, because the encoding of that is not one to one what you type.

This one usually works for me: http://www.jtbarton.com/Barcodes/BarcodeStringBuilderExample.aspx (but there are others as well) the result of 0123456 is Í!7MÈ6lÎ

selection_200

from here: https://fonts.google.com/specimen/Libre+Barcode+128+Text

UPDATE: especially consecutive numbers are optimized in code 128, that's why the text-below in the example above is not really helpful.

leoherzog commented 6 years ago

Understood! How would I find more information on the algorithm that converts a string to properly encoded text? I'm looking to implement this in Javascript in a project.

robertjpayne commented 6 years ago

@graphicore yea it'd be super useful to have an open source implementation of an encoder that works for this font.

There's zero documentation anywhere about it and your links no longer work.

graphicore commented 6 years ago

Agreed. There's documentation at Wikipededia: https://en.wikipedia.org/wiki/Code_128 (see Barcode length optimization. What we need is a good dynamic algorithm to find the shortest encoding.

Here's a working online encoder: https://www.bcgen.com/fontencoder/

RiverHeart commented 5 years ago

Still trying to understand Code128 myself but I have what I think is a working, rudimentary Powershell implementation here. No digit optimization yet, but if I understand correctly, it just encodes double digits as a single value with Code C, so you'd need a lookahead to detect double digits. Shouldn't be difficult to convert to Python/Javascript if anyone wants to.

graphicore commented 5 years ago

I'm implementing an optimizing encoder now, will be in JavaScript and online soon.

graphicore commented 5 years ago

here: https://graphicore.github.io/librebarcode

RichardSchwinn commented 2 years ago

This is all terrific. How can I access the encoder in my php / java apps?