ruby-zint 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.standard.yml +2 -0
  3. data/Gemfile +2 -0
  4. data/README.md +30 -8
  5. data/Rakefile +12 -0
  6. data/ext/ruby-zint/extconf.rb +86 -0
  7. data/lib/zint/aus_post.rb +1 -0
  8. data/lib/zint/aus_redirect.rb +1 -0
  9. data/lib/zint/aus_reply.rb +1 -0
  10. data/lib/zint/aus_route.rb +1 -0
  11. data/lib/zint/azrune.rb +1 -0
  12. data/lib/zint/aztec.rb +1 -0
  13. data/lib/zint/barcode.rb +439 -47
  14. data/lib/zint/{noascii.rb → bc_412.rb} +3 -2
  15. data/lib/zint/c25iata.rb +1 -0
  16. data/lib/zint/c25ind.rb +1 -0
  17. data/lib/zint/c25inter.rb +1 -0
  18. data/lib/zint/c25logic.rb +1 -0
  19. data/lib/zint/c25matrix.rb +1 -0
  20. data/lib/zint/c25standard.rb +1 -0
  21. data/lib/zint/{box.rb → cep_net.rb} +3 -2
  22. data/lib/zint/channel.rb +1 -0
  23. data/lib/zint/codabar.rb +1 -0
  24. data/lib/zint/codablock_f.rb +1 -0
  25. data/lib/zint/code11.rb +1 -0
  26. data/lib/zint/code128.rb +1 -0
  27. data/lib/zint/{dotty_mode.rb → code128ab.rb} +3 -2
  28. data/lib/zint/code128b.rb +2 -4
  29. data/lib/zint/code16k.rb +1 -0
  30. data/lib/zint/code32.rb +1 -0
  31. data/lib/zint/code39.rb +1 -0
  32. data/lib/zint/code49.rb +1 -0
  33. data/lib/zint/code93.rb +1 -0
  34. data/lib/zint/code_one.rb +1 -0
  35. data/lib/zint/constants/capability_flags.rb +14 -11
  36. data/lib/zint/constants/input_data_types.rb +8 -7
  37. data/lib/zint/constants/output_options.rb +14 -11
  38. data/lib/zint/constants/symbologies.rb +13 -6
  39. data/lib/zint/constants/warn_levels.rb +1 -1
  40. data/lib/zint/daft.rb +1 -0
  41. data/lib/zint/data_matrix.rb +1 -0
  42. data/lib/zint/dbarexp.rb +1 -0
  43. data/lib/zint/dbarexpstk.rb +1 -0
  44. data/lib/zint/dbarltd.rb +1 -0
  45. data/lib/zint/dbaromn.rb +1 -0
  46. data/lib/zint/dbaromnstk.rb +1 -0
  47. data/lib/zint/dbarstk.rb +1 -0
  48. data/lib/zint/dependencies.rb +8 -0
  49. data/lib/zint/dot_code.rb +1 -0
  50. data/lib/zint/dpd.rb +1 -0
  51. data/lib/zint/dpident.rb +1 -0
  52. data/lib/zint/dpleit.rb +1 -0
  53. data/lib/zint/ean128.rb +1 -0
  54. data/lib/zint/ean14.rb +1 -0
  55. data/lib/zint/eanx.rb +1 -0
  56. data/lib/zint/eanxchk.rb +1 -0
  57. data/lib/zint/excode39.rb +1 -0
  58. data/lib/zint/fim.rb +1 -0
  59. data/lib/zint/flat.rb +1 -0
  60. data/lib/zint/grid_matrix.rb +1 -0
  61. data/lib/zint/gs1_128.rb +1 -0
  62. data/lib/zint/hanxin.rb +1 -0
  63. data/lib/zint/hibc128.rb +1 -0
  64. data/lib/zint/hibc39.rb +1 -0
  65. data/lib/zint/hibcaztec.rb +1 -0
  66. data/lib/zint/hibcblockf.rb +1 -0
  67. data/lib/zint/hibcdm.rb +1 -0
  68. data/lib/zint/hibcmicpdf.rb +1 -0
  69. data/lib/zint/hibcpdf.rb +1 -0
  70. data/lib/zint/hibcqr.rb +1 -0
  71. data/lib/zint/isbnx.rb +1 -0
  72. data/lib/zint/itf14.rb +1 -0
  73. data/lib/zint/japan_post.rb +1 -0
  74. data/lib/zint/kix.rb +1 -0
  75. data/lib/zint/korea_post.rb +1 -0
  76. data/lib/zint/logmars.rb +1 -0
  77. data/lib/zint/mailmark.rb +1 -0
  78. data/lib/zint/mailmark_2d.rb +8 -0
  79. data/lib/zint/mailmark_4s.rb +8 -0
  80. data/lib/zint/maxi_code.rb +1 -0
  81. data/lib/zint/micro_pdf417.rb +1 -0
  82. data/lib/zint/micro_qr.rb +1 -0
  83. data/lib/zint/msiplessey.rb +1 -0
  84. data/lib/zint/native.rb +87 -0
  85. data/lib/zint/nve18.rb +1 -0
  86. data/lib/zint/one_code.rb +1 -0
  87. data/lib/zint/pdf417.rb +1 -0
  88. data/lib/zint/pdf417comp.rb +1 -0
  89. data/lib/zint/pdf417trunc.rb +1 -0
  90. data/lib/zint/pharma.rb +1 -0
  91. data/lib/zint/pharmatwo.rb +1 -0
  92. data/lib/zint/planet.rb +1 -0
  93. data/lib/zint/plessey.rb +1 -0
  94. data/lib/zint/postnet.rb +1 -0
  95. data/lib/zint/pzn.rb +1 -0
  96. data/lib/zint/qr.rb +1 -0
  97. data/lib/zint/rmqr.rb +1 -0
  98. data/lib/zint/rss14.rb +1 -0
  99. data/lib/zint/rss14stack.rb +1 -0
  100. data/lib/zint/rss14stackomni.rb +1 -0
  101. data/lib/zint/rssexp.rb +1 -0
  102. data/lib/zint/rssexpstack.rb +1 -0
  103. data/lib/zint/rssltd.rb +1 -0
  104. data/lib/zint/structs/structapp.rb +25 -0
  105. data/lib/zint/structs/symbol.rb +44 -36
  106. data/lib/zint/structs/vector.rb +47 -5
  107. data/lib/zint/structs/vector_circle.rb +32 -0
  108. data/lib/zint/structs/vector_hexagon.rb +31 -0
  109. data/lib/zint/structs/vector_rect.rb +37 -0
  110. data/lib/zint/structs/vector_string.rb +43 -8
  111. data/lib/zint/telepen.rb +1 -0
  112. data/lib/zint/telepennum.rb +1 -0
  113. data/lib/zint/ultra.rb +1 -0
  114. data/lib/zint/upc_a.rb +1 -0
  115. data/lib/zint/upc_a_chk.rb +1 -0
  116. data/lib/zint/upc_e.rb +1 -0
  117. data/lib/zint/upc_e_chk.rb +1 -0
  118. data/lib/zint/upnqr.rb +1 -0
  119. data/lib/zint/{bind.rb → upu_s10.rb} +3 -2
  120. data/lib/zint/uspsimail.rb +1 -0
  121. data/lib/zint/version.rb +1 -1
  122. data/lib/zint/vin.rb +1 -0
  123. data/lib/zint/zint_recipe.rb +27 -0
  124. data/lib/zint.rb +15 -83
  125. data/ports/archives/zint-2.12.0-src.tar.gz +0 -0
  126. metadata +34 -12
  127. data/Gemfile.lock +0 -79
  128. data/lib/zint/stdout.rb +0 -7
  129. data/lib/zint/structs/circle.rb +0 -11
  130. data/lib/zint/structs/hexagon.rb +0 -11
  131. data/lib/zint/structs/rect.rb +0 -12
