ruby-zint 1.4.1 → 1.6.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +37 -0
- data/README.md +43 -11
- data/ext/ruby-zint/extconf.rb +31 -4
- data/lib/zint/barcode.rb +60 -33
- data/lib/zint/constants/capability_flags.rb +15 -14
- data/lib/zint/constants/errors.rb +2 -1
- data/lib/zint/constants/input_data_types.rb +2 -0
- data/lib/zint/constants/output_options.rb +18 -14
- data/lib/zint/constants/specific_options.rb +1 -0
- data/lib/zint/constants/symbologies.rb +10 -3
- data/lib/zint/constants.rb +8 -0
- data/lib/zint/dependencies.rb +10 -2
- data/lib/zint/dxfilmedge.rb +8 -0
- data/lib/zint/ean13.rb +8 -0
- data/lib/zint/ean8.rb +8 -0
- data/lib/zint/eanx.rb +7 -0
- data/lib/zint/eanxchk.rb +7 -0
- data/lib/zint/native.rb +20 -1
- data/lib/zint/structs/seg.rb +26 -0
- data/lib/zint/structs/symbol.rb +15 -9
- data/lib/zint/version.rb +1 -1
- data/lib/zint/zint_recipe.rb +8 -4
- data/lib/zint.rb +4 -0
- data/ports/archives/libpng-1.6.56.tar.xz +0 -0
- data/ports/archives/zint-2.16.0-src.tar.gz +0 -0
- data/ports/archives/zlib-1.3.2.tar.gz +0 -0
- data.tar.gz.sig +0 -0
- metadata +48 -12
- metadata.gz.sig +0 -0
- data/.rspec +0 -3
- data/.standard.yml +0 -5
- data/Gemfile +0 -20
- data/Rakefile +0 -23
- data/ports/archives/zint-2.12.0-src.tar.gz +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c8d3cfc84e06b7371e179b17a1068ab51ffb2508e6b89ed061cfa2410b21825d
|
|
4
|
+
data.tar.gz: cd4353bc891bf8605626d3268cddbea67e6722e8ef9e4a92cbe31c0b014684d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f18fc4e5b613fce1938aac642c82aecc1373c0c98ce3f36f99cabfc1b5d593db6410c2ae894c25f23d812ebc12e32cb26ce21db924f8fb4657a033f9d3254022
|
|
7
|
+
data.tar.gz: 0e6f6fb21ebfa0fbe28039ace7257011d47b1fcaa338ccf581ac236258245e06740e23d751c706d27c38908fa3beeb7d3e2448b15aa7e326eb4a9d5017828975
|
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,30 +4,48 @@
|
|
|
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/
|
|
7
|
+
See the [documentation](https://rubydoc.info/gems/ruby-zint) for a full API description.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
+
Install via RubyGems:
|
|
12
|
+
|
|
13
|
+
gem install ruby-zint
|
|
14
|
+
|
|
15
|
+
This installs the binary gem, specific to the running platform by default.
|
|
16
|
+
|
|
17
|
+
### Binary gem
|
|
18
|
+
|
|
19
|
+
The binary gems don't depend on the libzint package on the running system or on CMake or libpng.
|
|
20
|
+
They have libzint builtin and should just work.
|
|
21
|
+
|
|
22
|
+
### Source gem
|
|
23
|
+
|
|
24
|
+
If for some reason the binary gem doesn't work for you, the source gem can be installed alternatively.
|
|
25
|
+
It can be forced by:
|
|
26
|
+
|
|
27
|
+
gem uninstall ruby-zint --all
|
|
28
|
+
gem install ruby-zint --platform ruby
|
|
29
|
+
|
|
11
30
|
By default ruby-zint first tries to use libzint installed on the system.
|
|
12
|
-
If libzint can't be found or if it isn't a supported version, then the zint version, bundled into the gem, is compiled and used.
|
|
31
|
+
If libzint can't be found or if it isn't a supported version, then the zint version, bundled into the gem, is compiled and used instead.
|
|
13
32
|
Both install methods can be enforced by using `--enable-system-libzint` or `--disable-system-libzint` options, see below.
|
|
14
33
|
|
|
15
|
-
|
|
34
|
+
#### With libzint source code (recommended)
|
|
16
35
|
First install CMake with your package manager (e. g. `apt install cmake`).
|
|
17
|
-
|
|
36
|
+
Please also install libpng (e. g. `apt install libpng-dev`) before installing the gem if you want to use the PNG format.
|
|
18
37
|
Afterwards install the gem and force builtin libzint:
|
|
19
38
|
|
|
20
39
|
```
|
|
21
40
|
$ gem install ruby-zint -- --disable-system-libzint
|
|
22
41
|
```
|
|
23
42
|
|
|
24
|
-
|
|
43
|
+
#### With system libraries
|
|
25
44
|
|
|
26
45
|
Install the libzint binary with your package manager (e. g. `apt install zint` or perhaps `brew install zint`).
|
|
27
|
-
|
|
28
46
|
Other platforms require building [from source](https://www.zint.org.uk/manual/chapter/2).
|
|
29
47
|
|
|
30
|
-
**NOTE:** It is assumed that you are using libzint with the version [2.
|
|
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/).
|
|
31
49
|
|
|
32
50
|
Then install this gem and enforce system libzint:
|
|
33
51
|
|
|
@@ -38,15 +56,29 @@ $ gem install ruby-zint -- --enable-system-libzint
|
|
|
38
56
|
### Gemfile
|
|
39
57
|
|
|
40
58
|
Include `gem "ruby-zint"` in your Gemfile.
|
|
41
|
-
|
|
59
|
+
To make sure, the necessary platforms and the source gem are fetched by bundler, they can be added like so
|
|
42
60
|
|
|
43
61
|
```
|
|
44
|
-
bundle
|
|
62
|
+
bundle lock --add-platform x86_64-linux-gnu
|
|
63
|
+
bundle lock --add-platform arm64-darwin
|
|
64
|
+
bundle lock --add-platform x64-mingw-ucrt
|
|
65
|
+
bundle lock --add-platform ruby
|
|
66
|
+
bundle package --all-platforms
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A re-run of `bundle package` is also necessary after `bundle update`, in order to retrieve the new specific gems of all platforms.
|
|
70
|
+
|
|
71
|
+
If the binary gems don't work for some reason, it's easy to force the usage of the source gem in the Gemfile:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
gem "ruby-zint", force_ruby_platform: true
|
|
45
75
|
```
|
|
46
76
|
|
|
47
|
-
|
|
77
|
+
Optionally set the install option by running bundler like so:
|
|
48
78
|
|
|
49
|
-
|
|
79
|
+
```
|
|
80
|
+
bundle config build.ruby-zint --enable-system-libzint
|
|
81
|
+
```
|
|
50
82
|
|
|
51
83
|
## Usage
|
|
52
84
|
|
data/ext/ruby-zint/extconf.rb
CHANGED
|
@@ -45,20 +45,41 @@ def libzint_usable?
|
|
|
45
45
|
m = Module.new do
|
|
46
46
|
extend FFI::Library
|
|
47
47
|
|
|
48
|
-
ffi_lib(%w[libzint.so.2.
|
|
48
|
+
ffi_lib(%w[libzint.so.2.16 libzint zint])
|
|
49
49
|
attach_function(:ZBarcode_Version, [], :int32)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
(
|
|
52
|
+
(21600...21700) === m.ZBarcode_Version
|
|
53
53
|
rescue LoadError
|
|
54
54
|
false
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def build_bundled_libzint
|
|
58
|
-
puts "Build"
|
|
58
|
+
puts "Build libzint and dependencies"
|
|
59
59
|
require_relative "../../lib/zint/zint_recipe"
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
recipe_zlib = Zint::ZintRecipe.new("zlib", Zint::LIBZ_VERSION, Zint::LIBZ_SOURCE_URI, Zint::LIBZ_SOURCE_SHA256)
|
|
62
|
+
recipe_zlib.configure_options += [
|
|
63
|
+
"-DCMAKE_C_FLAGS=-fPIC",
|
|
64
|
+
"-DZLIB_SHARED=OFF"
|
|
65
|
+
]
|
|
66
|
+
recipe_zlib.cook_and_activate
|
|
67
|
+
|
|
68
|
+
recipe_png = Zint::ZintRecipe.new("libpng", Zint::LIBPNG_VERSION, Zint::LIBPNG_SOURCE_URI, Zint::LIBPNG_SOURCE_SHA256)
|
|
69
|
+
recipe_png.configure_options += [
|
|
70
|
+
"-DCMAKE_C_FLAGS=-fPIC",
|
|
71
|
+
"-DZLIB_ROOT=#{recipe_zlib.path}",
|
|
72
|
+
"-DPNG_SHARED=OFF"
|
|
73
|
+
]
|
|
74
|
+
recipe_png.cook_and_activate
|
|
75
|
+
|
|
76
|
+
recipe = Zint::ZintRecipe.new("libzint", Zint::ZINT_VERSION, Zint::ZINT_SOURCE_URI, Zint::ZINT_SOURCE_SHA256)
|
|
77
|
+
recipe.configure_options += [
|
|
78
|
+
"-DZLIB_INCLUDE_DIR=#{recipe_zlib.path}/include",
|
|
79
|
+
"-DZLIB_LIBRARY=#{recipe_zlib.path}/lib/#{(RUBY_PLATFORM =~ /mingw/) ? "libzs.a" : "libz.a"}",
|
|
80
|
+
"-DPNG_PNG_INCLUDE_DIR=#{recipe_png.path}/include",
|
|
81
|
+
"-DPNG_LIBRARY=#{recipe_png.path}/lib/libpng.a"
|
|
82
|
+
]
|
|
62
83
|
recipe.cook_and_activate
|
|
63
84
|
recipe.path
|
|
64
85
|
end
|
|
@@ -69,6 +90,11 @@ unless enable_config("system-libzint", libzint_usable?)
|
|
|
69
90
|
libzint_path = build_bundled_libzint
|
|
70
91
|
end
|
|
71
92
|
|
|
93
|
+
if libzint_path
|
|
94
|
+
# For cross compiled gem
|
|
95
|
+
FileUtils.cp Dir["#{libzint_path}/*/libzint.*"].first, "libzint.#{RbConfig::CONFIG["DLEXT"]}", verbose: true
|
|
96
|
+
end
|
|
97
|
+
|
|
72
98
|
# Create a Makefile which copies the libzint library files to the gem's lib dir.
|
|
73
99
|
File.open("Makefile", "wb") do |mf|
|
|
74
100
|
mf.puts <<~EOT
|
|
@@ -79,6 +105,7 @@ File.open("Makefile", "wb") do |mf|
|
|
|
79
105
|
EOT
|
|
80
106
|
|
|
81
107
|
if libzint_path
|
|
108
|
+
# Only executed in source build
|
|
82
109
|
mf.puts <<-EOT
|
|
83
110
|
cp -r #{libzint_path.dump}/*/libzint* $(RUBYARCHDIR)
|
|
84
111
|
EOT
|
data/lib/zint/barcode.rb
CHANGED
|
@@ -16,10 +16,11 @@ module Zint
|
|
|
16
16
|
|
|
17
17
|
# @param value [String, NilClass] Content of the barcode
|
|
18
18
|
# @param input_file [String, NilClass] Path to input file with content of the barcode
|
|
19
|
+
# @param segments [Array<Hash>, NilClass] Array of ECI segments to encode
|
|
19
20
|
# @param symbology [Integer] Type of barcode
|
|
20
21
|
# @param kwargs [Hash] Specific options for zint symbol (height, scale, ...)
|
|
21
|
-
def initialize(value: nil, input_file: nil, symbology: Zint::BARCODE_CODE128, **kwargs)
|
|
22
|
-
raise ArgumentError, "value or
|
|
22
|
+
def initialize(value: nil, input_file: nil, segments: nil, symbology: Zint::BARCODE_CODE128, **kwargs)
|
|
23
|
+
raise ArgumentError, "value, input_file or segments must be given!" if value&.empty? && input_file&.empty? && segments.nil?
|
|
23
24
|
raise ArgumentError, "input_file not found!" if input_file && !File.exist?(input_file)
|
|
24
25
|
|
|
25
26
|
@zint_symbol = Native.ZBarcode_Create
|
|
@@ -30,6 +31,7 @@ module Zint
|
|
|
30
31
|
|
|
31
32
|
@value = value
|
|
32
33
|
@input_file = input_file
|
|
34
|
+
encode_segments(segments)
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
# Exports barcode to file
|
|
@@ -46,31 +48,27 @@ module Zint
|
|
|
46
48
|
|
|
47
49
|
if input_file
|
|
48
50
|
call_function(:ZBarcode_Encode_File_and_Print, @zint_symbol, input_file, rotate_angle)
|
|
51
|
+
elsif @p_segments
|
|
52
|
+
call_seg_function(:ZBarcode_Encode_Segs_and_Print, rotate_angle)
|
|
49
53
|
else
|
|
50
54
|
call_function(:ZBarcode_Encode_and_Print, @zint_symbol, value, value.bytesize, rotate_angle)
|
|
51
55
|
end
|
|
52
56
|
end
|
|
53
57
|
|
|
54
|
-
# Exports barcode to
|
|
58
|
+
# Exports barcode to image file as a string
|
|
55
59
|
#
|
|
56
60
|
# @param extension [String] Extension exported memory file
|
|
57
61
|
# @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
|
|
58
62
|
# @return [String] Exported memory file
|
|
59
63
|
def to_memory_file(extension: ".png", rotate_angle: 0)
|
|
60
|
-
|
|
61
|
-
file = Tempfile.new(["zint", extension])
|
|
64
|
+
@zint_symbol[:output_options] |= Zint::BARCODE_MEMORY_FILE
|
|
62
65
|
|
|
63
|
-
to_file(path:
|
|
66
|
+
to_file(path: extension, rotate_angle: rotate_angle)
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
buffer = file.read
|
|
67
|
-
file.close
|
|
68
|
-
file.unlink
|
|
69
|
-
|
|
70
|
-
buffer
|
|
68
|
+
@zint_symbol[:memfile].read_bytes(@zint_symbol[:memfile_size])
|
|
71
69
|
end
|
|
72
70
|
|
|
73
|
-
# Exports barcode to buffer
|
|
71
|
+
# Exports barcode to bitmap data as a string buffer
|
|
74
72
|
#
|
|
75
73
|
# @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
|
|
76
74
|
# @return [String] Exported barcode buffer
|
|
@@ -78,10 +76,12 @@ module Zint
|
|
|
78
76
|
unless @zint_symbol[:bitmap].null?
|
|
79
77
|
raise AlreadyGenerated, "to_vector was already executed"
|
|
80
78
|
end
|
|
81
|
-
@zint_symbol[:output_options]
|
|
79
|
+
@zint_symbol[:output_options] |= Zint::OUT_BUFFER_INTERMEDIATE
|
|
82
80
|
|
|
83
81
|
if input_file
|
|
84
82
|
call_function(:ZBarcode_Encode_File_and_Buffer, @zint_symbol, input_file, rotate_angle)
|
|
83
|
+
elsif @p_segments
|
|
84
|
+
call_seg_function(:ZBarcode_Encode_Segs_and_Buffer, rotate_angle)
|
|
85
85
|
else
|
|
86
86
|
call_function(:ZBarcode_Encode_and_Buffer, @zint_symbol, value, value.bytesize, rotate_angle)
|
|
87
87
|
end
|
|
@@ -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
|
|
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
|
|
@@ -116,6 +116,8 @@ module Zint
|
|
|
116
116
|
end
|
|
117
117
|
if input_file
|
|
118
118
|
call_function(:ZBarcode_Encode_File_and_Buffer_Vector, @zint_symbol, input_file, rotate_angle)
|
|
119
|
+
elsif @p_segments
|
|
120
|
+
call_seg_function(:ZBarcode_Encode_Segs_and_Buffer_Vector, rotate_angle)
|
|
119
121
|
else
|
|
120
122
|
call_function(:ZBarcode_Encode_and_Buffer_Vector, @zint_symbol, value, value.bytesize, rotate_angle)
|
|
121
123
|
end
|
|
@@ -134,6 +136,8 @@ module Zint
|
|
|
134
136
|
def encode
|
|
135
137
|
if input_file
|
|
136
138
|
call_function(:ZBarcode_Encode_File, @zint_symbol, input_file)
|
|
139
|
+
elsif @p_segments
|
|
140
|
+
call_seg_function(:ZBarcode_Encode_Segs)
|
|
137
141
|
else
|
|
138
142
|
call_function(:ZBarcode_Encode, @zint_symbol, value, value.bytesize)
|
|
139
143
|
end
|
|
@@ -314,18 +318,6 @@ module Zint
|
|
|
314
318
|
@zint_symbol[:show_hrt] = show_hrt
|
|
315
319
|
end
|
|
316
320
|
|
|
317
|
-
# Gets font size of barcode
|
|
318
|
-
def fontsize
|
|
319
|
-
@zint_symbol[:fontsize]
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
# Sets font size of barcode (Unused)
|
|
323
|
-
#
|
|
324
|
-
# @param fontsize [Integer] Font size of barcode
|
|
325
|
-
def fontsize=(fontsize)
|
|
326
|
-
@zint_symbol[:fontsize] = fontsize
|
|
327
|
-
end
|
|
328
|
-
|
|
329
321
|
# Gets input mode of barcode
|
|
330
322
|
def input_mode
|
|
331
323
|
@zint_symbol[:input_mode]
|
|
@@ -388,7 +380,7 @@ module Zint
|
|
|
388
380
|
|
|
389
381
|
# Human Readable Text, which usually consists of input data plus one more check digit. Uses UTF-8 formatting.
|
|
390
382
|
def text
|
|
391
|
-
@zint_symbol[:text].
|
|
383
|
+
@zint_symbol[:text].to_ptr.read_bytes(@zint_symbol[:text_length]).force_encoding(Encoding::UTF_8)
|
|
392
384
|
end
|
|
393
385
|
|
|
394
386
|
# Gets rows of barcode
|
|
@@ -413,6 +405,22 @@ module Zint
|
|
|
413
405
|
@zint_symbol[:primary] = primary
|
|
414
406
|
end
|
|
415
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
|
+
|
|
416
424
|
# Gets encoded data of barcode as internal FFI::StructLayout::CharArray object
|
|
417
425
|
#
|
|
418
426
|
# Don't use this method, it might be changed in future releases.
|
|
@@ -479,11 +487,6 @@ module Zint
|
|
|
479
487
|
@zint_symbol[:bitmap_height]
|
|
480
488
|
end
|
|
481
489
|
|
|
482
|
-
# Gets bitmap byte length of barcode
|
|
483
|
-
def bitmap_byte_length
|
|
484
|
-
@zint_symbol[:bitmap_byte_length]
|
|
485
|
-
end
|
|
486
|
-
|
|
487
490
|
# Gets dot size of barcode
|
|
488
491
|
def dot_size
|
|
489
492
|
@zint_symbol[:dot_size]
|
|
@@ -535,5 +538,29 @@ module Zint
|
|
|
535
538
|
|
|
536
539
|
error_code
|
|
537
540
|
end
|
|
541
|
+
|
|
542
|
+
def call_seg_function(function_name, *args)
|
|
543
|
+
call_function(function_name, @zint_symbol, @p_segments, @p_strings.size, *args)
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
def encode_segments(segments)
|
|
547
|
+
@p_segments = nil
|
|
548
|
+
return unless segments
|
|
549
|
+
|
|
550
|
+
raise ArgumentError, "segments must be Array<Hash<source: String, eci: Integer>>!" if !segments.is_a?(Array) || !segments.first.is_a?(Hash)
|
|
551
|
+
|
|
552
|
+
@p_segments = FFI::MemoryPointer.new Structs::Seg, segments.size
|
|
553
|
+
@p_strings = [] # Prevent garbage collection
|
|
554
|
+
segments.each_with_index do |seg, sidx|
|
|
555
|
+
p_seg = Structs::Seg.new(@p_segments + Structs::Seg.size * sidx)
|
|
556
|
+
source = seg[:source] || raise(ArgumentError, ":source not defined")
|
|
557
|
+
eci = seg[:eci] || raise(ArgumentError, ":eci not defined")
|
|
558
|
+
|
|
559
|
+
@p_strings << FFI::MemoryPointer.from_string(source)
|
|
560
|
+
p_seg[:source] = @p_strings.last
|
|
561
|
+
p_seg[:length] = source.bytesize
|
|
562
|
+
p_seg[:eci] = eci
|
|
563
|
+
end
|
|
564
|
+
end
|
|
538
565
|
end
|
|
539
566
|
end
|
|
@@ -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
|
|
@@ -10,6 +10,8 @@ module Zint
|
|
|
10
10
|
GS1NOCHECK_MODE = 0x0020 # Do not check validity of GS1 data (except that printable ASCII only)
|
|
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
|
+
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
|
|
13
15
|
end
|
|
14
16
|
end
|
|
15
17
|
end
|
|
@@ -2,20 +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
|
|
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`
|
|
19
23
|
end
|
|
20
24
|
end
|
|
21
25
|
end
|
|
@@ -4,6 +4,7 @@ module Zint
|
|
|
4
4
|
module SpecificOptions
|
|
5
5
|
DM_SQUARE = 100 # Only consider square versions on automatic symbol size selection
|
|
6
6
|
DM_DMRE = 101 # Consider DMRE versions on automatic symbol size selection
|
|
7
|
+
DM_ISO_144 = 128 # Use ISO instead of "de facto" format for 144x144 (i.e. don't skew ECC)
|
|
7
8
|
|
|
8
9
|
ZINT_FULL_MULTIBYTE = 200 # Enable Kanji/Hanzi compression for Latin-1 & binary data
|
|
9
10
|
ULTRA_COMPRESSION = 128 # Enable Ultracode compression (experimental)
|
|
@@ -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
|
-
|
|
16
|
-
|
|
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
|
|
@@ -131,7 +135,10 @@ module Zint
|
|
|
131
135
|
BARCODE_ULTRA = 144 # Ultracode
|
|
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
|
|
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
|
|
135
142
|
end
|
|
136
143
|
end
|
|
137
144
|
end
|
data/lib/zint/dependencies.rb
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
module Zint
|
|
2
|
-
|
|
2
|
+
LIBZ_VERSION = ENV["LIBZ_VERSION"] || "1.3.2"
|
|
3
|
+
LIBZ_SOURCE_URI = "http://zlib.net/fossils/zlib-#{LIBZ_VERSION}.tar.gz"
|
|
4
|
+
LIBZ_SOURCE_SHA256 = "bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16"
|
|
5
|
+
|
|
6
|
+
ZINT_VERSION = ENV["ZINT_VERSION"] || "2.16.0"
|
|
3
7
|
ZINT_SOURCE_URI = "https://downloads.sourceforge.net/zint/zint-#{ZINT_VERSION}-src.tar.gz"
|
|
4
|
-
|
|
8
|
+
ZINT_SOURCE_SHA256 = "37e767afada2403bb9ae49b93a19eb0a9e944a0c278d9f23522746b3d08a3c4b"
|
|
9
|
+
|
|
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"
|
|
5
13
|
|
|
6
14
|
MINI_PORTILE_VERSION = "~> 2.1"
|
|
7
15
|
end
|
data/lib/zint/ean13.rb
ADDED
data/lib/zint/ean8.rb
ADDED
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
|
@@ -5,7 +5,9 @@ module Zint
|
|
|
5
5
|
root_path = File.expand_path("../../..", __FILE__)
|
|
6
6
|
prefix = FFI::Platform::LIBPREFIX.empty? ? "lib" : FFI::Platform::LIBPREFIX
|
|
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
|
+
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.16", "libzint", "zint"]
|
|
9
11
|
|
|
10
12
|
# Error codes (API return values)
|
|
11
13
|
enum :error_code, [Constants::Warnings::WARNINGS, Constants::Errors::ERRORS].map { |h| h.to_a }.flatten
|
|
@@ -63,6 +65,23 @@ module Zint
|
|
|
63
65
|
# Encode a symbol using input data from file `filename` and output to memory as vector (`symbol->vector`)
|
|
64
66
|
attach_function(:ZBarcode_Encode_File_and_Buffer_Vector, [:zint_symbol, :filename, :rotate_angle], :error_code, blocking: true)
|
|
65
67
|
|
|
68
|
+
# ********* Segment support *********
|
|
69
|
+
# int ZBarcode_Encode_Segs(struct zint_symbol *symbol,
|
|
70
|
+
# const struct zint_seg segs[], const int seg_count);
|
|
71
|
+
attach_function(:ZBarcode_Encode_Segs, [:zint_symbol, :pointer, :int], :error_code, blocking: true)
|
|
72
|
+
|
|
73
|
+
# int ZBarcode_Encode_Segs_and_Print(struct zint_symbol *symbol,
|
|
74
|
+
# const struct zint_seg segs[], const int seg_count, int rotate_angle);
|
|
75
|
+
attach_function(:ZBarcode_Encode_Segs_and_Print, [:zint_symbol, :pointer, :int, :rotate_angle], :error_code, blocking: true)
|
|
76
|
+
|
|
77
|
+
# int ZBarcode_Encode_Segs_and_Buffer(struct zint_symbol *symbol,
|
|
78
|
+
# const struct zint_seg segs[], const int seg_count, int rotate_angle);
|
|
79
|
+
attach_function(:ZBarcode_Encode_Segs_and_Buffer, [:zint_symbol, :pointer, :int, :rotate_angle], :error_code, blocking: true)
|
|
80
|
+
|
|
81
|
+
# int ZBarcode_Encode_Segs_and_Buffer_Vector(struct zint_symbol *symbol,
|
|
82
|
+
# const struct zint_seg segs[], const int seg_count, int rotate_angle);
|
|
83
|
+
attach_function(:ZBarcode_Encode_Segs_and_Buffer_Vector, [:zint_symbol, :pointer, :int, :rotate_angle], :error_code, blocking: true)
|
|
84
|
+
|
|
66
85
|
# Is `symbol_id` a recognized symbology?
|
|
67
86
|
attach_function(:ZBarcode_ValidID, [:symbol_id], :bool, blocking: true)
|
|
68
87
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Zint
|
|
2
|
+
module Structs
|
|
3
|
+
class Seg < FFI::Struct
|
|
4
|
+
# /* Segment for use with `content_segs` and API `ZBarcode_Encode_Segs()` */
|
|
5
|
+
# struct zint_seg {
|
|
6
|
+
# unsigned char *source; /* Data to encode, or (`content_segs`) data encoded */
|
|
7
|
+
# int length; /* Length of `source`. If 0 or negative, `source` must be NUL-terminated */
|
|
8
|
+
# int eci; /* Extended Channel Interpretation */
|
|
9
|
+
# };
|
|
10
|
+
|
|
11
|
+
layout :source, :pointer, # Data to encode, or (`content_segs`) data encoded
|
|
12
|
+
:length, :int, # Length of `source`. If 0 or negative, `source` must be NUL-terminated
|
|
13
|
+
:eci, :int # Extended Channel Interpretation
|
|
14
|
+
|
|
15
|
+
# Data to encode, or (`content_segs`) data encoded
|
|
16
|
+
def source
|
|
17
|
+
self[:source].read_bytes(self[:length])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Extended Channel Interpretation
|
|
21
|
+
def eci
|
|
22
|
+
self[:eci]
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/zint/structs/symbol.rb
CHANGED
|
@@ -8,8 +8,8 @@ module Zint
|
|
|
8
8
|
:whitespace_height, :int, # Height in X-dimensions of whitespace above & below the barcode
|
|
9
9
|
:border_width, :int, # Size of border in X-dimensions
|
|
10
10
|
:output_options, :int, # Various output parameters (bind, box etc, see below)
|
|
11
|
-
:fgcolour, [:char,
|
|
12
|
-
:bgcolour, [:char,
|
|
11
|
+
:fgcolour, [:char, 16], # Foreground as RGB/RGBA hexadecimal string, 6 or 8 characters, NUL-terminated
|
|
12
|
+
:bgcolour, [:char, 16], # Background as RGB/RGBA hexadecimal string, 6 or 8 characters, NUL-terminated
|
|
13
13
|
:fgcolor, :pointer, # Pointer to fgcolour (alternate spelling)
|
|
14
14
|
:bgcolor, :pointer, # Pointer to bgcolour (alternate spelling)
|
|
15
15
|
:outfile, [:char, 256], # Name of file to output to, NUL-terminated. Default "out.png" ("out.gif" if NO_PNG)
|
|
@@ -18,27 +18,33 @@ module Zint
|
|
|
18
18
|
:option_2, :int, # Symbol-specific options
|
|
19
19
|
:option_3, :int, # Symbol-specific options
|
|
20
20
|
:show_hrt, :int, # Show (1) or hide (0) Human Readable Text (HRT). Default 1
|
|
21
|
-
:fontsize, :int, # Unused
|
|
22
21
|
:input_mode, :int, # Encoding of input data (see DATA_MODE etc below). Default DATA_MODE
|
|
23
22
|
:eci, :int, # Extended Channel Interpretation. Default 0 (none)
|
|
24
23
|
:dpmm, :float, # Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none)
|
|
25
24
|
:dot_size, :float, # Size of dots used in BARCODE_DOTTY_MODE. Default 0.8
|
|
25
|
+
:text_gap, :float, # float text_gap; /* Gap between barcode and text (HRT) in X-dimensions. Default 1 */
|
|
26
26
|
:guard_descent, :float, # Height in X-dimensions that EAN/UPC guard bars descend. Default 5
|
|
27
27
|
:structapp, Structapp, # Structured Append info. Default structapp.count 0 (none)
|
|
28
28
|
:warn_level, :int, # Affects error/warning value returned by Zint API (see WARN_XXX below)
|
|
29
29
|
:debug, :int, # Debugging flags
|
|
30
|
-
:text, [:uchar,
|
|
30
|
+
:text, [:uchar, 256], # Human Readable Text (if any), UTF-8, NUL-terminated (output only)
|
|
31
|
+
:text_length, :int, # int text_length; /* Length of text in bytes (output only) */
|
|
31
32
|
:rows, :int, # Number of rows used by the symbol (output only)
|
|
32
33
|
:width, :int, # Width of the generated symbol (output only)
|
|
33
|
-
:
|
|
34
|
-
:row_height, [:float, 200], # Heights of rows (output only). Allows for 200 row DotCode
|
|
35
|
-
: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)
|
|
36
35
|
:bitmap, :pointer, # Stored bitmap image (raster output only)
|
|
37
36
|
:bitmap_width, :int, # Width of bitmap image (raster output only)
|
|
38
37
|
:bitmap_height, :int, # Height of bitmap image (raster output only)
|
|
39
38
|
:alphamap, :pointer, # Array of alpha values used (raster output only)
|
|
40
|
-
:
|
|
41
|
-
:
|
|
39
|
+
:vector, Vector.by_ref, # Pointer to vector header (vector output only)
|
|
40
|
+
:memfile, :pointer, # unsigned char *memfile; /* Pointer to in-memory file buffer if BARCODE_MEMORY_FILE (output only) */
|
|
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
|
|
42
48
|
|
|
43
49
|
# @private
|
|
44
50
|
def self.release(ptr)
|
data/lib/zint/version.rb
CHANGED
data/lib/zint/zint_recipe.rb
CHANGED
|
@@ -8,14 +8,18 @@ module Zint
|
|
|
8
8
|
class ZintRecipe < MiniPortileCMake
|
|
9
9
|
ROOT = File.expand_path("../../..", __FILE__)
|
|
10
10
|
|
|
11
|
-
def initialize
|
|
12
|
-
super(
|
|
11
|
+
def initialize(name, vers, url, sha256)
|
|
12
|
+
super(name, vers)
|
|
13
13
|
self.target = File.join(ROOT, "ports")
|
|
14
|
-
self.files = [url:
|
|
14
|
+
self.files = [url: url, sha256: sha256]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def port_path
|
|
18
|
+
"#{target}/#{RUBY_PLATFORM}"
|
|
15
19
|
end
|
|
16
20
|
|
|
17
21
|
def cook_and_activate
|
|
18
|
-
checkpoint = File.join(target, "#{name}-#{version}-#{
|
|
22
|
+
checkpoint = File.join(target, "#{name}-#{version}-#{RUBY_PLATFORM}.installed")
|
|
19
23
|
unless File.exist?(checkpoint)
|
|
20
24
|
cook
|
|
21
25
|
FileUtils.touch checkpoint
|
data/lib/zint.rb
CHANGED
|
@@ -20,6 +20,7 @@ require "zint/structs/vector_hexagon"
|
|
|
20
20
|
require "zint/structs/vector_rect"
|
|
21
21
|
require "zint/structs/vector_string"
|
|
22
22
|
require "zint/structs/vector"
|
|
23
|
+
require "zint/structs/seg"
|
|
23
24
|
require "zint/structs/structapp"
|
|
24
25
|
require "zint/structs/symbol"
|
|
25
26
|
require "zint/native"
|
|
@@ -82,8 +83,11 @@ module Zint
|
|
|
82
83
|
autoload :Dpd, "zint/dpd"
|
|
83
84
|
autoload :Dpident, "zint/dpident"
|
|
84
85
|
autoload :Dpleit, "zint/dpleit"
|
|
86
|
+
autoload :Dxfilmedge, "zint/dxfilmedge"
|
|
85
87
|
autoload :Ean128, "zint/ean128"
|
|
88
|
+
autoload :Ean13, "zint/ean13"
|
|
86
89
|
autoload :Ean14, "zint/ean14"
|
|
90
|
+
autoload :Ean8, "zint/ean8"
|
|
87
91
|
autoload :Eanx, "zint/eanx"
|
|
88
92
|
autoload :EanxChk, "zint/eanxchk"
|
|
89
93
|
autoload :Excode39, "zint/excode39"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data.tar.gz.sig
ADDED
|
Binary file
|
metadata
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-zint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elias Fröhner
|
|
8
|
+
- Lars Kanis
|
|
8
9
|
bindir: bin
|
|
9
|
-
cert_chain:
|
|
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-----
|
|
10
36
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
37
|
dependencies:
|
|
12
38
|
- !ruby/object:Gem::Dependency
|
|
@@ -39,6 +65,7 @@ dependencies:
|
|
|
39
65
|
version: '2.1'
|
|
40
66
|
email:
|
|
41
67
|
- apiwalker96@gmail.com
|
|
68
|
+
- lars@greiz-reinsdorf.de
|
|
42
69
|
executables: []
|
|
43
70
|
extensions:
|
|
44
71
|
- ext/ruby-zint/extconf.rb
|
|
@@ -75,6 +102,7 @@ extra_rdoc_files:
|
|
|
75
102
|
- lib/zint/code49.rb
|
|
76
103
|
- lib/zint/code93.rb
|
|
77
104
|
- lib/zint/code_one.rb
|
|
105
|
+
- lib/zint/constants.rb
|
|
78
106
|
- lib/zint/daft.rb
|
|
79
107
|
- lib/zint/data_matrix.rb
|
|
80
108
|
- lib/zint/dbarexp.rb
|
|
@@ -88,8 +116,11 @@ extra_rdoc_files:
|
|
|
88
116
|
- lib/zint/dpd.rb
|
|
89
117
|
- lib/zint/dpident.rb
|
|
90
118
|
- lib/zint/dpleit.rb
|
|
119
|
+
- lib/zint/dxfilmedge.rb
|
|
91
120
|
- lib/zint/ean128.rb
|
|
121
|
+
- lib/zint/ean13.rb
|
|
92
122
|
- lib/zint/ean14.rb
|
|
123
|
+
- lib/zint/ean8.rb
|
|
93
124
|
- lib/zint/eanx.rb
|
|
94
125
|
- lib/zint/eanxchk.rb
|
|
95
126
|
- lib/zint/excode39.rb
|
|
@@ -153,13 +184,10 @@ extra_rdoc_files:
|
|
|
153
184
|
- lib/zint/vin.rb
|
|
154
185
|
- lib/zint/zint_recipe.rb
|
|
155
186
|
files:
|
|
156
|
-
- ".rspec"
|
|
157
|
-
- ".standard.yml"
|
|
158
187
|
- ".yardopts"
|
|
159
|
-
-
|
|
188
|
+
- CHANGELOG.md
|
|
160
189
|
- LICENSE.txt
|
|
161
190
|
- README.md
|
|
162
|
-
- Rakefile
|
|
163
191
|
- ext/ruby-zint/extconf.rb
|
|
164
192
|
- lib/ruby-zint.rb
|
|
165
193
|
- lib/zint.rb
|
|
@@ -193,6 +221,7 @@ files:
|
|
|
193
221
|
- lib/zint/code49.rb
|
|
194
222
|
- lib/zint/code93.rb
|
|
195
223
|
- lib/zint/code_one.rb
|
|
224
|
+
- lib/zint/constants.rb
|
|
196
225
|
- lib/zint/constants/capability_flags.rb
|
|
197
226
|
- lib/zint/constants/debug_flags.rb
|
|
198
227
|
- lib/zint/constants/errors.rb
|
|
@@ -215,8 +244,11 @@ files:
|
|
|
215
244
|
- lib/zint/dpd.rb
|
|
216
245
|
- lib/zint/dpident.rb
|
|
217
246
|
- lib/zint/dpleit.rb
|
|
247
|
+
- lib/zint/dxfilmedge.rb
|
|
218
248
|
- lib/zint/ean128.rb
|
|
249
|
+
- lib/zint/ean13.rb
|
|
219
250
|
- lib/zint/ean14.rb
|
|
251
|
+
- lib/zint/ean8.rb
|
|
220
252
|
- lib/zint/eanx.rb
|
|
221
253
|
- lib/zint/eanxchk.rb
|
|
222
254
|
- lib/zint/excode39.rb
|
|
@@ -266,6 +298,7 @@ files:
|
|
|
266
298
|
- lib/zint/rssexp.rb
|
|
267
299
|
- lib/zint/rssexpstack.rb
|
|
268
300
|
- lib/zint/rssltd.rb
|
|
301
|
+
- lib/zint/structs/seg.rb
|
|
269
302
|
- lib/zint/structs/structapp.rb
|
|
270
303
|
- lib/zint/structs/symbol.rb
|
|
271
304
|
- lib/zint/structs/vector.rb
|
|
@@ -286,13 +319,16 @@ files:
|
|
|
286
319
|
- lib/zint/version.rb
|
|
287
320
|
- lib/zint/vin.rb
|
|
288
321
|
- lib/zint/zint_recipe.rb
|
|
289
|
-
- ports/archives/
|
|
290
|
-
|
|
322
|
+
- ports/archives/libpng-1.6.56.tar.xz
|
|
323
|
+
- ports/archives/zint-2.16.0-src.tar.gz
|
|
324
|
+
- ports/archives/zlib-1.3.2.tar.gz
|
|
325
|
+
homepage: https://github.com/eliasfroehner/ruby-zint
|
|
291
326
|
licenses:
|
|
292
327
|
- MIT
|
|
293
328
|
metadata:
|
|
294
|
-
homepage_uri: https://github.com/
|
|
295
|
-
source_code_uri: https://github.com/
|
|
329
|
+
homepage_uri: https://github.com/eliasfroehner/ruby-zint
|
|
330
|
+
source_code_uri: https://github.com/eliasfroehner/ruby-zint
|
|
331
|
+
changelog_uri: https://github.com/eliasfroehner/ruby-zint/blob/master/CHANGELOG.md
|
|
296
332
|
msys2_mingw_dependencies: cmake libpng
|
|
297
333
|
documentation_uri: https://rubydoc.info/gems/ruby-zint
|
|
298
334
|
rdoc_options:
|
|
@@ -308,14 +344,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
308
344
|
requirements:
|
|
309
345
|
- - ">="
|
|
310
346
|
- !ruby/object:Gem::Version
|
|
311
|
-
version:
|
|
347
|
+
version: 3.0.0
|
|
312
348
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
349
|
requirements:
|
|
314
350
|
- - ">="
|
|
315
351
|
- !ruby/object:Gem::Version
|
|
316
352
|
version: '0'
|
|
317
353
|
requirements: []
|
|
318
|
-
rubygems_version:
|
|
354
|
+
rubygems_version: 4.0.3
|
|
319
355
|
specification_version: 4
|
|
320
356
|
summary: Ruby FFI binding for libzint
|
|
321
357
|
test_files: []
|
metadata.gz.sig
ADDED
|
Binary file
|
data/.rspec
DELETED
data/.standard.yml
DELETED
data/Gemfile
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
source "https://rubygems.org"
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in ruby-zint.gemspec
|
|
4
|
-
gemspec
|
|
5
|
-
|
|
6
|
-
gem "rake", "~> 13.0"
|
|
7
|
-
|
|
8
|
-
gem "rspec", "~> 3.0"
|
|
9
|
-
|
|
10
|
-
gem "simplecov", require: false
|
|
11
|
-
|
|
12
|
-
gem "chunky_png"
|
|
13
|
-
|
|
14
|
-
gem "byebug"
|
|
15
|
-
|
|
16
|
-
gem "standard", "~> 1.3"
|
|
17
|
-
|
|
18
|
-
gem "mini_portile2"
|
|
19
|
-
|
|
20
|
-
gem "yard"
|
data/Rakefile
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require "bundler/gem_tasks"
|
|
2
|
-
require "rspec/core/rake_task"
|
|
3
|
-
require_relative "lib/zint/zint_recipe"
|
|
4
|
-
|
|
5
|
-
CLOBBER.include "pkg"
|
|
6
|
-
CLOBBER.add("ports/*").exclude(%r{ports/archives$})
|
|
7
|
-
CLEAN.include "tmp"
|
|
8
|
-
CLEAN.include "ext/ruby-zint/tmp"
|
|
9
|
-
CLEAN.include "lib/*.a"
|
|
10
|
-
CLEAN.include "lib/*.so*"
|
|
11
|
-
CLEAN.include "lib/*.dll*"
|
|
12
|
-
|
|
13
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
14
|
-
|
|
15
|
-
require "standard/rake"
|
|
16
|
-
|
|
17
|
-
task default: %i[spec standard]
|
|
18
|
-
|
|
19
|
-
task gem: :build
|
|
20
|
-
task :compile do
|
|
21
|
-
sh "ruby -C ext/ruby-zint extconf.rb --disable-system-libzint"
|
|
22
|
-
sh "make -C ext/ruby-zint install RUBYARCHDIR=../../lib"
|
|
23
|
-
end
|
|
Binary file
|