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

Remove extra spacing on no text version of Code 128 font? #39

Open dracwyrm opened 3 years ago

dracwyrm commented 3 years ago

Hi,

I was wondering if there is a simple way to remove the extra space that is on the no text version of the font, as it looks like that font has the same spacing as the text version. I don't want the black bars adjusted in height. The problem is that when printed from Excel; the barcode is off center. I attached an image of that to this report. Also, I would like the spacing above and below the font adjusted slightly to make the row height smaller. Excel auto adjusts the height to the font defined spacings. I opened the fonts in FontForge and the two fonts look the same with the same box under the black bars for the human readable character. Is there a straightforward way for me to adjust this in FontForge, or do all the glyphs need to be adjusted individual. The spacing adjustment will help aligne the barcode to the center of the cell and allow more lines on a printed page.

Many thanks, Jon Photo of Excel Print Side-by-Side Comparison of Fonts

graphicore commented 3 years ago

In the font info window (Elements -> Font Info …)

under General delete the Descent which is set to 400

Under OS/2 -> [Metrics] Delete or set to zero Win Descent, Typo Descent, HHead Descent

I'd expect that to work. Maybe you have to experiment, e.g.by setting those values to 1 instead of 0 to have some amount of descent, some software may expect that.

Also, in Windows, font caching is very persistent. You should definitely change version numbers between installations and also try rebooting if changes don't get promoted.

There's also the option to build custom fonts from sources, but it seems that for your request fontforge will be fine.

dracwyrm commented 3 years ago

Thanks for your feedback. I found FontForge a bit confusing. I made the Descent 10 to make it the same spacing as the top. However, in doing so, the font is bigger. I need to change to a smaller size, and it's also made the black lines taller a bit. In the screenshot, the original is on the left and the changed one is on the right.

Original vs Modified

I think we should consider the removal of the extra spacing for the official release as I think it makes sense that the non-text version be smaller than the text version and it allows the barcode to line up with text in adjacent cells. Just my two cents. :)

Many thanks, Jon

graphicore commented 3 years ago

I think we should consider the removal of the extra spacing for the official release as I think it makes sense that the non-text version be smaller than the text version and it allows the barcode to line up with text in adjacent cells. Just my two cents. :)

I'm rather not going to change the released versions for this. It would create backwards compatibility issues, as old documents with new fonts will look differently. But it would also destroy compatibility among the fonts (39/128 with and without text), because of the different metrics.

By removing the descender. you removed exactly what you asked for, but that changed the font metrics. A possibility could be to have the bars extend down all the way of the descender, maybe as a stylistic set or as a variable font axis.

It would not "remove" the descender (as you suggested and did but not liked the result), rather fill it with bars, so it would not be blank space.

900008676 commented 3 years ago

Do we know how to remove the space when using the font as a CSS family? I was able to set the margin and padding to 0, height to 30px, and a normal line-height but it still shows up with white space on bottom. I do not have the spacing issue with ID Automation C128M font. The height of the row is coming out to be 38.8 according to development tools.

.barcode { font-family: "Libre Barcode 128"; font-size: 30px; height: 30px; line-height: normal; margin: 0; padding: 0; }

image

neospud1 commented 2 months ago

By removing the descender. you removed exactly what you asked for, but that changed the font metrics. A possibility could be to have the bars extend down all the way of the descender, maybe as a stylistic set or as a variable font axis.

How would one go about doing this?