data/lib/zint/code49.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Code 49
2
3
  class Code49 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_CODE49, options: options)
data/lib/zint/code93.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Code 93
2
3
  class Code93 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_CODE93, options: options)
data/lib/zint/code_one.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Code One
2
3
  class CodeOne < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_CODEONE, options: options)
@@ -2,17 +2,20 @@ 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 UPC/EAN?)
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_FIXED_RATIO = 0x0100 # Has fixed width-to-height (aspect) ratio?
13
- ZINT_CAP_READER_INIT = 0x0200 # Supports Reader Initialisation?
14
- ZINT_CAP_FULL_MULTIBYTE = 0x0400 # Supports full-multibyte option?
15
- ZINT_CAP_MASK = 0x0800 # Is mask selectable?
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? */
16
19
  end
17
20
  end
18
21
  end
@@ -2,13 +2,14 @@ module Zint
2
2
  module Constants
3
3
  # Input data types (`symbol->input_mode`)
4
4
  module InputDataTypes
5
- DATA_MODE = 0
6
- UNICODE_MODE = 1
7
- GS1_MODE = 2
8
- # The following may be OR-ed with above
9
- ESCAPE_MODE = 8
10
- GS1PARENS_MODE = 16
11
- GS1NOCHECK_MODE = 32
5
+ DATA_MODE = 0 # Binary
6
+ UNICODE_MODE = 1 # UTF-8
7
+ GS1_MODE = 2 # GS1
8
+ ESCAPE_MODE = 0x0008 # Process escape sequences
9
+ GS1PARENS_MODE = 0x0010 # Process parentheses as GS1 AI delimiters (instead of square brackets)
10
+ GS1NOCHECK_MODE = 0x0020 # Do not check validity of GS1 data (except that printable ASCII only)
11
+ HEIGHTPERROW_MODE = 0x0040 # Interpret `height` as per-row rather than as overall height
12
+ FAST_MODE = 0x0080 # Use faster if less optimal encodation or other shortcuts if available (affects DATAMATRIX, MICROPDF417, PDF417, QRCODE & UPNQR only)
12
13
  end
