barby 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/barby/outputter/rmagick_outputter.rb +14 -2
- data/lib/barby/outputter/svg_outputter.rb +1 -12
- data/lib/barby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9930672e6c6e3b86ec968b0185c698a37e00567d
|
4
|
+
data.tar.gz: ec20ca147ea99a0d0543c3428d4cd4dbf4058ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ce490db8fc1212d5faffc15016c86fa49cc93248109d2aa1bcd4dc255283de6cfdabc94ac4fd5beb28ec2f45a0279105d0019161be07c0f4f8e24b8f193ed6
|
7
|
+
data.tar.gz: 84f578fcfc64bafd2d6b224b8d8953ea96b69afbb9b9db1f5bcb69ec19ef34300d9ada7145be6521bd2b1618f6fb51c60bfd10c815863d8044584cc5ccbab6c4
|
data/CHANGELOG
CHANGED
@@ -64,7 +64,14 @@ module Barby
|
|
64
64
|
if x1 == x2 && y1 == y2
|
65
65
|
bars.point(x1,y1)
|
66
66
|
else
|
67
|
-
|
67
|
+
# For single pixel lines, use line
|
68
|
+
if x1 == x2
|
69
|
+
bars.line(x1, y1, x1, y2)
|
70
|
+
elsif y1 == y2
|
71
|
+
bars.line(x1, y1, x2, y1)
|
72
|
+
else
|
73
|
+
bars.rectangle(x1, y1, x2, y2)
|
74
|
+
end
|
68
75
|
end
|
69
76
|
end
|
70
77
|
x1 += xdim
|
@@ -77,7 +84,12 @@ module Barby
|
|
77
84
|
if bar
|
78
85
|
x2 = x1+(xdim-1)
|
79
86
|
y2 = y1+(height-1)
|
80
|
-
|
87
|
+
# For single pixel width, use line
|
88
|
+
if x1 == x2
|
89
|
+
bars.line(x1, y1, x1, y2)
|
90
|
+
else
|
91
|
+
bars.rectangle(x1, y1, x2, y2)
|
92
|
+
end
|
81
93
|
end
|
82
94
|
x1 += xdim
|
83
95
|
end
|
@@ -21,7 +21,6 @@ module Barby
|
|
21
21
|
|
22
22
|
attr_writer :title, :xdim, :ydim, :height, :rmargin, :lmargin, :tmargin, :bmargin, :xmargin, :ymargin, :margin
|
23
23
|
|
24
|
-
|
25
24
|
def initialize(*)
|
26
25
|
super
|
27
26
|
@title, @xdim, @ydim, @height, @rmargin, @lmargin, @tmargin, @bmargin, @xmargin, @ymargin, @margin = nil
|
@@ -39,7 +38,7 @@ module Barby
|
|
39
38
|
|
40
39
|
<<-"EOT"
|
41
40
|
<?xml version="1.0" encoding="UTF-8"?>
|
42
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="#{svg_width(opts)}px" height="#{svg_height(opts)}px" viewBox="0 0 #{svg_width(opts)} #{svg_height(opts)}" version="1.1">
|
41
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="#{svg_width(opts)}px" height="#{svg_height(opts)}px" viewBox="0 0 #{svg_width(opts)} #{svg_height(opts)}" version="1.1" preserveAspectRatio="none" >
|
43
42
|
<title>#{escape title}</title>
|
44
43
|
<g id="canvas" #{transform(opts)}>
|
45
44
|
<rect x="0" y="0" width="#{full_width}px" height="#{full_height}px" fill="white" />
|
@@ -51,7 +50,6 @@ EOT
|
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
54
|
-
|
55
53
|
def bars_to_rects(opts={})
|
56
54
|
rects = ''
|
57
55
|
with_options opts do
|
@@ -85,14 +83,12 @@ EOT
|
|
85
83
|
rects
|
86
84
|
end
|
87
85
|
|
88
|
-
|
89
86
|
def bars_to_path(opts={})
|
90
87
|
with_options opts do
|
91
88
|
%Q|<path stroke="black" stroke-width="#{xdim}" d="#{bars_to_path_data(opts)}" />|
|
92
89
|
end
|
93
90
|
end
|
94
91
|
|
95
|
-
|
96
92
|
def bars_to_path_data(opts={})
|
97
93
|
path_data = ''
|
98
94
|
with_options opts do
|
@@ -124,12 +120,10 @@ EOT
|
|
124
120
|
path_data
|
125
121
|
end
|
126
122
|
|
127
|
-
|
128
123
|
def title
|
129
124
|
@title || barcode.to_s
|
130
125
|
end
|
131
126
|
|
132
|
-
|
133
127
|
def width
|
134
128
|
length * xdim
|
135
129
|
end
|
@@ -189,7 +183,6 @@ EOT
|
|
189
183
|
barcode.two_dimensional? ? encoding.first.length : encoding.length
|
190
184
|
end
|
191
185
|
|
192
|
-
|
193
186
|
def svg_width(opts={})
|
194
187
|
opts[:rot] ? full_height : full_width
|
195
188
|
end
|
@@ -198,12 +191,10 @@ EOT
|
|
198
191
|
opts[:rot] ? full_width : full_height
|
199
192
|
end
|
200
193
|
|
201
|
-
|
202
194
|
def transform(opts={})
|
203
195
|
opts[:rot] ? %Q|transform="rotate(-90) translate(-#{full_width}, 0)"| : nil
|
204
196
|
end
|
205
197
|
|
206
|
-
|
207
198
|
private
|
208
199
|
|
209
200
|
def _xmargin
|
@@ -223,8 +214,6 @@ EOT
|
|
223
214
|
str.gsub('&', '&').gsub('<', '<').gsub('>', '>')
|
224
215
|
end
|
225
216
|
|
226
|
-
|
227
217
|
end
|
228
218
|
|
229
|
-
|
230
219
|
end
|
data/lib/barby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tore Darell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Barby creates barcodes.
|
14
14
|
email: toredarell@gmail.com
|