buntine / barcoders

A barcode encoding library for the Rust programming language
Apache License 2.0
164 stars 24 forks source link

Code set escapes as data and GS1-128 support for Code-128 #10

Closed JakeTherston closed 6 years ago

JakeTherston commented 6 years ago

Hello. I hope this is the correct location to ask some questions. I read the barcoders' documentation on doc.rs but could not any mention of how to specify FNC1 as part of the input to Code128::new. Is it possible currently?

On a slightly related note, is it possible to specifyU+C0 as data to be encoded rather than an encoding flag?

buntine commented 6 years ago

Hey there,

So it seems I have the binary encodings for the FNC1..4 "characters" but my algorithm is clearly never goign to be able to pick up on them as it's a simple linear pass over the characters so "FNC1" would be interpreted as "F", "N", "C", "1".

I will fix this up in a similar fashion to what I have done with the character set switching. I will hijack some unicode characters to represent FNC1, FNC2, FNC3 and FNC4.

Finally, yes, you can use the unicode sequence to reference the code:

 let code128_b = Code128::new("\u{00C0}XY\u{0106}2199".to_owned()).unwrap();

The above is an example of using character set A and then switching to character set C half way through the barcode. This could also be encoded as:

 let code128_b = Code128::new("ÀXYĆ2199".to_owned()).unwrap();
buntine commented 6 years ago

Ok, the functionality is staged for deployment. I just need to write a couple tests and I'll ship a new version of the library ASAP.

buntine commented 6 years ago

Version 0.10.0 has been published and the documentation for FNC characters in Code128 barcodes has been updated. Please update and let me know if you have any issues.

Thanks for reporting the issue. :)