13
14
  end
14
15
  end
@@ -2,17 +2,20 @@ module Zint
2
2
  module Constants
3
3
  # Output options (`symbol->output_options`)
4
4
  module OutputOptions
5
- BARCODE_NO_ASCII = 1 # Legacy (no-op)
6
- BARCODE_BIND = 2 # Boundary bars above & below the symbol and between stacked symbols
7
- BARCODE_BOX = 4 # Box around symbol
8
- BARCODE_STDOUT = 8 # Output to stdout
9
- READER_INIT = 16 # Reader Initialisation (Programming)
10
- SMALL_TEXT = 32 # Use smaller font
11
- BOLD_TEXT = 64 # Use bold font
12
- CMYK_COLOUR = 128 # CMYK colour space (Encapsulated PostScript and TIF)
13
- BARCODE_DOTTY_MODE = 256 # Plot a matrix symbol using dots rather than squares
14
- GS1_GS_SEPARATOR = 512 # Use GS instead of FNC1 as GS1 separator (Data Matrix)
15
- OUT_BUFFER_INTERMEDIATE = 1024 # Return ASCII values in bitmap buffer (OUT_BUFFER only)
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 */
16
19
  end
17
20
  end
18
21
  end
@@ -35,25 +35,27 @@ module Zint
35
35
  BARCODE_UPCA_CHK = 35 # UPC-A + Check Digit
36
36
  BARCODE_UPCE = 37 # UPC-E
37
37
  BARCODE_UPCE_CHK = 38 # UPC-E + Check Digit
38
- BARCODE_POSTNET = 40 # USPS POSTNET
38
+ BARCODE_POSTNET = 40 # USPS (U.S. Postal Service) POSTNET
39
39
  BARCODE_MSI_PLESSEY = 47 # MSI Plessey
40
40
  BARCODE_FIM = 49 # Facing Identification Mark
41
41
  BARCODE_LOGMARS = 50 # LOGMARS
42
42
  BARCODE_PHARMA = 51 # Pharmacode One-Track
43
43
  BARCODE_PZN = 52 # Pharmazentralnummer
