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

Google Docs - Libre Barcode 128/39 #25

Closed Jout8 closed 3 years ago

Jout8 commented 4 years ago

Hello. I'm having issues getting Libre Barcode 128 to scan in Google docs. I can scan in Google sheets when referencing another cell but not in a document file. Is there something I could be missing?

dad-attitude commented 4 years ago

Hey I'm having the same issue, actually couldn't get any of the Libre Barcode fonts to create a scannable barcode in Google Docs. I got it working fine in Sheets and Slides. I did file feedback with Google but their screenshot tool would not capture the barcode properly. It appears that in Docs extra bars are inserted on any text entered. I am attaching a screenshot. On the Docs barcode (highlighted in blue) there is an unselectable section of bars that get added to every line. Underneath I have included a screenshot of the same barcode in Sheets that does not have the extra bars and is scannable. docs vs sheets barcodes

graphicore commented 4 years ago

Thanks for reporting. Sorry I'm really busy right now, but I'll look into it.

@dad-attitude you are using Code 39 here, right?

dad-attitude commented 4 years ago

Yes, all the code 39 barcodes in Docs had the same result for me. The excess bars get appended to any text entered. I assumed it might need to be fixed on the Google side (since the fonts work fine in Sheets and Slides) but wasn't sure and their support process is kind of nebulous so I figured I would also add my info here on the existing related issue. The Sheets/Slides workaround solved my problem in the meantime. Thanks so much!

graphicore commented 4 years ago

Here's a doc:

https://docs.google.com/document/d/1CqUJlu65NlNaDAfMTDhU8Acnw3dkKwNBZthH-CzreLA/edit?usp=sharing

Ha! Interesting, at first I was going to write:

@dad-attitude, @Jout8: I think I can't reproduce any of the reported cases. Please share docs with your failing cases. And also browsers and version in case that is relevant.

Screenshot from 2020-05-18 22-23-51

I used here Firefox on openSUSE 75.0 (64-bit)

But, with Chromium Browser Version 81.0.4044.129 (openSUSE Build) (64-bit) I actually can reproduce the issue!:

Screenshot from 2020-05-18 22-34-30

Using the web inspector in each browser, I can Identify an element span.goog-inline-block that in case of chrome ads a printed character and afterwards one more printed character. In Firefox, the same element is present but not printing.

Screenshot from 2020-05-18 23-25-13

Libre barcode also prints white space characters (space, non breaking space), because space is encoded in these barcode styles and prior existing barcode fonts are doing the same. Some software handles this better than other, obviously. I'm pretty sure this could be worked around or fixed in Google Docs, but maybe the underlying problem is in Chrome/Chromium/Blink or so.

It seems that in Chrome there is a "zero width non joiner" (‌) added at the end of the barcode styled text, might be the same in Firefox, but I suspect that Chrome renders white space like these characters using the space character of the font, which it shouldn't for obvious reasons. But a (naive) programmer may be tempted to think that a space char is always a blank glyph and just "draws" it in such a case.

I tried to fix it in the doc, by going to the end of the barcode and select Format->Clear Formatting and it made things a bit better, but the one misprinted space glyph coming probably from that ‌ can't be removed.

Screenshot from 2020-05-18 23-34-57

When I remove the ‌ it in the DOM, with the inspector, I get the indendet result. However, that's just proving that there's a space glyph drawn where it shouldn't, it doesn't change or fix the actual document and it can't be shared like this with other people.

Screenshot from 2020-05-18 23-39-26

graphicore commented 4 years ago

I will try to only have drawing space characters between start/end symbols using OTF substitution. Then, the default space could be blank. Will be hard to test in an live app before release though.

graphicore commented 3 years ago

Just a note: this should be fixed, but the updates in Google Fonts are still underway.

I tested this with locally installed versions of the fonts, which the browser preferred over the versions hosted by Google Fonts, that's why I'm pretty confident it's fixed.

graphicore commented 3 years ago

The updated fonts are now live on Google Fonts and thus Google Docs etc. works on Chrome.

evanomondi commented 3 years ago

Is there a specific fix I should look out for? Im still having this issue. I also tried using some guidance from this article https://www.barcodefaq.com/knowledge-base/scan-font/ but I'm still not able to scan the barcode. image

graphicore commented 3 years ago

@evanomondi please have a look at the docs to learn how to use the Libre Barcode fonts, e.g. for Code 39: https://graphicore.github.io/librebarcode/documentation/code39 If that doesn't help, I'll need more information from you to understand what your actual issue is. The linked article is not associated with this project.