gbarcode-linux 0.98.20
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/barcode_wrap.c +3377 -0
- data/ext/extconf.rb +11 -0
- data/test/assets/gb-code128b.eps +44 -0
- data/test/gbarcode_test.rb +47 -0
- data/test/test_helper.rb +3 -0
- metadata +77 -0
data/ext/extconf.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Angel Pizarro on 2007-03-15.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
require 'mkmf'
|
6
|
+
dir_config("barcode")
|
7
|
+
if have_library("barcode")
|
8
|
+
create_makefile('gbarcode')
|
9
|
+
else
|
10
|
+
raise Exception.new("GNU Barcode is no longer bundled with the gbarcode gem. Please install GNU barcode before installing this gem")
|
11
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
%!PS-Adobe-2.0 EPSF-1.2
|
2
|
+
%%Creator: libbarcode
|
3
|
+
%%BoundingBox: 0 0 143 100
|
4
|
+
%%EndComments
|
5
|
+
% Printing barcode for "Gbarcode", scaled 1.00, encoded using "code 128-B"
|
6
|
+
% The space/bar succession is represented by the following widths (space first):
|
7
|
+
% 02112142113131214211211241212411411221341111412211122143141112331112
|
8
|
+
[
|
9
|
+
% height xpos ypos width height xpos ypos width
|
10
|
+
[75.00 11.00 15.00 1.85] [75.00 13.50 15.00 0.85]
|
11
|
+
[75.00 16.50 15.00 0.85] [70.00 22.00 20.00 1.85]
|
12
|
+
[70.00 24.50 20.00 0.85] [70.00 28.50 20.00 0.85]
|
13
|
+
[70.00 32.50 20.00 0.85] [70.00 35.50 20.00 0.85]
|
14
|
+
[70.00 41.00 20.00 1.85] [70.00 43.50 20.00 0.85]
|
15
|
+
[70.00 46.50 20.00 0.85] [70.00 49.00 20.00 1.85]
|
16
|
+
[70.00 54.50 20.00 0.85] [70.00 57.50 20.00 0.85]
|
17
|
+
[70.00 62.00 20.00 3.85] [70.00 65.50 20.00 0.85]
|
18
|
+
[70.00 70.50 20.00 0.85] [70.00 73.00 20.00 1.85]
|
19
|
+
[70.00 76.50 20.00 0.85] [70.00 82.00 20.00 3.85]
|
20
|
+
[70.00 85.50 20.00 0.85] [70.00 87.50 20.00 0.85]
|
21
|
+
[70.00 92.50 20.00 0.85] [70.00 96.00 20.00 1.85]
|
22
|
+
[70.00 98.50 20.00 0.85] [70.00 101.00 20.00 1.85]
|
23
|
+
[70.00 104.50 20.00 0.85] [70.00 110.50 20.00 2.85]
|
24
|
+
[70.00 115.00 20.00 3.85] [70.00 118.50 20.00 0.85]
|
25
|
+
[75.00 121.00 15.00 1.85] [75.00 126.50 15.00 2.85]
|
26
|
+
[75.00 129.50 15.00 0.85] [75.00 132.00 15.00 1.85]
|
27
|
+
|
28
|
+
] { {} forall setlinewidth moveto 0 exch rlineto stroke} bind forall
|
29
|
+
[
|
30
|
+
% char xpos ypos fontsize
|
31
|
+
[(G) 21.00 10.00 12.00]
|
32
|
+
[(b) 32.00 10.00 0.00]
|
33
|
+
[(a) 43.00 10.00 0.00]
|
34
|
+
[(r) 54.00 10.00 0.00]
|
35
|
+
[(c) 65.00 10.00 0.00]
|
36
|
+
[(o) 76.00 10.00 0.00]
|
37
|
+
[(d) 87.00 10.00 0.00]
|
38
|
+
[(e) 98.00 10.00 0.00]
|
39
|
+
] { {} forall dup 0.00 ne {
|
40
|
+
/Helvetica findfont exch scalefont setfont
|
41
|
+
} {pop} ifelse
|
42
|
+
moveto show} bind forall
|
43
|
+
% End barcode for "Gbarcode"
|
44
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class GbarcodeTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@bc_text = "Gbarcode"
|
6
|
+
@bc = Gbarcode.barcode_create(@bc_text)
|
7
|
+
Gbarcode.barcode_encode(@bc, Gbarcode::BARCODE_128B)
|
8
|
+
end
|
9
|
+
|
10
|
+
# def teardown
|
11
|
+
# Gbarcode.barcode_delete(@bc)
|
12
|
+
# end
|
13
|
+
|
14
|
+
def test_barcode_create
|
15
|
+
assert(@bc != nil, "@bc not created")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_barcode_delete
|
19
|
+
r = Gbarcode.barcode_delete(Gbarcode.barcode_create(@bc_text))
|
20
|
+
assert(r == 0, "barcode_delete failed")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_ascii
|
24
|
+
assert_equal(@bc.ascii, "Gbarcode")
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_barcode_encode
|
28
|
+
b = Gbarcode.barcode_create("1234")
|
29
|
+
r = Gbarcode.barcode_encode(b, Gbarcode::BARCODE_39)
|
30
|
+
assert(r == 0, "encoding unsuccessful")
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_encoding
|
34
|
+
assert_equal(@bc.encoding, "code 128-B")
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_barcode_print
|
38
|
+
r,w = File.pipe
|
39
|
+
Gbarcode.barcode_print(@bc,w,Gbarcode::BARCODE_OUT_EPS)
|
40
|
+
w.close()
|
41
|
+
b = r.read
|
42
|
+
r.close()
|
43
|
+
f = File.open(File.dirname(__FILE__) + "/assets/gb-code128b.eps").read
|
44
|
+
assert_equal(b,f)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gbarcode-linux
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 447
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 98
|
9
|
+
- 20
|
10
|
+
version: 0.98.20
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Angel Pizarro
|
14
|
+
autorequire: gbarcode
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-15 00:00:00 +08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: GNU barcode wrapper
|
23
|
+
email:
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions:
|
27
|
+
- ext/extconf.rb
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- ext/barcode_wrap.c
|
32
|
+
- ext/extconf.rb
|
33
|
+
- test/assets/gb-code128b.eps
|
34
|
+
- test/gbarcode_test.rb
|
35
|
+
- test/test_helper.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage:
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --exclude
|
43
|
+
- .c$
|
44
|
+
require_paths:
|
45
|
+
- .
|
46
|
+
- ext
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
hash: 59
|
53
|
+
segments:
|
54
|
+
- 1
|
55
|
+
- 8
|
56
|
+
- 6
|
57
|
+
version: 1.8.6
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project: gbarcode
|
70
|
+
rubygems_version: 1.3.9.5
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: GNU barcode wrapper
|
74
|
+
test_files:
|
75
|
+
- test/assets/gb-code128b.eps
|
76
|
+
- test/gbarcode_test.rb
|
77
|
+
- test/test_helper.rb
|