44
44
  BARCODE_PHARMA_TWO = 53 # Pharmacode Two-Track
45
+ BARCODE_CEPNET = 54 # Brazilian CEPNet Postal Code
45
46
  BARCODE_PDF417 = 55 # PDF417
46
47
  BARCODE_PDF417COMP = 56 # Compact PDF417 (Truncated PDF417)
47
48
  BARCODE_PDF417TRUNC = 56 # Legacy
48
49
  BARCODE_MAXICODE = 57 # MaxiCode
49
50
  BARCODE_QRCODE = 58 # QR Code
50
- BARCODE_CODE128B = 60 # Code 128 (Subset B)
51
+ BARCODE_CODE128AB = 60 # Code 128 (Suppress subset C)
52
+ BARCODE_CODE128B = 60 # Legacy
51
53
  BARCODE_AUSPOST = 63 # Australia Post Standard Customer
52
54
  BARCODE_AUSREPLY = 66 # Australia Post Reply Paid
53
55
  BARCODE_AUSROUTE = 67 # Australia Post Routing
54
56
  BARCODE_AUSREDIRECT = 68 # Australia Post Redirection
55
57
  BARCODE_ISBNX = 69 # ISBN
56
- BARCODE_RM4SCC = 70 # Royal Mail 4 State
58
+ BARCODE_RM4SCC = 70 # Royal Mail 4-State Customer Code
57
59
  BARCODE_DATAMATRIX = 71 # Data Matrix (ECC200)
58
60
  BARCODE_EAN14 = 72 # EAN-14
59
61
  BARCODE_VIN = 73 # Vehicle Identification Number
@@ -71,7 +73,7 @@ module Zint
71
73
  BARCODE_MICROPDF417 = 84 # MicroPDF417
72
74
  BARCODE_USPS_IMAIL = 85 # USPS Intelligent Mail (OneCode)
73
75
  BARCODE_ONECODE = 85 # Legacy
74
- BARCODE_PLESSEY = 86 # Plessey Code
76
+ BARCODE_PLESSEY = 86 # UK Plessey
75
77
 
76
78
  # Tbarcode 8 codes
77
79
  BARCODE_TELEPEN_NUM = 87 # Telepen Numeric
@@ -83,7 +85,7 @@ module Zint
83
85
  BARCODE_MICROQR = 97 # Micro QR Code
84
86
 
85
87
  # Tbarcode 9 codes
86
- BARCODE_HIBC_128 = 98 # HIBC Code 128
88
+ BARCODE_HIBC_128 = 98 # HIBC (Health Industry Barcode) Code 128
87
89
  BARCODE_HIBC_39 = 99 # HIBC Code 39
88
90
  BARCODE_HIBC_DM = 102 # HIBC Data Matrix
89
91
  BARCODE_HIBC_QR = 104 # HIBC QR Code
@@ -97,7 +99,10 @@ module Zint
97
99
  BARCODE_HANXIN = 116 # Han Xin (Chinese Sensible) Code
98
100
 
99
101
  # Tbarcode 11 codes
100
- BARCODE_MAILMARK = 121 # Royal Mail 4-state Mailmark
102
+ BARCODE_MAILMARK_2D = 119 # Royal Mail 2D Mailmark (CMDM) (Data Matrix)
103
+ BARCODE_UPU_S10 = 120 # Universal Postal Union S10
104
+ BARCODE_MAILMARK_4S = 121 # Royal Mail 4-State Mailmark
105
+ BARCODE_MAILMARK = 121 # Legacy
101
106
 
102
107
  # Zint specific
103
108
  BARCODE_AZRUNE = 128 # Aztec Runes
@@ -125,6 +130,8 @@ module Zint
125
130
  BARCODE_UPNQR = 143 # UPNQR (Univerzalnega Plačilnega Naloga QR)
126
131
  BARCODE_ULTRA = 144 # Ultracode
127
132
  BARCODE_RMQR = 145 # Rectangular Micro QR Code (rMQR)
133
+ BARCODE_BC412 = 146 # IBM BC412 (SEMI T1-95)
134
+ BARCODE_LAST = 146 # Max barcode number marker, not barcode
128
135
  end
