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
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class Pdf417trunc < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PDF417TRUNC, options: options)
data/lib/zint/pharma.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Pharmacode One-Track
2
3
  class Pharma < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PHARMA, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Pharmacode Two-Track
2
3
  class PharmaTwo < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PHARMA_TWO, options: options)
data/lib/zint/planet.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # USPS PLANET
2
3
  class Planet < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PLANET, options: options)
data/lib/zint/plessey.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # UK Plessey
2
3
  class Plessey < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PLESSEY, options: options)
data/lib/zint/postnet.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # USPS (U.S. Postal Service) POSTNET
2
3
  class Postnet < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_POSTNET, options: options)
data/lib/zint/pzn.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Pharmazentralnummer
2
3
  class Pzn < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_PZN, options: options)
data/lib/zint/qr.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # QR Code
2
3
  class Qr < Barcode
3
4
  # ECC Levels
4
5
  ECC_LEVEL_L = 1
data/lib/zint/rmqr.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Rectangular Micro QR Code (rMQR)
2
3
  class Rmqr < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RMQR, options: options)
data/lib/zint/rss14.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class Rss14 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RSS14, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class Rss14stack < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RSS14STACK, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class Rss14stackOmni < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RSS14STACK_OMNI, options: options)
data/lib/zint/rssexp.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class RssExp < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RSS_EXP, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class RssExpstack < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RSS_EXPSTACK, options: options)
data/lib/zint/rssltd.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Legacy
2
3
  class RssLtd < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_RSS_LTD, options: options)
@@ -0,0 +1,25 @@
1
+ module Zint
2
+ module Structs
3
+ # Structured Append info - ignored unless `zint_structapp.count` is set to non-zero value
4
+ class Structapp < FFI::Struct
5
+ layout :index, :int, # Position in Structured Append sequence, 1-based. Must be <= `count`
6
+ :count, :int, # Number of symbols in Structured Append sequence. Set >= 2 to add SA Info
7
+ :id, [:char, 32] # Optional ID to distinguish sequence, ASCII, NUL-terminated unless max 32 long
8
+
9
+ # Position in Structured Append sequence, 1-based. Must be <= `count`
10
+ def index
11
+ self[:index]
12
+ end
13
+
14
+ # Number of symbols in Structured Append sequence. Set >= 2 to add SA Info
15
+ def count
16
+ self[:count]
17
+ end
18
+
19
+ # Optional ID to distinguish sequence, ASCII, NUL-terminated unless max 32 long
20
+ def id
21
+ self[:id]
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,41 +1,49 @@
1
1
  module Zint
2
2
  module Structs
