graphicore / librebarcode

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

Encoding for UPC-A in Crystal Reports #55

Closed imaximenko closed 1 year ago

imaximenko commented 1 year ago

Was anyone able to get a UPC-A barcode to work in Crystal Reports using the standard or fallback input method?

I could only get the compatible method to work but it displays the EAN version with 13 digits containing a 0 in the front.

Is there a way to get the HarfBuzz encoding done in CR or install something to support the OpenType features?

Thanks in advance.

graphicore commented 1 year ago

Hi @imaximenko , thanks for reporting. Out of curiosity, can you describe how the fallback input misbehaves? I'd be eager to learn about it. Is the text encoding of the input text something else than UTF-8? Maybe you can set it to proper UTF-8 somewhere?

imaximenko commented 1 year ago

Hi @graphicore,

I am not able to encode the value to produce the fallback output. If I manually specify it, it works:

image

I believe the text is UTF-8 encoded, I don't see any settings in CR that allow for "contextual alternates" like it in MS Word.

graphicore commented 1 year ago

Ok, so obviously the OT-Features are not working (first barcode). But initially you wrote you couldn't get the fallback style to work, but it seems to work. Both fallback and compatible style are relying on encoding the string externally of/prior to the font shaping. The fallback method encoder uses actually Harfbuzz (Harfbuzz JS) to shape the input in Javascript, then it extracts the character codes from the resulting glyph string. If it would be possible to run a JavaScript engine with with WebAssembly in your host you might have a chance to re-use that code.

imaximenko commented 1 year ago

Got it, sorry if I wasn't clear in my original post.

I was wondering if anyone was able to do the encoding using Crystal's formula syntax or another method to keep it self contained in the report and not having to pull JS/WebAssembly into the mix.

Thanks so much for the prompt reply and this great project!

graphicore commented 1 year ago

Maybe with .NET in Chrystal Reports UFL (User Function Libraries) in formulas it could be possible to access windows font-shaping methods and do the same as the js/harfbuzz version of the fallback encoder. It also seems that Harfbuzz is available through Java. But I don't know any details of this stack and can't advise.

graphicore commented 1 year ago

Closing: no more feedback.