Hi,
Since the upgrade from zint 2.4.3 to 2.6.2, I had problems in glabels
when using Zint backend: EAN and UPC barcodes aren't resizable
anymore.
I looked to the issue with upstream and a fix has been commited in zint
tree: https://github.com/woo-j/zint/commit/3aeb1ea70a5f5b7c9a235ee29bdd708663f4d1f6
Discussion with upstream is on zint-barcode mailing-list at
https://sourceforge.net/p/zint/mailman/message/36208925/
As the fix isn't present in any zint release for now, I would like to
backport it in 2.6.2, in order to restore the functionality inside
glabels in ports.
The following diff do that. Is it acceptable ?
Thanks.
--
Sebastien Marie
Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/zint/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- Makefile 10 Jan 2018 15:12:08 -0000 1.12
+++ Makefile 31 Jan 2018 08:27:47 -0000
@@ -7,6 +7,7 @@ V = 2.6.2
DISTNAME = zint-${V}.src
PKGNAME-main = zint-${V}
PKGNAME-x11 = zint-gui-${V}
+REVISION = 0
SHARED_LIBS += QZint 1.0 # 2.6
SHARED_LIBS += zint 1.0 # 2.6
Index: patches/patch-backend_render_c
===================================================================
RCS file: patches/patch-backend_render_c
diff -N patches/patch-backend_render_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-backend_render_c 31 Jan 2018 08:27:47 -0000
@@ -0,0 +1,47 @@
+$OpenBSD$
+Make EAN and UPC symbols resizable in glabels in accordance with EN 797:1996
+https://github.com/woo-j/zint/commit/3aeb1ea70a5f5b7c9a235ee29bdd708663f4d1f6
+Index: backend/render.c
+--- backend/render.c.orig
++++ backend/render.c
+@@ -267,27 +267,34 @@ int render_plot(struct zint_symbol *symbol, float widt
+ /* The X-dimension of UPC/EAN symbols is fixed at 0.330mm */
+ /* The phrase before is questionable. It may scale in certain percentages (80% - 200%).
+ see https://internationalbarcodes.com/ean-13-specifications/ */
++ // Can now cope with sizes between 80% and 200%, enforces correct aspect ratio
+ /* NOTE: This code will need adjustment before it correctly deals with composite symbols */
+- x_dimension = 0.330;
+- width = 0.330 * GL_CONST * total_area_width_x;
+- /* The height is also fixed */
++ //x_dimension = 0.330;
++ if (x_dimension < 0.26) {
++ x_dimension = 0.26;
++ }
++ if (x_dimension > 0.66) {
++ x_dimension = 0.66;
++ }
++ width = x_dimension * GL_CONST * total_area_width_x;
++
+ switch (upceanflag) {
+ case 6:
+ case 12:
+ case 13:
+ /* UPC-A, UPC-E and EAN-13 */
+ /* Height of bars should be 22.85mm */
+- height = ((0.330 * ((2 * symbol->border_width) + text_offset + text_height)) + 22.85) * GL_CONST;
++ height = ((x_dimension * ((2 * symbol->border_width) + text_offset + text_height)) + (22.85 * (x_dimension / 0.33))) * GL_CONST;
+ break;
+ case 8:
+ /* EAN-8 */
+ /* Height of bars should be 18.23mm */
+- height = ((0.330 * ((2 * symbol->border_width) + text_offset + text_height)) + 18.23) * GL_CONST;
++ height = ((x_dimension * ((2 * symbol->border_width) + text_offset + text_height)) + (18.23 * (x_dimension / 0.33))) * GL_CONST;
+ break;
+ default:
+ /* EAN-2 and EAN-5 */
+ /* Height of bars should be 21.10mm */
+- height = ((0.330 * ((2 * symbol->border_width) + text_offset + text_height)) + 21.10) * GL_CONST;
++ height = ((x_dimension * ((2 * symbol->border_width) + text_offset + text_height)) + (21.10 * (x_dimension / 0.33))) * GL_CONST;
+ }
+ }
+
No comments:
Post a Comment