129
136
  end
130
137
  end
@@ -1,6 +1,6 @@
1
1
  module Zint
2
2
  module Constants
3
- # Warning warn (`symbol->warn_level`)
3
+ # Warning level (`symbol->warn_level`)
4
4
  module WarnLevels
5
5
  WARN_DEFAULT = 0 # Default behaviour
6
6
  WARN_FAIL_ALL = 2 # Treat warning as error
data/lib/zint/daft.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # DAFT Code
2
3
  class Daft < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DAFT, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Data Matrix (ECC200)
2
3
  class DataMatrix < Barcode
3
4
  # Options
4
5
  DM_NULL = 0
data/lib/zint/dbarexp.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # GS1 DataBar Expanded
2
3
  class DbarExp < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DBAR_EXP, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # GS1 DataBar Expanded Stacked
2
3
  class DbarExpstk < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DBAR_EXPSTK, options: options)
data/lib/zint/dbarltd.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # GS1 DataBar Limited
2
3
  class DbarLtd < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DBAR_LTD, options: options)
data/lib/zint/dbaromn.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # GS1 DataBar Omnidirectional
2
3
  class DbarOmn < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DBAR_OMN, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # GS1 DataBar Stacked Omnidirectional
2
3
  class DbarOmnstk < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DBAR_OMNSTK, options: options)
data/lib/zint/dbarstk.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # GS1 DataBar Stacked
2
3
  class DbarStk < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DBAR_STK, options: options)
@@ -0,0 +1,8 @@
1
+ module Zint
2
+ ZINT_VERSION = ENV["ZINT_VERSION"] || "2.12.0"
3
+ # ZINT_SOURCE_URI = "file://#{File.join(File.expand_path("../../../", __FILE__))}/ports/archives/zint-#{ZINT_VERSION}-src.tar.gz"
4
+ ZINT_SOURCE_URI = "https://downloads.sourceforge.net/zint/zint-#{ZINT_VERSION}-src.tar.gz"
5
+ ZINT_SOURCE_SHA1 = "6e16036d9822895edededd96e65da755ef3fdb69"
6
+
7
+ MINI_PORTILE_VERSION = "~> 2.1"
8
+ end
data/lib/zint/dot_code.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # DotCode
2
3
  class DotCode < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DOTCODE, options: options)
data/lib/zint/dpd.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # DPD Code
2
3
  class Dpd < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DPD, options: options)
data/lib/zint/dpident.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Deutsche Post Identcode
2
3
  class Dpident < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DPIDENT, options: options)
data/lib/zint/dpleit.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Deutsche Post Leitcode
2
3
  class Dpleit < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_DPLEIT, options: options)
data/lib/zint/ean128.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class Ean128 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_EAN128, options: options)
data/lib/zint/ean14.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # EAN-14
2
3
  class Ean14 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_EAN14, options: options)
data/lib/zint/eanx.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # EAN (European Article Number)
2
3
  class Eanx < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_EANX, options: options)
data/lib/zint/eanxchk.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # EAN + Check Digit
2
3
  class EanxChk < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_EANX_CHK, options: options)
data/lib/zint/excode39.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Extended Code 39
2
3
  class Excode39 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_EXCODE39, options: options)
data/lib/zint/fim.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Facing Identification Mark
2
3
  class Fim < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_FIM, options: options)
data/lib/zint/flat.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Flattermarken
2
3
  class Flat < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_FLAT, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Grid Matrix
2
3
  class GridMatrix < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_GRIDMATRIX, options: options)
data/lib/zint/gs1_128.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Zint
2
2
  # standard:disable Naming/ClassAndModuleCamelCase
3
+ # GS1-128
3
4
  class Gs1_128 < Barcode
4
5
  # standard:enable Naming/ClassAndModuleCamelCase
5
6
  def initialize(value: nil, input_file: nil, options: {})
data/lib/zint/hanxin.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Han Xin (Chinese Sensible) Code
2
3
  class Hanxin < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HANXIN, options: options)