3
- class Symbol < FFI::Struct
4
- layout :symbology, :int,
5
- :height, :float,
6
- :whitespace_width, :int,
7
- :whitespace_height, :int,
8
- :border_width, :int,
9
- :output_options, :int,
10
- :fgcolour, [:char, 10],
11
- :bgcolour, [:char, 10],
12
- :fgcolor, :pointer,
13
- :bgcolor, :pointer,
14
- :outfile, [:char, 256],
15
- :scale, :float,
16
- :option_1, :int,
17
- :option_2, :int,
18
- :option_3, :int,
19
- :show_hrt, :int,
20
- :fontsize, :int,
21
- :input_mode, :int,
22
- :eci, :int,
23
- :text, [:uchar, 128],
24
- :rows, :int,
25
- :width, :int,
26
- :primary, [:char, 128],
27
- :encoded_data, [:uchar, 200 * 143],
28
- :row_height, [:float, 200],
29
- :errtxt, [:char, 100],
30
- :bitmap, :pointer,
31
- :bitmap_width, :int,
32
- :bitmap_height, :int,
33
- :alphamap, :pointer,
34
- :bitmap_byte_length, :uchar,
35
- :dot_size, :float,
36
- :vector, :pointer,
37
- :debug, :int,
38
- :warn_level, :int
3
+ class Symbol < FFI::ManagedStruct
4
+ layout :symbology, :int, # Symbol to use (see BARCODE_XXX below)
5
+ :height, :float, # Barcode height in X-dimensions (ignored for fixed-width barcodes)
6
+ :scale, :float, # Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1
7
+ :whitespace_width, :int, # Width in X-dimensions of whitespace to left & right of barcode
8
+ :whitespace_height, :int, # Height in X-dimensions of whitespace above & below the barcode
9
+ :border_width, :int, # Size of border in X-dimensions
10
+ :output_options, :int, # Various output parameters (bind, box etc, see below)
11
+ :fgcolour, [:char, 10], # Foreground as RGB/RGBA hexadecimal string, 6 or 8 characters, NUL-terminated
12
+ :bgcolour, [:char, 10], # Background as RGB/RGBA hexadecimal string, 6 or 8 characters, NUL-terminated
13
+ :fgcolor, :pointer, # Pointer to fgcolour (alternate spelling)
14
+ :bgcolor, :pointer, # Pointer to bgcolour (alternate spelling)
15
+ :outfile, [:char, 256], # Name of file to output to, NUL-terminated. Default "out.png" ("out.gif" if NO_PNG)
16
+ :primary, [:char, 128], # Primary message data (MaxiCode, Composite), NUL-terminated
17
+ :option_1, :int, # Symbol-specific options (see "../docs/manual.txt")
18
+ :option_2, :int, # Symbol-specific options
19
+ :option_3, :int, # Symbol-specific options
20
+ :show_hrt, :int, # Show (1) or hide (0) Human Readable Text (HRT). Default 1
21
+ :fontsize, :int, # Unused
22
+ :input_mode, :int, # Encoding of input data (see DATA_MODE etc below). Default DATA_MODE
23
+ :eci, :int, # Extended Channel Interpretation. Default 0 (none)
24
+ :dpmm, :float, # Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none)
25
+ :dot_size, :float, # Size of dots used in BARCODE_DOTTY_MODE. Default 0.8
26
+ :guard_descent, :float, # Height in X-dimensions that EAN/UPC guard bars descend. Default 5
27
+ :structapp, Structapp, # Structured Append info. Default structapp.count 0 (none)
28
+ :warn_level, :int, # Affects error/warning value returned by Zint API (see WARN_XXX below)
29
+ :debug, :int, # Debugging flags
30
+ :text, [:uchar, 128], # Human Readable Text (if any), UTF-8, NUL-terminated (output only)
31
+ :rows, :int, # Number of rows used by the symbol (output only)
32
+ :width, :int, # Width of the generated symbol (output only)
33
+ :encoded_data, [:uchar, 200 * 144], # Encoded data (output only). Allows for rows of 1152 modules
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)
36
+ :bitmap, :pointer, # Stored bitmap image (raster output only)
37
+ :bitmap_width, :int, # Width of bitmap image (raster output only)
38
+ :bitmap_height, :int, # Height of bitmap image (raster output only)
39
+ :alphamap, :pointer, # Array of alpha values used (raster output only)
40
+ :bitmap_byte_length, :uchar, # Size of BMP bitmap data (raster output only)
41
+ :vector, Vector.by_ref # Pointer to vector header (vector output only)
42
+
43
+ # @private
44
+ def self.release(ptr)
45
+ Native.ZBarcode_Delete(ptr)
46
+ end
39
47
  end
40
48
  end
41
49
  end
@@ -1,12 +1,54 @@
1
1
  module Zint
2
2
  module Structs
3
3
  class Vector < FFI::Struct
4
- layout :width, :float,
4
+ layout :width, :float, # Width, height of barcode image (including text, whitespace)
5
5
  :height, :float,
