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

wrong ascii symbol for start and stop codes in code 128 #9

Closed Holger-Will closed 6 years ago

Holger-Will commented 7 years ago

As per Wikipedia the the start and stop symbols for code 128 are as follows:

Start Code A: Ð / ø Start Code B: Ñ / ù Start Code C: Ò / ú Stop Code: Ó / û

you use the non stardards complient symbols:

, [ 103, "11010000100", "code.StartCodeA", ["Ë"], false]
, [ 104, "11010010000", "code.StartCodeB", ["Ì"], false]
, [ 105, "11010011100", "code.StartCodeC", ["Í"], false]
, [null, "1100011101011", "code.stoppattern", ["Î"], false]

theses symbols are reserved as switch codes for switching between A,B and C encoding. I am the author of a (explicitly standaards complient) code 128 encoder (https://github.com/Holger-Will/code-128-encoder). And am getting complaints about my encoder not working with your font.

graphicore commented 7 years ago

Sorry, but you write:

As per Wikipedia

then

explicitly standaards complient

Do you imply that Wikipedia is the standard? There are other 128 encoders that work with the fonts, here are their encodings.

Unfortunately Wikipedia has collisions with these others and it doesn't cite the source of it's encoding table, so I don't know why it should be preferred.

Also talking about standards:

Ð, ø, Ñ, ù, Ò, ú, Ó, û are all Unicode characters and their meanings in the Unicode-Standard are:

I'd be more than happy to have encodings for START CODE A, START CODE B, START CODE C, START CODE, and the rest of the unclear CODE 128 symbols standardized somewhere, but it seems it isn't, at least not publicly available. Wikipedia is not a standards body, I'm afraid, and it is in dissent with other non-standard definitions.

graphicore commented 7 years ago

cc @davelab6

Holger-Will commented 7 years ago

You are probably right. At least for me Wikipedia as a community based source has a higher value than single sources on private websites, but in the end that does not mean much ;-) . The USS-128 spec does not define a symbol or rather byte mapping.

One possible source could still be DIN EN 799. Unfortunately EN Specifications are not publicly available and i'm not willing to spend 70€ just to check...

In the Wikipedia table the cited source is "Common/Barcodesoft" In my font i'm using both. for example the Start A code is given as

103 Start Code A 208 / 248 Ð / ø 11010000100 211412

So i have Characters Ð and ø or bytes 208 and 248 map to 11010000100. At least the "Common" mapping clashes with the mapping you use in your font. Using both mappings in one font is impossible...

One solution would be to use the "Barcodesoft" mapping (Bytes 240 and above). If you could add these mappings to your font, it would be compatible with what you have right now and with the "Barcodesoft" mapping. I would switch my encoder to use the "Barcodesoft" mapping as well, and my font already has these mappings build in. That would ensure the highest compatibility... what do you think?

aside

Ð, ø, Ñ, ù, Ò, ú, Ó, û are all Unicode characters

they might also be Unicode characters, but first and foremost these are just the character representations of bytes 200 and above in extended ascii interpreted as latin-1 as per ISO-8859-1. ISO 8859-1 is the common 8-bit character encoding used by the X Window System, and most Internet standards used it before Unicode.(https://en.wikipedia.org/wiki/Extended_ASCII#ISO_8859_and_proprietary_adaptations)

Holger-Will commented 7 years ago

On a side note, what is listed as "common" mapping in wikipedia, is not the most common mapping. After a bit of research, it seem the mapping you use is the most common one. It might be appropriate to alter the wikipedia table to use that mapping besides the barcodesoaft mapping instead of what is listed as "common" there...

davelab6 commented 7 years ago

It might be appropriate to alter the wikipedia table

Please do!

Holger-Will commented 7 years ago

ok, i will care about the wikipedia table.

davelab6 commented 6 years ago

I suggest this can be closed

Holger-Will commented 6 years ago

fine with me, please go ahead and close this...

Holger-Will commented 5 years ago

finally got around changing the wikipedia page and my encoder...

traut21 commented 10 months ago

Could someone explain to me please: What is a "Barcodesoft" mapping and where does it come from? The wikipedia table names it, but it does not give any source.

As written here above, Start Code C has the value 105, hex 69 and has the output 211232 (██_████).

That's the Code 128 definition, isn't it? So why don't you just stick to the hex value %x69?

Of course you might put over that some kind of random (!?) character mapping. But where do those numbers 208 / 248 and unicode characters Ð / ø come from? Why two source characters for one definition? I feel that this is just some application "crap", which is not part ot the code definition, but some extra layer someone used for better handling, even using special compromises for certain characters that can not be displayed on Windows systems.

A mapping table like that should be kept completely separate from the barcode definition, shouldn't it?

Personally, I'm more interested in how to achieve a certain character, such as 1: from Code 128A hex 11 or from Code 128B hex 11 x: from Code 128B hex 58 À: from Code 128A: FNC4/hex 40 à: from Code 128A: FNC4/Shift B/hex 40

I do not understand yet what FNC 4 and Shift A from Code 128B will do. Do you know?