data/lib/zint/hibc128.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC (Health Industry Barcode) Code 128
2
3
  class Hibc128 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_128, options: options)
data/lib/zint/hibc39.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC Code 39
2
3
  class Hibc39 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_39, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC Aztec Code
2
3
  class HibcAztec < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_AZTEC, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC Codablock-F
2
3
  class HibcBlockf < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_BLOCKF, options: options)
data/lib/zint/hibcdm.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC Data Matrix
2
3
  class HibcDm < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_DM, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC MicroPDF417
2
3
  class HibcMicpdf < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_MICPDF, options: options)
data/lib/zint/hibcpdf.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC PDF417
2
3
  class HibcPdf < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_PDF, options: options)
data/lib/zint/hibcqr.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # HIBC QR Code
2
3
  class HibcQr < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_HIBC_QR, options: options)
data/lib/zint/isbnx.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # ISBN
2
3
  class Isbnx < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_ISBNX, options: options)
data/lib/zint/itf14.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # ITF-14
2
3
  class Itf14 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_ITF14, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Japanese Postal Code
2
3
  class JapanPost < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_JAPANPOST, options: options)
data/lib/zint/kix.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Dutch Post KIX Code
2
3
  class Kix < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_KIX, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Korea Post
2
3
  class KoreaPost < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_KOREAPOST, options: options)
data/lib/zint/logmars.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # LOGMARS
2
3
  class Logmars < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_LOGMARS, options: options)
data/lib/zint/mailmark.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class Mailmark < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_MAILMARK, options: options)
@@ -0,0 +1,8 @@
1
+ module Zint
2
+ # Royal Mail 2D Mailmark (CMDM) (Data Matrix)
3
+ class Mailmark2D < Barcode
4
+ def initialize(value: nil, input_file: nil, options: {})
5
+ super(value: value, input_file: input_file, type: Zint::BARCODE_MAILMARK_2D, options: options)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Zint
2
+ # Royal Mail 4-State Mailmark
3
+ class Mailmark4S < Barcode
4
+ def initialize(value: nil, input_file: nil, options: {})
5
+ super(value: value, input_file: input_file, type: Zint::BARCODE_MAILMARK_4S, options: options)
6
+ end
7
+ end
8
+ end
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # MaxiCode
2
3
  class MaxiCode < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_MAXICODE, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # MicroPDF417
2
3
  class MicroPdf417 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_MICROPDF417, options: options)
data/lib/zint/micro_qr.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Micro QR Code
2
3
  class MicroQr < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_MICROQR, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # MSI Plessey
2
3
  class MsiPlessey < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_MSI_PLESSEY, options: options)