6
- :rectangles, :pointer,
7
- :hexagons, :pointer,
8
- :strings, :pointer,
9
- :circles, :pointer
6
+ :rectangles, VectorRect.by_ref, # Pointer to first rectangle
7
+ :hexagons, VectorHexagon.by_ref, # Pointer to first hexagon
8
+ :strings, VectorString.by_ref, # Pointer to first string
9
+ :circles, VectorCircle.by_ref # Pointer to first circle
10
+
11
+ # Height of barcode image (including text, whitespace)
12
+ def height
13
+ self[:height]
14
+ end
15
+
16
+ # Width of barcode image (including text, whitespace)
17
+ def width
18
+ self[:width]
19
+ end
20
+
21
+ # Calls the given block and passes a VectorRect object for each rectangle to be printed.
22
+ def each_rectangle(&block)
23
+ each_vector(:rectangles, &block)
24
+ end
25
+
26
+ # Calls the given block and passes a VectorHexagon object for each hexagon to be printed.
27
+ def each_hexagon(&block)
28
+ each_vector(:hexagons, &block)
29
+ end
30
+
31
+ # Calls the given block and passes a VectorString object for each text string to be printed.
32
+ def each_string(&block)
33
+ each_vector(:strings, &block)
34
+ end
35
+
36
+ # Calls the given block and passes a VectorCircle object for each circle to be printed.
37
+ def each_circle(&block)
38
+ each_vector(:circles, &block)
39
+ end
40
+
41
+ private def each_vector(attr)
42
+ return to_enum(:each_vector, attr) unless block_given?
43
+
44
+ o = self[attr]
45
+ until o.null?
46
+ # Avoid garbage collection of Vector (and hence Barcode) before Vector*, since all memory is freed by ZBarcode_Delete()
47
+ o.instance_variable_set(:@vector, self)
48
+ yield o
49
+ o = o[:next]
50
+ end
51
+ end
10
52
  end
11
53
  end
12
54
  end
@@ -0,0 +1,32 @@
1
+ module Zint
2
+ module Structs
3
+ class VectorCircle < FFI::Struct
4
+ layout :x, :float,
5
+ :y, :float,
6
+ :diameter, :float, # Circle diameter. Does not include width (if any)
7
+ :width, :float, # Width of circle perimeter (circumference). 0 for fill (disc)
8
+ :colour, :int, # Non-zero for draw with background colour (else draw with foreground colour)
9
+ :next, VectorCircle.by_ref # Pointer to next circle
10
+
11
+ # x position
12
+ def x
13
+ self[:x]
14
+ end
15
+
16
+ # y position
17
+ def y
18
+ self[:y]
19
+ end
20
+
21
+ # diameter
22
+ def diameter
23
+ self[:diameter]
24
+ end
25
+
26
+ # Non-zero for draw with background colour
27
+ def colour
28
+ self[:colour]
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,31 @@
1
+ module Zint
2
+ module Structs
3
+ class VectorHexagon < FFI::Struct
4
+ layout :x, :float,
5
+ :y, :float,
6
+ :diameter, :float,
7
+ :rotation, :int, # 0, 90, 180, 270 degrees
8
+ :next, VectorHexagon.by_ref # Pointer to next hexagon
9
+
10
+ # x position
11
+ def x
12
+ self[:x]
13
+ end
14
+
15
+ # y position
16
+ def y
17
+ self[:y]
18
+ end
19
+
20
+ # diameter
21
+ def diameter
22
+ self[:diameter]
23
+ end
24
+
25
+ # 0, 90, 180, 270 degrees
26
+ def rotation
27
+ self[:rotation]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,37 @@
1
+ module Zint
2
+ module Structs
3
+ class VectorRect < FFI::Struct
4
+ layout :x, :float,
5
+ :y, :float,
6
+ :height, :float,
7
+ :width, :float,
8
+ :colour, :int, # -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White
9
+ :next, VectorRect.by_ref # Pointer to next rectangle
10
+
11
+ # x position
12
+ def x
13
+ self[:x]
14
+ end
15
+
16
+ # y position
17
+ def y
18
+ self[:y]
19
+ end
20
+
21
+ # height
22
+ def height
23
+ self[:height]
24
+ end
25
+
26
+ # width
27
+ def width
28
+ self[:width]
29
+ end
30
+
31
+ # -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White
32
+ def colour
33
+ self[:colour]
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,15 +1,50 @@
1
1
  module Zint
2
2
  module Structs
3
3
  class VectorString < FFI::Struct
4
- layout :x, :float,
4
+ layout :x, :float, # x, y position relative to halign
5
5
  :y, :float,
