ruby-zint 1.5.0-x86_64-linux-gnu → 1.6.0-x86_64-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e880d27afdd8ede003d49eef0c9e05f7b1d1c7eed1708c4c7f6a1a00f1706edb
4
- data.tar.gz: 4e93c70135736b41fe200d3b5a0c753e718a1f644ec981c5c9626df26b5f2f08
3
+ metadata.gz: fa251d0e97dd7a3e04d6bdeedba25d09abb8653e137b4ffaff36a23f2b19df06
4
+ data.tar.gz: 98ff2d3eb7f56d883e8b7e37bf9ef1602ec5c147795120f5d552578856e4ef2b
5
5
  SHA512:
6
- metadata.gz: cb9bab70916801509ac6ca30328f9b011a5b078723361d64371ae1c8b122ba0c218ae081d6ca242fda3f6df580e943baa2163e6f0c6b488d7c66daa941ab3d09
7
- data.tar.gz: 89c473ad72a662ca369988f7bed84d44f49bc6b28ca8d73fba05cb2d73380b7725d5eaaf2f26a3fc832f1f5ae687de275e6a0e08a340697c553fa9555ea28bb9
6
+ metadata.gz: 59ea056903eec2fa49e5ee0a5f92e3c5aad9d51065d3409815e084c52553e9ee318ca33e80710800109268195f845907ee2caf047215c1681c2889a320d0cc02
7
+ data.tar.gz: 5e99544404d73612db03b9325974b27f42d703a46b4b8ea6ea07e69ce116b827cee11bf8e627d2a5137bf85de7c6a0dfb0123aa30cde5385ca9c70854bb51197
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ ## v1.6.0 [2026-04-21] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ Added:
4
+
5
+ - Add Windows-on-ARM binary gem. [#25](https://github.com/eliasfroehner/ruby-zint/pull/25)
6
+ - Add `Zint::Ean8` and `Zint::Ean13` and deprecate `Zint::Eanx`. [#27](https://github.com/eliasfroehner/ruby-zint/pull/27)
7
+ This is to follow changes in zint-2.16.
8
+
9
+ Changed:
10
+
11
+ - Update to libzint-2.16. [#26](https://github.com/eliasfroehner/ruby-zint/pull/26)
12
+
13
+ Removed:
14
+
15
+ - Drop support of ruby < 3.0
16
+
17
+
18
+ ## v1.5.0 [2025-08-14] Elias Fröhner <apiwalker96@gmail.com>
19
+
20
+ Added:
21
+
22
+ - Add binary gems for all major platforms. [#21](https://github.com/eliasfroehner/ruby-zint/pull/21)
23
+ The binary gems don't depend on the libzint package on the running system or on CMake or libpng.
24
+ They have libzint builtin, are usually preferred by rubygems and bundler and should ease installation.
25
+ - Add barcode segments support. [#22](https://github.com/eliasfroehner/ruby-zint/pull/22)
26
+ To be used like
27
+ `Zint::Barcode.new(segments: [source: "Больше".encode("ISO-8859-5"), eci: 7])`
28
+ - Add new symbology class `Zint::Dxfilmedge`
29
+
30
+ Changed:
31
+
32
+ - Update to libzint-2.15. [#22](https://github.com/eliasfroehner/ruby-zint/pull/22)
33
+ - Use native memory-file support of libzint-2.15 to implement `Zint::Barcode#to_memory_file`
34
+
35
+ Removed:
36
+
37
+ - `Zint::Barcode#fontsize` and `Zint::Barcode#fontsize=`
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  This gem is a Ruby FFI binding for the [libzint](http://www.zint.org.uk) barcode generation library.
6
6
 
7
- See the [documentation](https://rubydoc.info/github/api-walker/ruby-zint) for a full API description.
7
+ See the [documentation](https://rubydoc.info/gems/ruby-zint) for a full API description.
8
8
 
9
9
  ## Installation
10
10
 
@@ -45,7 +45,7 @@ $ gem install ruby-zint -- --disable-system-libzint
45
45
  Install the libzint binary with your package manager (e. g. `apt install zint` or perhaps `brew install zint`).
46
46
  Other platforms require building [from source](https://www.zint.org.uk/manual/chapter/2).
47
47
 
48
- **NOTE:** It is assumed that you are using libzint with the version [2.15](https://sourceforge.net/projects/zint/files/zint/2.15.0/).
48
+ **NOTE:** It is assumed that you are using libzint with the version [2.16](https://sourceforge.net/projects/zint/files/zint/2.16.0/).
49
49
 
50
50
  Then install this gem and enforce system libzint:
51
51
 
@@ -45,11 +45,11 @@ def libzint_usable?
45
45
  m = Module.new do
46
46
  extend FFI::Library
47
47
 
48
- ffi_lib(%w[libzint.so.2.15 libzint zint])
48
+ ffi_lib(%w[libzint.so.2.16 libzint zint])
49
49
  attach_function(:ZBarcode_Version, [], :int32)
50
50
  end
51
51
 
52
- (21500...21600) === m.ZBarcode_Version
52
+ (21600...21700) === m.ZBarcode_Version
53
53
  rescue LoadError
54
54
  false
55
55
  end
@@ -58,14 +58,14 @@ def build_bundled_libzint
58
58
  puts "Build libzint and dependencies"
59
59
  require_relative "../../lib/zint/zint_recipe"
60
60
 
61
- recipe_zlib = Zint::ZintRecipe.new("zlib", Zint::LIBZ_VERSION, Zint::LIBZ_SOURCE_URI, Zint::LIBZ_SOURCE_SHA1)
61
+ recipe_zlib = Zint::ZintRecipe.new("zlib", Zint::LIBZ_VERSION, Zint::LIBZ_SOURCE_URI, Zint::LIBZ_SOURCE_SHA256)
62
62
  recipe_zlib.configure_options += [
63
63
  "-DCMAKE_C_FLAGS=-fPIC",
64
64
  "-DZLIB_SHARED=OFF"
65
65
  ]
66
66
  recipe_zlib.cook_and_activate
67
67
 
68
- recipe_png = Zint::ZintRecipe.new("libpng", Zint::LIBPNG_VERSION, Zint::LIBPNG_SOURCE_URI, Zint::LIBPNG_SOURCE_SHA1)
68
+ recipe_png = Zint::ZintRecipe.new("libpng", Zint::LIBPNG_VERSION, Zint::LIBPNG_SOURCE_URI, Zint::LIBPNG_SOURCE_SHA256)
69
69
  recipe_png.configure_options += [
70
70
  "-DCMAKE_C_FLAGS=-fPIC",
71
71
  "-DZLIB_ROOT=#{recipe_zlib.path}",
@@ -73,10 +73,10 @@ def build_bundled_libzint
73
73
  ]
74
74
  recipe_png.cook_and_activate
75
75
 
76
- recipe = Zint::ZintRecipe.new("libzint", Zint::ZINT_VERSION, Zint::ZINT_SOURCE_URI, Zint::ZINT_SOURCE_SHA1)
76
+ recipe = Zint::ZintRecipe.new("libzint", Zint::ZINT_VERSION, Zint::ZINT_SOURCE_URI, Zint::ZINT_SOURCE_SHA256)
77
77
  recipe.configure_options += [
78
78
  "-DZLIB_INCLUDE_DIR=#{recipe_zlib.path}/include",
79
- "-DZLIB_LIBRARY=#{recipe_zlib.path}/lib/#{(RUBY_PLATFORM =~ /mingw/) ? "libzlibstatic.a" : "libz.a"}",
79
+ "-DZLIB_LIBRARY=#{recipe_zlib.path}/lib/#{(RUBY_PLATFORM =~ /mingw/) ? "libzs.a" : "libz.a"}",
80
80
  "-DPNG_PNG_INCLUDE_DIR=#{recipe_png.path}/include",
81
81
  "-DPNG_LIBRARY=#{recipe_png.path}/lib/libpng.a"
82
82
  ]
data/lib/3.4/libzint.so CHANGED
Binary file
data/lib/zint/barcode.rb CHANGED
@@ -55,20 +55,20 @@ module Zint
55
55
  end
56
56
  end
57
57
 
58
- # Exports barcode to memory file
58
+ # Exports barcode to image file as a string
59
59
  #
60
60
  # @param extension [String] Extension exported memory file
61
61
  # @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
62
62
  # @return [String] Exported memory file
63
63
  def to_memory_file(extension: ".png", rotate_angle: 0)
64
- @zint_symbol[:output_options] = Zint::BARCODE_MEMORY_FILE
64
+ @zint_symbol[:output_options] |= Zint::BARCODE_MEMORY_FILE
65
65
 
66
66
  to_file(path: extension, rotate_angle: rotate_angle)
67
67
 
68
68
  @zint_symbol[:memfile].read_bytes(@zint_symbol[:memfile_size])
69
69
  end
70
70
 
71
- # Exports barcode to buffer
71
+ # Exports barcode to bitmap data as a string buffer
72
72
  #
73
73
  # @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
74
74
  # @return [String] Exported barcode buffer
@@ -76,7 +76,7 @@ module Zint
76
76
  unless @zint_symbol[:bitmap].null?
77
77
  raise AlreadyGenerated, "to_vector was already executed"
78
78
  end
79
- @zint_symbol[:output_options] = Zint::OUT_BUFFER_INTERMEDIATE
79
+ @zint_symbol[:output_options] |= Zint::OUT_BUFFER_INTERMEDIATE
80
80
 
81
81
  if input_file
82
82
  call_function(:ZBarcode_Encode_File_and_Buffer, @zint_symbol, input_file, rotate_angle)
@@ -89,7 +89,7 @@ module Zint
89
89
  @zint_symbol[:bitmap].read_bytes(@zint_symbol[:bitmap_width] * @zint_symbol[:bitmap_height])
90
90
  end
91
91
 
92
- # Exports barcode to buffer
92
+ # Exports barcode as a Zint::Bitmap
93
93
  #
94
94
  # @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
95
95
  # @return [Zint::Bitmap] Exported bitmap
@@ -405,6 +405,22 @@ module Zint
405
405
  @zint_symbol[:primary] = primary
406
406
  end
407
407
 
408
+ # Return array of content segs if Zint::Constants::OutputOptions::BARCODE_CONTENT_SEGS output option is set
409
+ #
410
+ # Strings are pre-converted, i.e. UTF-8 unless input mode is Zint::Constants::InputDataTypes::DATA_MODE
411
+ #
412
+ # @return [Array<Zint::Structs::Seg>, NilClass]
413
+ def content_segs
414
+ ptr = @zint_symbol[:content_segs].to_ptr
415
+ return if ptr.null?
416
+ @zint_symbol[:content_seg_count].times.map do |i|
417
+ seg = Zint::Structs::Seg.new(ptr + Zint::Structs::Seg.size * i)
418
+ # Avoid garbage collection of Symbol before Seg, since the Seg is also freed by ZBarcode_Delete()
419
+ seg.instance_variable_set(:@symbol, @zint_symbol)
420
+ seg
421
+ end
422
+ end
423
+
408
424
  # Gets encoded data of barcode as internal FFI::StructLayout::CharArray object
409
425
  #
410
426
  # Don't use this method, it might be changed in future releases.
@@ -2,20 +2,21 @@ module Zint
2
2
  module Constants
3
3
  # Capability flags (ZBarcode_Cap() `cap_flag`)
4
4
  module CapabilityFlags
5
- ZINT_CAP_HRT = 0x0001 # Prints Human Readable Text? */
6
- ZINT_CAP_STACKABLE = 0x0002 # Is stackable? */
7
- ZINT_CAP_EXTENDABLE = 0x0004 # Is extendable with add-on data? (Is EAN/UPC?) */
8
- ZINT_CAP_COMPOSITE = 0x0008 # Can have composite data? */
9
- ZINT_CAP_ECI = 0x0010 # Supports Extended Channel Interpretations? */
10
- ZINT_CAP_GS1 = 0x0020 # Supports GS1 data? */
11
- ZINT_CAP_DOTTY = 0x0040 # Can be output as dots? */
12
- ZINT_CAP_QUIET_ZONES = 0x0080 # Has default quiet zones? */
13
- ZINT_CAP_FIXED_RATIO = 0x0100 # Has fixed width-to-height (aspect) ratio? */
14
- ZINT_CAP_READER_INIT = 0x0200 # Supports Reader Initialisation? */
15
- ZINT_CAP_FULL_MULTIBYTE = 0x0400 # Supports full-multibyte option? */
16
- ZINT_CAP_MASK = 0x0800 # Is mask selectable? */
17
- ZINT_CAP_STRUCTAPP = 0x1000 # Supports Structured Append? */
18
- ZINT_CAP_COMPLIANT_HEIGHT = 0x2000 # Has compliant height? */
5
+ ZINT_CAP_HRT = 0x0001 # Prints Human Readable Text?
6
+ ZINT_CAP_STACKABLE = 0x0002 # Is stackable?
7
+ ZINT_CAP_EXTENDABLE = 0x0004 # Is extendable with add-on data? (Is EAN/UPC?)
8
+ ZINT_CAP_COMPOSITE = 0x0008 # Can have composite data?
9
+ ZINT_CAP_ECI = 0x0010 # Supports Extended Channel Interpretations?
10
+ ZINT_CAP_GS1 = 0x0020 # Supports GS1 data?
11
+ ZINT_CAP_DOTTY = 0x0040 # Can be output as dots?
12
+ ZINT_CAP_QUIET_ZONES = 0x0080 # Has default quiet zones?
13
+ ZINT_CAP_FIXED_RATIO = 0x0100 # Has fixed width-to-height (aspect) ratio?
14
+ ZINT_CAP_READER_INIT = 0x0200 # Supports Reader Initialisation?
15
+ ZINT_CAP_FULL_MULTIBYTE = 0x0400 # Supports full-multibyte option?
16
+ ZINT_CAP_MASK = 0x0800 # Is mask selectable?
17
+ ZINT_CAP_STRUCTAPP = 0x1000 # Supports Structured Append?
18
+ ZINT_CAP_COMPLIANT_HEIGHT = 0x2000 # Has compliant height?
19
+ ZINT_CAP_BINDABLE = 0x4000 # Can set row separators?
19
20
  end
20
21
  end
21
22
  end
@@ -13,7 +13,7 @@ module Zint
13
13
  error_file_write: 12,
14
14
  error_uses_eci: 13,
15
15
  error_noncompliant: 14,
16
- error_hrt_truncated: 15 # Error counterpart of warning if WARN_FAIL_ALL set */
16
+ error_hrt_truncated: 15 # Error counterpart of warning if WARN_FAIL_ALL set
17
17
  }
18
18
  end
19
19
  end
@@ -11,6 +11,7 @@ module Zint
11
11
  HEIGHTPERROW_MODE = 0x0040 # Interpret `height` as per-row rather than as overall height
12
12
  FAST_MODE = 0x0080 # Use faster if less optimal encodation or other shortcuts if available (affects DATAMATRIX, MICROPDF417, PDF417, QRCODE & UPNQR only)
13
13
  EXTRA_ESCAPE_MODE = 0x0100 # Process special symbology-specific escape sequences as well as others. Note: currently Code 128 only.
14
+ GS1SYNTAXENGINE_MODE = 0x0200 # Use the GS1 Syntax Engine (if available) to strictly validate GS1 input
14
15
  end
15
16
  end
16
17
  end
@@ -2,23 +2,24 @@ module Zint
2
2
  module Constants
3
3
  # Output options (`symbol->output_options`)
4
4
  module OutputOptions
5
- BARCODE_BIND_TOP = 0x0001 # Boundary bar above the symbol only (not below), does not affect stacking */
6
- BARCODE_BIND = 0x0002 # Boundary bars above & below the symbol and between stacked symbols */
7
- BARCODE_BOX = 0x0004 # Box around symbol */
8
- BARCODE_STDOUT = 0x0008 # Output to stdout */
9
- READER_INIT = 0x0010 # Reader Initialisation (Programming) */
10
- SMALL_TEXT = 0x0020 # Use smaller font */
11
- BOLD_TEXT = 0x0040 # Use bold font */
12
- CMYK_COLOUR = 0x0080 # CMYK colour space (Encapsulated PostScript and TIF) */
13
- BARCODE_DOTTY_MODE = 0x0100 # Plot a matrix symbol using dots rather than squares */
14
- GS1_GS_SEPARATOR = 0x0200 # Use GS instead of FNC1 as GS1 separator (Data Matrix) */
15
- OUT_BUFFER_INTERMEDIATE = 0x0400 # Return ASCII values in bitmap buffer (OUT_BUFFER only) */
16
- BARCODE_QUIET_ZONES = 0x0800 # Add compliant quiet zones (additional to any specified whitespace); Note: CODE16K, CODE49, CODABLOCKF, ITF14, EAN/UPC have default quiet zones */
17
- BARCODE_NO_QUIET_ZONES = 0x1000 # Disable quiet zones, notably those with defaults as listed above */
18
- COMPLIANT_HEIGHT = 0x2000 # Warn if height not compliant and use standard height (if any) as default */
19
- EANUPC_GUARD_WHITESPACE = 0x04000 # Add quiet zone indicators ("<"/">") to HRT whitespace (EAN/UPC) */
20
- EMBED_VECTOR_FONT = 0x08000 # Embed font in vector output - currently only for SVG output */
21
- BARCODE_MEMORY_FILE = 0x10000 # Write output to in-memory buffer `memfile` instead of to `outfile` */
5
+ BARCODE_BIND_TOP = 0x0001 # Boundary bar above the symbol only (not below), does not affect stacking
6
+ BARCODE_BIND = 0x0002 # Boundary bars above & below the symbol and between stacked symbols
7
+ BARCODE_BOX = 0x0004 # Box around symbol
8
+ BARCODE_STDOUT = 0x0008 # Output to stdout
9
+ READER_INIT = 0x0010 # Reader Initialisation (Programming)
10
+ SMALL_TEXT = 0x0020 # Use smaller font
11
+ BOLD_TEXT = 0x0040 # Use bold font
12
+ CMYK_COLOUR = 0x0080 # CMYK colour space (Encapsulated PostScript and TIF)
13
+ BARCODE_DOTTY_MODE = 0x0100 # Plot a matrix symbol using dots rather than squares
14
+ GS1_GS_SEPARATOR = 0x0200 # Use GS instead of FNC1 as GS1 separator (Data Matrix)
15
+ OUT_BUFFER_INTERMEDIATE = 0x0400 # Return ASCII values in bitmap buffer (OUT_BUFFER only)
16
+ BARCODE_QUIET_ZONES = 0x0800 # Add compliant quiet zones (additional to any specified whitespace); Note: CODE16K, CODE49, CODABLOCKF, ITF14, EAN/UPC have default quiet zones
17
+ BARCODE_NO_QUIET_ZONES = 0x1000 # Disable quiet zones, notably those with defaults as listed above
18
+ COMPLIANT_HEIGHT = 0x2000 # Warn if height not compliant and use standard height (if any) as default
19
+ EANUPC_GUARD_WHITESPACE = 0x04000 # Add quiet zone indicators ("<"/">") to HRT whitespace (EAN/UPC)
20
+ EMBED_VECTOR_FONT = 0x08000 # Embed font in vector output - currently only for SVG output
21
+ BARCODE_MEMORY_FILE = 0x10000 # Write output to in-memory buffer `memfile` instead of to `outfile`
22
+ BARCODE_CONTENT_SEGS = 0x20000 # Write data encoded to content segment buffers `content_segs`
22
23
  end
23
24
  end
24
25
  end
@@ -12,8 +12,12 @@ module Zint
12
12
  BARCODE_C25IND = 7 # 2 of 5 Industrial
13
13
  BARCODE_CODE39 = 8 # Code 39
14
14
  BARCODE_EXCODE39 = 9 # Extended Code 39
15
- BARCODE_EANX = 13 # EAN (European Article Number)
16
- BARCODE_EANX_CHK = 14 # EAN + Check Digit
15
+ BARCODE_EAN8 = 10 # EAN-8 (European Article Number) GTIN-8
16
+ BARCODE_EAN_2ADDON = 11 # EAN/UPC 2-digit add-on (standalone)
17
+ BARCODE_EAN_5ADDON = 12 # EAN/UPC 5-digit add-on (standalone)
18
+ BARCODE_EANX = 13 # Legacy
19
+ BARCODE_EANX_CHK = 14 # Legacy
20
+ BARCODE_EAN13 = 15 # EAN-13 (European Article Number) GTIN-13
17
21
  BARCODE_GS1_128 = 16 # GS1-128
18
22
  BARCODE_EAN128 = 16 # Legacy
19
23
  BARCODE_CODABAR = 18 # Codabar
@@ -132,7 +136,9 @@ module Zint
132
136
  BARCODE_RMQR = 145 # Rectangular Micro QR Code (rMQR)
133
137
  BARCODE_BC412 = 146 # IBM BC412 (SEMI T1-95)
134
138
  BARCODE_DXFILMEDGE = 147 # DX Film Edge Barcode on 35mm and APS films
135
- BARCODE_LAST = 147 # Max barcode number marker, not barcode
139
+ BARCODE_EAN8_CC = 148 # EAN-8 Composite
140
+ BARCODE_EAN13_CC = 149 # EAN-13 Composite
141
+ BARCODE_LAST = 149 # Max barcode number marker, not barcode
136
142
  end
137
143
  end
138
144
  end
@@ -0,0 +1,8 @@
1
+ module Zint
2
+ module Constants
3
+ # The largest amount of data that can be encoded is 4350 4-byte UTF-8 chars in Han Xin Code
4
+ ZINT_MAX_DATA_LEN = 17400
5
+ # Maximum number of segments allowed for (`seg_count`)
6
+ ZINT_MAX_SEG_COUNT = 256
7
+ end
8
+ end
@@ -1,15 +1,15 @@
1
1
  module Zint
2
- LIBZ_VERSION = ENV["LIBZ_VERSION"] || "1.3.1"
2
+ LIBZ_VERSION = ENV["LIBZ_VERSION"] || "1.3.2"
3
3
  LIBZ_SOURCE_URI = "http://zlib.net/fossils/zlib-#{LIBZ_VERSION}.tar.gz"
4
- LIBZ_SOURCE_SHA1 = "f535367b1a11e2f9ac3bec723fb007fbc0d189e5"
4
+ LIBZ_SOURCE_SHA256 = "bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16"
5
5
 
6
- ZINT_VERSION = ENV["ZINT_VERSION"] || "2.15.0"
6
+ ZINT_VERSION = ENV["ZINT_VERSION"] || "2.16.0"
7
7
  ZINT_SOURCE_URI = "https://downloads.sourceforge.net/zint/zint-#{ZINT_VERSION}-src.tar.gz"
8
- ZINT_SOURCE_SHA1 = "e18966972d77feaa62a33d73d2f06ffec3356f66"
8
+ ZINT_SOURCE_SHA256 = "37e767afada2403bb9ae49b93a19eb0a9e944a0c278d9f23522746b3d08a3c4b"
9
9
 
10
- LIBPNG_VERSION = ENV["LIBPNG_VERSION"] || "1.6.50"
11
- LIBPNG_SOURCE_URI = "https://netcologne.dl.sourceforge.net/project/libpng/libpng16/#{LIBPNG_VERSION}/libpng-#{LIBPNG_VERSION}.tar.xz"
12
- LIBPNG_SOURCE_SHA1 = "ecd92ba84628a8ace430706c85fd2fb26ba0882c"
10
+ LIBPNG_VERSION = ENV["LIBPNG_VERSION"] || "1.6.56"
11
+ LIBPNG_SOURCE_URI = "https://download.sourceforge.net/libpng/libpng-#{LIBPNG_VERSION}.tar.xz"
12
+ LIBPNG_SOURCE_SHA256 = "f7d8bf1601b7804f583a254ab343a6549ca6cf27d255c302c47af2d9d36a6f18"
13
13
 
14
14
  MINI_PORTILE_VERSION = "~> 2.1"
15
15
  end
data/lib/zint/ean13.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Zint
2
+ # EAN-13 (European Article Number)
3
+ class Ean13 < Barcode
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_EAN13, **kwargs)
6
+ end
7
+ end
8
+ end
data/lib/zint/ean8.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Zint
2
+ # EAN-8 (European Article Number)
3
+ class Ean8 < Barcode
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_EAN8, **kwargs)
6
+ end
7
+ end
8
+ end
data/lib/zint/eanx.rb CHANGED
@@ -1,6 +1,13 @@
1
1
  module Zint
2
2
  # EAN (European Article Number)
3
+ #
4
+ # Deprecated class -> use Ean8 or Ean13 instead.
3
5
  class Eanx < Barcode
6
+ called = caller.find do |fn|
7
+ !fn.include?(RbConfig::TOPDIR) && !fn.start_with?(File.expand_path("..", __dir__))
8
+ end
9
+ warn("Zint::Eanx is deprecated. Please use Ean8 or Ean13 instead! Called from #{called}", category: :deprecated)
10
+
4
11
  def initialize(value: nil, input_file: nil, **kwargs)
5
12
  super(value: value, input_file: input_file, symbology: Zint::BARCODE_EANX, **kwargs)
6
13
  end
data/lib/zint/eanxchk.rb CHANGED
@@ -1,6 +1,13 @@
1
1
  module Zint
2
2
  # EAN + Check Digit
3
+ #
4
+ # Deprecated class -> use Ean8 or Ean13 instead.
3
5
  class EanxChk < Barcode
6
+ called = caller.find do |fn|
7
+ !fn.include?(RbConfig::TOPDIR) && !fn.start_with?(File.expand_path("..", __dir__))
8
+ end
9
+ warn("Zint::EanxChk is deprecated. Please use Ean8 or Ean13 instead! Called from #{called}", category: :deprecated)
10
+
4
11
  def initialize(value: nil, input_file: nil, **kwargs)
5
12
  super(value: value, input_file: input_file, symbology: Zint::BARCODE_EANX_CHK, **kwargs)
6
13
  end
data/lib/zint/native.rb CHANGED
@@ -7,7 +7,7 @@ module Zint
7
7
  bundled_dll = File.join(root_path, "lib/#{prefix}zint.#{FFI::Platform::LIBSUFFIX}")
8
8
  native_gem1 = File.join(root_path, "lib/3.4/libzint.#{RbConfig::CONFIG["DLEXT"]}") # This is where rake-compiler places the file in the gem
9
9
  native_gem2 = File.join(root_path, "lib/3.0/libzint.#{RbConfig::CONFIG["DLEXT"]}") # ... for non-ucrt windows builds
10
- ffi_lib [bundled_dll, native_gem1, native_gem2, "libzint.so.2.15", "libzint", "zint"]
10
+ ffi_lib [bundled_dll, native_gem1, native_gem2, "libzint.so.2.16", "libzint", "zint"]
11
11
 
12
12
  # Error codes (API return values)
13
13
  enum :error_code, [Constants::Warnings::WARNINGS, Constants::Errors::ERRORS].map { |h| h.to_a }.flatten
@@ -1,18 +1,18 @@
1
1
  module Zint
2
2
  module Structs
3
3
  class Seg < FFI::Struct
4
- # /* Segment for use with `raw_segs` and API `ZBarcode_Encode_Segs()` */
4
+ # /* Segment for use with `content_segs` and API `ZBarcode_Encode_Segs()` */
5
5
  # struct zint_seg {
6
- # unsigned char *source; /* Data to encode, or (`raw_segs`) data encoded */
6
+ # unsigned char *source; /* Data to encode, or (`content_segs`) data encoded */
7
7
  # int length; /* Length of `source`. If 0 or negative, `source` must be NUL-terminated */
8
8
  # int eci; /* Extended Channel Interpretation */
9
9
  # };
10
10
 
11
- layout :source, :pointer, # Data to encode, or (`raw_segs`) data encoded
11
+ layout :source, :pointer, # Data to encode, or (`content_segs`) data encoded
12
12
  :length, :int, # Length of `source`. If 0 or negative, `source` must be NUL-terminated
13
13
  :eci, :int # Extended Channel Interpretation
14
14
 
15
- # Data to encode, or (`raw_segs`) data encoded
15
+ # Data to encode, or (`content_segs`) data encoded
16
16
  def source
17
17
  self[:source].read_bytes(self[:length])
18
18
  end
@@ -31,22 +31,20 @@ module Zint
31
31
  :text_length, :int, # int text_length; /* Length of text in bytes (output only) */
32
32
  :rows, :int, # Number of rows used by the symbol (output only)
33
33
  :width, :int, # Width of the generated symbol (output only)
34
- :encoded_data, [:uchar, 200 * 144], # Encoded data (output only). Allows for rows of 1152 modules
35
- :row_height, [:float, 200], # Heights of rows (output only). Allows for 200 row DotCode
36
- :errtxt, [:char, 100], # Error message if an error or warning occurs, NUL-terminated (output only)
34
+ :errtxt, [:char, 160], # Error message if an error or warning occurs, NUL-terminated (output only)
37
35
  :bitmap, :pointer, # Stored bitmap image (raster output only)
38
36
  :bitmap_width, :int, # Width of bitmap image (raster output only)
39
37
  :bitmap_height, :int, # Height of bitmap image (raster output only)
40
38
  :alphamap, :pointer, # Array of alpha values used (raster output only)
41
39
  :vector, Vector.by_ref, # Pointer to vector header (vector output only)
42
40
  :memfile, :pointer, # unsigned char *memfile; /* Pointer to in-memory file buffer if BARCODE_MEMORY_FILE (output only) */
43
- :memfile_size, :int # int memfile_size; /* Length of in-memory file buffer (output only) */
44
-
45
- # Upcomming zint-2.16:
46
- # struct zint_seg *raw_segs; /* Pointer to array of raw segs if BARCODE_RAW_TEXT (output only) */
47
- # :raw_segs, Seg.by_ref,
48
- # int raw_seg_count; /* Number of `raw_segs` (output only) */
49
- # :raw_seg_count, :int
41
+ :memfile_size, :int, # int memfile_size; /* Length of in-memory file buffer (output only) */
42
+ # struct zint_seg *content_segs; /* Pointer to array of content segs if BARCODE_CONTENT_SEGS (output only) */
43
+ :content_segs, Seg.by_ref,
44
+ # int content_seg_count; /* Number of `content_segs` (output only) */
45
+ :content_seg_count, :int,
46
+ :encoded_data, [:uchar, 200 * 144], # Encoded data (output only). Allows for rows of 1152 modules
47
+ :row_height, [:float, 200] # Heights of rows (output only). Allows for 200 row DotCode
50
48
 
51
49
  # @private
52
50
  def self.release(ptr)
data/lib/zint/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zint
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -8,10 +8,10 @@ module Zint
8
8
  class ZintRecipe < MiniPortileCMake
9
9
  ROOT = File.expand_path("../../..", __FILE__)
10
10
 
11
- def initialize(name, vers, url, sha1)
11
+ def initialize(name, vers, url, sha256)
12
12
  super(name, vers)
13
13
  self.target = File.join(ROOT, "ports")
14
- self.files = [url: url, sha1: sha1]
14
+ self.files = [url: url, sha256: sha256]
15
15
  end
16
16
 
17
17
  def port_path
data/lib/zint.rb CHANGED
@@ -85,7 +85,9 @@ module Zint
85
85
  autoload :Dpleit, "zint/dpleit"
86
86
  autoload :Dxfilmedge, "zint/dxfilmedge"
87
87
  autoload :Ean128, "zint/ean128"
88
+ autoload :Ean13, "zint/ean13"
88
89
  autoload :Ean14, "zint/ean14"
90
+ autoload :Ean8, "zint/ean8"
89
91
  autoload :Eanx, "zint/eanx"
90
92
  autoload :EanxChk, "zint/eanxchk"
91
93
  autoload :Excode39, "zint/excode39"
data/ruby-zint.gemspec CHANGED
@@ -4,16 +4,17 @@ require_relative "lib/zint/dependencies"
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "ruby-zint"
6
6
  spec.version = Zint::VERSION
7
- spec.authors = ["Elias Fröhner"]
8
- spec.email = ["apiwalker96@gmail.com"]
7
+ spec.authors = ["Elias Fröhner", "Lars Kanis"]
8
+ spec.email = ["apiwalker96@gmail.com", "lars@greiz-reinsdorf.de"]
9
9
 
10
10
  spec.summary = "Ruby FFI binding for libzint"
11
11
  spec.homepage = "https://github.com/eliasfroehner/ruby-zint"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = ">= 2.6.0"
13
+ spec.required_ruby_version = ">= 3.0.0"
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = spec.homepage
17
+ spec.metadata["changelog_uri"] = "https://github.com/eliasfroehner/ruby-zint/blob/master/CHANGELOG.md"
17
18
  spec.metadata["msys2_mingw_dependencies"] = "cmake libpng"
18
19
  spec.metadata["documentation_uri"] = "https://rubydoc.info/gems/ruby-zint"
19
20
 
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,13 +1,39 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-zint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - Elias Fröhner
8
+ - Lars Kanis
8
9
  bindir: bin
9
- cert_chain: []
10
- date: 2025-08-14 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEBDCCAmygAwIBAgIBBDANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
14
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNTEyMjkyMDMyMzFaFw0yNjEy
15
+ MjkyMDMyMzFaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
16
+ PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
17
+ mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
18
+ eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
19
+ 8nBMvR0mHo77kIkapHc26UzVq/G0nKLfDsIHXVylto3PjzOumjG6GhmFN4r3cP6e
20
+ SDfl1FSeRYVpt4kmQULz/zdSaOH3AjAq7PM2Z91iGwQvoUXMANH2v89OWjQO/NHe
21
+ JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
22
+ eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhNexUtbjk6P8emmXOJi5
23
+ chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
24
+ 9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
25
+ A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
26
+ 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEAUVIier9xybHmXNsj801xD+Q7Jz7wpRsf
27
+ fMHpV2sAzvYcAa7pn+mbu9nf7RUhe5hiaUv88Usk9nRUYYrjBOO5RuD+wYNowpcE
28
+ kxUiTAP/fgUBdW6hYUJy57CH3xUD6tj1Cg9hxdKy7jItZXbfhX+qPq2BwGaXz7gn
29
+ nhrALITRmpuPnlsccM94dgSArCInSo2SEc12h2oB6FAnFG1Lre3dmQamI5q1EKp0
30
+ Yafb2+cPbFcVYUdE50wf+cdeGDOsCGlAmo2OGqXWxTP2hIfyhsFoamD6UGufLoPG
31
+ Dh6tAEZIuEvLjq93qoNceUQn+xxiiIszjY5mkTu9rVY+/gh5PJzu9IHvyIqBpb2o
32
+ fdWDISWK+KSLCrqkFtKoliLDTZau73GcYCVOkjca+3cxqABKZ+M8r42Sq8JPxPiv
33
+ KyLQBzqPeLN9qRDD1bEFHIcgwdY/zQTs4mWRBSmBWa7w+k8nP8aSV1dN/fvhYwY3
34
+ HCQwtPaMYOznIOcc8shL4zLJpcl8uCqE
35
+ -----END CERTIFICATE-----
36
+ date: 1980-01-02 00:00:00.000000000 Z
11
37
  dependencies:
12
38
  - !ruby/object:Gem::Dependency
13
39
  name: ffi
@@ -25,6 +51,7 @@ dependencies:
25
51
  version: '1.15'
26
52
  email:
27
53
  - apiwalker96@gmail.com
54
+ - lars@greiz-reinsdorf.de
28
55
  executables: []
29
56
  extensions: []
30
57
  extra_rdoc_files:
@@ -60,6 +87,7 @@ extra_rdoc_files:
60
87
  - lib/zint/code49.rb
61
88
  - lib/zint/code93.rb
62
89
  - lib/zint/code_one.rb
90
+ - lib/zint/constants.rb
63
91
  - lib/zint/daft.rb
64
92
  - lib/zint/data_matrix.rb
65
93
  - lib/zint/dbarexp.rb
@@ -75,7 +103,9 @@ extra_rdoc_files:
75
103
  - lib/zint/dpleit.rb
76
104
  - lib/zint/dxfilmedge.rb
77
105
  - lib/zint/ean128.rb
106
+ - lib/zint/ean13.rb
78
107
  - lib/zint/ean14.rb
108
+ - lib/zint/ean8.rb
79
109
  - lib/zint/eanx.rb
80
110
  - lib/zint/eanxchk.rb
81
111
  - lib/zint/excode39.rb
@@ -140,6 +170,7 @@ extra_rdoc_files:
140
170
  - lib/zint/zint_recipe.rb
141
171
  files:
142
172
  - ".yardopts"
173
+ - CHANGELOG.md
143
174
  - LICENSE.txt
144
175
  - README.md
145
176
  - ext/ruby-zint/extconf.rb
@@ -176,6 +207,7 @@ files:
176
207
  - lib/zint/code49.rb
177
208
  - lib/zint/code93.rb
178
209
  - lib/zint/code_one.rb
210
+ - lib/zint/constants.rb
179
211
  - lib/zint/constants/capability_flags.rb
180
212
  - lib/zint/constants/debug_flags.rb
181
213
  - lib/zint/constants/errors.rb
@@ -200,7 +232,9 @@ files:
200
232
  - lib/zint/dpleit.rb
201
233
  - lib/zint/dxfilmedge.rb
202
234
  - lib/zint/ean128.rb
235
+ - lib/zint/ean13.rb
203
236
  - lib/zint/ean14.rb
237
+ - lib/zint/ean8.rb
204
238
  - lib/zint/eanx.rb
205
239
  - lib/zint/eanxchk.rb
206
240
  - lib/zint/excode39.rb
@@ -278,6 +312,7 @@ licenses:
278
312
  metadata:
279
313
  homepage_uri: https://github.com/eliasfroehner/ruby-zint
280
314
  source_code_uri: https://github.com/eliasfroehner/ruby-zint
315
+ changelog_uri: https://github.com/eliasfroehner/ruby-zint/blob/master/CHANGELOG.md
281
316
  documentation_uri: https://rubydoc.info/gems/ruby-zint
282
317
  rdoc_options:
283
318
  - "--main"
@@ -299,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
334
  - !ruby/object:Gem::Version
300
335
  version: 3.3.22
301
336
  requirements: []
302
- rubygems_version: 3.6.2
337
+ rubygems_version: 4.0.3
303
338
  specification_version: 4
304
339
  summary: Ruby FFI binding for libzint
305
340
  test_files: []
metadata.gz.sig ADDED
Binary file