@@ -0,0 +1,87 @@
1
+ module Zint
2
+ module Native
3
+ extend FFI::Library
4
+
5
+ root_path = File.expand_path("../../..", __FILE__)
6
+ prefix = FFI::Platform::LIBPREFIX.empty? ? "lib" : FFI::Platform::LIBPREFIX
7
+ bundled_dll = File.join(root_path, "lib/#{prefix}zint.#{FFI::Platform::LIBSUFFIX}")
8
+ ffi_lib [bundled_dll, "libzint.so.2.12", "libzint", "zint"]
9
+
10
+ # Error codes (API return values)
11
+ enum :error_code, [Constants::Warnings::WARNINGS, Constants::Errors::ERRORS].map { |h| h.to_a }.flatten
12
+
13
+ # Aliases for better method signatures
14
+ typedef Structs::Symbol.by_ref, :zint_symbol
15
+ typedef :pointer, :filename
16
+ typedef :int32, :length
17
+ typedef :int32, :rotate_angle
18
+ typedef :int32, :symbol_id
19
+ typedef :uint32, :cap_flag
20
+ typedef :string, :source
21
+
22
+ # Create and initialize a symbol structure
23
+ attach_function(:ZBarcode_Create, [], :zint_symbol)
24
+
25
+ # Free any output buffers that may have been created and initialize output fields
26
+ attach_function(:ZBarcode_Clear, [:zint_symbol], :void)
27
+
28
+ # Free a symbol structure, including any output buffers
29
+ #
30
+ # For use with ruby's garbage collector ZBarcode_Delete must be called with a plain :pointer and not an :zint_symbol.
31
+ attach_function(:ZBarcode_Delete, [:pointer], :void)
32
+
33
+ # Encode a barcode. If `length` is 0, `source` must be NUL-terminated.
34
+ attach_function(:ZBarcode_Encode, [:zint_symbol, :source, :length], :error_code)
35
+
36
+ # Encode a barcode using input data from file `filename`
37
+ attach_function(:ZBarcode_Encode_File, [:zint_symbol, :filename], :error_code)
38
+
39
+ # Output a previously encoded symbol to file `symbol->outfile`
40
+ attach_function(:ZBarcode_Print, [:zint_symbol, :rotate_angle], :error_code)
41
+
42
+ # Encode and output a symbol to file `symbol->outfile`
43
+ attach_function(:ZBarcode_Encode_and_Print, [:zint_symbol, :source, :length, :rotate_angle], :error_code)
44
+
45
+ # Encode a symbol using input data from file `filename` and output to file `symbol->outfile`
46
+ attach_function(:ZBarcode_Encode_File_and_Print, [:zint_symbol, :filename, :rotate_angle], :error_code)
47
+
48
+ # Output a previously encoded symbol to memory as raster (`symbol->bitmap`)
49
+ attach_function(:ZBarcode_Buffer, [:zint_symbol, :rotate_angle], :error_code)
50
+
51
+ # Encode and output a symbol to memory as raster (`symbol->bitmap`)
52
+ attach_function(:ZBarcode_Encode_and_Buffer, [:zint_symbol, :source, :length, :rotate_angle], :error_code)
53
+
54
+ # Encode a symbol using input data from file `filename` and output to memory as raster (`symbol->bitmap`)
55
+ attach_function(:ZBarcode_Encode_File_and_Buffer, [:zint_symbol, :filename, :rotate_angle], :error_code)
56
+
57
+ # Output a previously encoded symbol to memory as vector (`symbol->vector`)
58
+ attach_function(:ZBarcode_Buffer_Vector, [:zint_symbol, :rotate_angle], :error_code)
59
+
60
+ # Encode and output a symbol to memory as vector (`symbol->vector`)
61
+ attach_function(:ZBarcode_Encode_and_Buffer_Vector, [:zint_symbol, :source, :length, :rotate_angle], :error_code)
62
+
63
+ # Encode a symbol using input data from file `filename` and output to memory as vector (`symbol->vector`)
64
+ attach_function(:ZBarcode_Encode_File_and_Buffer_Vector, [:zint_symbol, :filename, :rotate_angle], :error_code)
65
+
66
+ # Is `symbol_id` a recognized symbology?
67
+ attach_function(:ZBarcode_ValidID, [:symbol_id], :bool)
68
+
69
+ # Return the capability flags for symbology `symbol_id` that match `cap_flag`
70
+ attach_function(:ZBarcode_Cap, [:symbol_id, :cap_flag], :uint32)
71
+
72
+ # Return the version of Zint linked to
73
+ attach_function(:ZBarcode_Version, [], :int32)
74
+
75
+ # Raises specific error for API return code
76
+ #
77
+ # @param res [Symbol, Integer] API return code
78
+ # @param text [String] error text
79
+ # @raise [Error]
80
+ def self.raise_error(res, text)
81
+ klass = ERROR_CLASS_FOR_RESULT[res.is_a?(Symbol) ? Zint::ERRORS[res] : res]
82
+ raise klass, text
83
+ end
84
+ end
85
+
86
+ private_constant :Native
87
+ end
data/lib/zint/nve18.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # NVE-18 (SSCC-18)
2
3
  class Nve18 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_NVE18, options: options)
data/lib/zint/one_code.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class OneCode < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_ONECODE, options: options)
data/lib/zint/pdf417.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # PDF417
2
3
  class Pdf417 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PDF417, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Compact PDF417 (Truncated PDF417)
2
3
  class Pdf417comp < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PDF417COMP, options: options)