6
- :fsize, :float,
7
- :width, :float,
8
- :length, :int,
9
- :rotation, :int,
10
- :halign, :int,
11
- :text, :pointer,
12
- :next, :pointer
6
+ :fsize, :float, # font size
7
+ :width, :float, # Suggested string width, may be 0 if none recommended
8
+ :length, :int, # Number of characters
9
+ :rotation, :int, # 0, 90, 180, 270 degrees
10
+ :halign, :int, # Horizontal alignment: 0 for centre, 1 for left, 2 for right (end)
11
+ :text, :pointer, # the text string to be printed
12
+ :next, VectorString.by_ref # Pointer to next string
13
+
14
+ # x position relative to halign
15
+ def x
16
+ self[:x]
17
+ end
18
+
19
+ # y position
20
+ def y
21
+ self[:y]
22
+ end
23
+
24
+ # font size
25
+ def fsize
26
+ self[:fsize]
27
+ end
28
+
29
+ # Suggested string width, may be 0 if none recommended
30
+ def width
31
+ self[:width]
32
+ end
33
+
34
+ # 0, 90, 180, 270 degrees
35
+ def rotation
36
+ self[:rotation]
37
+ end
38
+
39
+ # Horizontal alignment: 0 for centre, 1 for left, 2 for right (end)
40
+ def halign
41
+ self[:halign]
42
+ end
43
+
44
+ # the text string to be printed
45
+ def text
46
+ self[:text].read_bytes(self[:length])
47
+ end
13
48
  end
14
49
  end
15
50
  end
data/lib/zint/telepen.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Telepen Alpha
2
3
  class Telepen < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_TELEPEN, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Telepen Numeric
2
3
  class TelepenNum < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_TELEPEN_NUM, options: options)
data/lib/zint/ultra.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Ultracode
2
3
  class Ultra < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_ULTRA, options: options)
data/lib/zint/upc_a.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # UPC-A
2
3
  class UpcA < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_UPCA, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # UPC-A + Check Digit
2
3
  class UpcAChk < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_UPCA_CHK, options: options)
data/lib/zint/upc_e.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # UPC-E
2
3
  class UpcE < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_UPCE, options: options)
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # UPC-E + Check Digit
2
3
  class UpcEChk < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_UPCE_CHK, options: options)
data/lib/zint/upnqr.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # UPNQR (Univerzalnega Plačilnega Naloga QR)
2
3
  class Upnqr < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_UPNQR, options: options)
@@ -1,7 +1,8 @@
1
1
  module Zint
2
- class Bind < Barcode
2
+ # Universal Postal Union S10
3
+ class UpuS10 < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
- super(value: value, input_file: input_file, type: Zint::BARCODE_BIND, options: options)
5
+ super(value: value, input_file: input_file, type: Zint::BARCODE_UPU_S10, options: options)
5
6
  end
6
7
  end
7
8
  end
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # USPS Intelligent Mail (OneCode)
2
3
  class UspsImail < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_USPS_IMAIL, options: options)
data/lib/zint/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zint
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/zint/vin.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Zint
2
+ # Vehicle Identification Number
2
3
  class Vin < Barcode
3
4
  def initialize(value: nil, input_file: nil, options: {})
4
5
  super(value: value, input_file: input_file, type: Zint::BARCODE_VIN, options: options)
@@ -0,0 +1,27 @@
1
+ require_relative "dependencies"
2
+ require "rubygems"
3
+ # Keep the version constraint in sync with libusb.gemspec
4
+ gem "mini_portile2", Zint::MINI_PORTILE_VERSION
5
+ require "mini_portile2"
6
+
7
+ module Zint
8
+ class ZintRecipe < MiniPortileCMake
9
+ ROOT = File.expand_path("../../..", __FILE__)
10
+
11
+ def initialize
12
+ super("libzint", ZINT_VERSION)
13
+ self.target = File.join(ROOT, "ports")
14
+ self.files = [url: ZINT_SOURCE_URI, sha1: ZINT_SOURCE_SHA1]
15
+ end
16
+
17
+ def cook_and_activate
18
+ checkpoint = File.join(target, "#{name}-#{version}-#{host}.installed")
19
+ unless File.exist?(checkpoint)
20
+ cook
21
+ FileUtils.touch checkpoint
22
+ end
23
+ activate
24
+ self
25
+ end
26
+ end
27
+ end