rghost_barcode 0.8

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.
Files changed (144) hide show
  1. data/lib/doc/classes/RGhost.html +109 -0
  2. data/lib/doc/classes/RGhost/Barcode.html +147 -0
  3. data/lib/doc/classes/RGhost/Barcode/Auspost.html +113 -0
  4. data/lib/doc/classes/RGhost/Barcode/Azteccode.html +113 -0
  5. data/lib/doc/classes/RGhost/Barcode/Base.html +266 -0
  6. data/lib/doc/classes/RGhost/Barcode/Base.src/M000004.html +34 -0
  7. data/lib/doc/classes/RGhost/Barcode/Base.src/M000005.html +30 -0
  8. data/lib/doc/classes/RGhost/Barcode/Base.src/M000006.html +20 -0
  9. data/lib/doc/classes/RGhost/Barcode/Border.html +170 -0
  10. data/lib/doc/classes/RGhost/Barcode/Border.src/M000001.html +27 -0
  11. data/lib/doc/classes/RGhost/Barcode/Code11.html +113 -0
  12. data/lib/doc/classes/RGhost/Barcode/Code128.html +113 -0
  13. data/lib/doc/classes/RGhost/Barcode/Code2of5.html +113 -0
  14. data/lib/doc/classes/RGhost/Barcode/Code39.html +113 -0
  15. data/lib/doc/classes/RGhost/Barcode/Code93.html +113 -0
  16. data/lib/doc/classes/RGhost/Barcode/Datamatrix.html +113 -0
  17. data/lib/doc/classes/RGhost/Barcode/Ean13.html +113 -0
  18. data/lib/doc/classes/RGhost/Barcode/Ean2.html +113 -0
  19. data/lib/doc/classes/RGhost/Barcode/Ean5.html +113 -0
  20. data/lib/doc/classes/RGhost/Barcode/Ean8.html +113 -0
  21. data/lib/doc/classes/RGhost/Barcode/Guard.html +174 -0
  22. data/lib/doc/classes/RGhost/Barcode/Guard.src/M000003.html +27 -0
  23. data/lib/doc/classes/RGhost/Barcode/Interleaved2of5.html +113 -0
  24. data/lib/doc/classes/RGhost/Barcode/Isbn.html +113 -0
  25. data/lib/doc/classes/RGhost/Barcode/Kix.html +113 -0
  26. data/lib/doc/classes/RGhost/Barcode/Maxicode.html +113 -0
  27. data/lib/doc/classes/RGhost/Barcode/Msi.html +113 -0
  28. data/lib/doc/classes/RGhost/Barcode/Onecode.html +113 -0
  29. data/lib/doc/classes/RGhost/Barcode/Parameter.html +262 -0
  30. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000007.html +20 -0
  31. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000008.html +18 -0
  32. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000009.html +18 -0
  33. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000010.html +18 -0
  34. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000011.html +18 -0
  35. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000012.html +24 -0
  36. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000013.html +18 -0
  37. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000014.html +18 -0
  38. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000015.html +16 -0
  39. data/lib/doc/classes/RGhost/Barcode/Pdf417.html +113 -0
  40. data/lib/doc/classes/RGhost/Barcode/Pharmacode.html +113 -0
  41. data/lib/doc/classes/RGhost/Barcode/Plessey.html +113 -0
  42. data/lib/doc/classes/RGhost/Barcode/Postnet.html +113 -0
  43. data/lib/doc/classes/RGhost/Barcode/Qrcode.html +113 -0
  44. data/lib/doc/classes/RGhost/Barcode/Rationalizedcodabar.html +113 -0
  45. data/lib/doc/classes/RGhost/Barcode/Raw.html +113 -0
  46. data/lib/doc/classes/RGhost/Barcode/Royalmail.html +113 -0
  47. data/lib/doc/classes/RGhost/Barcode/Rss14.html +113 -0
  48. data/lib/doc/classes/RGhost/Barcode/Rssexpanded.html +113 -0
  49. data/lib/doc/classes/RGhost/Barcode/Rsslimited.html +113 -0
  50. data/lib/doc/classes/RGhost/Barcode/Symbol.html +113 -0
  51. data/lib/doc/classes/RGhost/Barcode/Text.html +193 -0
  52. data/lib/doc/classes/RGhost/Barcode/Text.src/M000002.html +30 -0
  53. data/lib/doc/classes/RGhost/Barcode/Upca.html +113 -0
  54. data/lib/doc/classes/RGhost/Barcode/Upce.html +113 -0
  55. data/lib/doc/classes/RGhost/Config.html +150 -0
  56. data/lib/doc/classes/RGhost/Config.src/M000016.html +45 -0
  57. data/lib/doc/classes/RGhost/Document.html +704 -0
  58. data/lib/doc/classes/RGhost/Document.src/M000017.html +19 -0
  59. data/lib/doc/classes/RGhost/Document.src/M000018.html +18 -0
  60. data/lib/doc/classes/RGhost/Document.src/M000019.html +18 -0
  61. data/lib/doc/classes/RGhost/Document.src/M000020.html +18 -0
  62. data/lib/doc/classes/RGhost/Document.src/M000021.html +18 -0
  63. data/lib/doc/classes/RGhost/Document.src/M000022.html +18 -0
  64. data/lib/doc/classes/RGhost/Document.src/M000023.html +18 -0
  65. data/lib/doc/classes/RGhost/Document.src/M000024.html +18 -0
  66. data/lib/doc/classes/RGhost/Document.src/M000025.html +18 -0
  67. data/lib/doc/classes/RGhost/Document.src/M000026.html +18 -0
  68. data/lib/doc/classes/RGhost/Document.src/M000027.html +18 -0
  69. data/lib/doc/classes/RGhost/Document.src/M000028.html +18 -0
  70. data/lib/doc/classes/RGhost/Document.src/M000029.html +18 -0
  71. data/lib/doc/classes/RGhost/Document.src/M000030.html +18 -0
  72. data/lib/doc/classes/RGhost/Document.src/M000031.html +18 -0
  73. data/lib/doc/classes/RGhost/Document.src/M000032.html +18 -0
  74. data/lib/doc/classes/RGhost/Document.src/M000033.html +18 -0
  75. data/lib/doc/classes/RGhost/Document.src/M000034.html +18 -0
  76. data/lib/doc/classes/RGhost/Document.src/M000035.html +18 -0
  77. data/lib/doc/classes/RGhost/Document.src/M000036.html +18 -0
  78. data/lib/doc/classes/RGhost/Document.src/M000037.html +18 -0
  79. data/lib/doc/classes/RGhost/Document.src/M000038.html +18 -0
  80. data/lib/doc/classes/RGhost/Document.src/M000039.html +18 -0
  81. data/lib/doc/classes/RGhost/Document.src/M000040.html +18 -0
  82. data/lib/doc/classes/RGhost/Document.src/M000041.html +18 -0
  83. data/lib/doc/classes/RGhost/Document.src/M000042.html +18 -0
  84. data/lib/doc/classes/RGhost/Document.src/M000043.html +18 -0
  85. data/lib/doc/classes/RGhost/Document.src/M000044.html +18 -0
  86. data/lib/doc/classes/RGhost/Document.src/M000045.html +18 -0
  87. data/lib/doc/classes/RGhost/Document.src/M000046.html +18 -0
  88. data/lib/doc/classes/RGhost/Document.src/M000047.html +18 -0
  89. data/lib/doc/classes/RGhost/Document.src/M000048.html +18 -0
  90. data/lib/doc/created.rid +1 -0
  91. data/lib/doc/files/rghost_barcode/rghost_barcode_adapter_rb.html +101 -0
  92. data/lib/doc/files/rghost_barcode/rghost_barcode_base_rb.html +101 -0
  93. data/lib/doc/files/rghost_barcode/rghost_barcode_classes_rb.html +101 -0
  94. data/lib/doc/files/rghost_barcode/rghost_barcode_examples_rb.html +101 -0
  95. data/lib/doc/files/rghost_barcode/rghost_barcode_version_rb.html +101 -0
  96. data/lib/doc/files/rghost_barcode_rb.html +111 -0
  97. data/lib/doc/files/teste_main_rb.html +110 -0
  98. data/lib/doc/fr_class_index.html +67 -0
  99. data/lib/doc/fr_file_index.html +33 -0
  100. data/lib/doc/fr_method_index.html +74 -0
  101. data/lib/doc/index.html +24 -0
  102. data/lib/rghost_barcode.rb +7 -0
  103. data/lib/rghost_barcode/ps/auspost.ps +192 -0
  104. data/lib/rghost_barcode/ps/azteccode.ps +357 -0
  105. data/lib/rghost_barcode/ps/barcode_template.eps +1193 -0
  106. data/lib/rghost_barcode/ps/code11.ps +128 -0
  107. data/lib/rghost_barcode/ps/code128.ps +121 -0
  108. data/lib/rghost_barcode/ps/code2of5.ps +106 -0
  109. data/lib/rghost_barcode/ps/code39.ps +109 -0
  110. data/lib/rghost_barcode/ps/code93.ps +117 -0
  111. data/lib/rghost_barcode/ps/datamatrix.ps +328 -0
  112. data/lib/rghost_barcode/ps/ean13.ps +183 -0
  113. data/lib/rghost_barcode/ps/ean2.ps +101 -0
  114. data/lib/rghost_barcode/ps/ean5.ps +116 -0
  115. data/lib/rghost_barcode/ps/ean8.ps +101 -0
  116. data/lib/rghost_barcode/ps/interleaved2of5.ps +132 -0
  117. data/lib/rghost_barcode/ps/isbn.ps +118 -0
  118. data/lib/rghost_barcode/ps/kix.ps +98 -0
  119. data/lib/rghost_barcode/ps/maxicode.ps +307 -0
  120. data/lib/rghost_barcode/ps/msi.ps +104 -0
  121. data/lib/rghost_barcode/ps/onecode.ps +276 -0
  122. data/lib/rghost_barcode/ps/pdf417.ps +428 -0
  123. data/lib/rghost_barcode/ps/pharmacode.ps +69 -0
  124. data/lib/rghost_barcode/ps/plessey.ps +121 -0
  125. data/lib/rghost_barcode/ps/postnet.ps +114 -0
  126. data/lib/rghost_barcode/ps/qrcode.ps +530 -0
  127. data/lib/rghost_barcode/ps/rationalizedcodabar.ps +117 -0
  128. data/lib/rghost_barcode/ps/raw.ps +35 -0
  129. data/lib/rghost_barcode/ps/render.ps +307 -0
  130. data/lib/rghost_barcode/ps/render.ps~ +308 -0
  131. data/lib/rghost_barcode/ps/royalmail.ps +119 -0
  132. data/lib/rghost_barcode/ps/rss14.ps +237 -0
  133. data/lib/rghost_barcode/ps/rssexpanded.ps +211 -0
  134. data/lib/rghost_barcode/ps/rsslimited.ps +191 -0
  135. data/lib/rghost_barcode/ps/symbol.ps +49 -0
  136. data/lib/rghost_barcode/ps/upca.ps +128 -0
  137. data/lib/rghost_barcode/ps/upce.ps +157 -0
  138. data/lib/rghost_barcode/rghost_barcode_adapter.rb +249 -0
  139. data/lib/rghost_barcode/rghost_barcode_base.rb +210 -0
  140. data/lib/rghost_barcode/rghost_barcode_classes.rb +96 -0
  141. data/lib/rghost_barcode/rghost_barcode_examples.rb +35 -0
  142. data/lib/rghost_barcode/rghost_barcode_version.rb +8 -0
  143. data/lib/teste_main.rb +94 -0
  144. metadata +218 -0
@@ -0,0 +1,128 @@
1
+
2
+ % --DESC: Code 11
3
+ % --EXAM: 0123456789
4
+ % --EXOP: includetext includecheck includecheckintext
5
+ % --RNDR: renlinear
6
+ /code11 {
7
+
8
+ 0 begin % Confine variables to local scope
9
+
10
+ /options exch def % We are given an option string
11
+ /useropts options def
12
+ /barcode exch def % We are given a barcode string
13
+
14
+ /includecheck false def
15
+ /includetext false def
16
+ /includecheckintext false def
17
+ /textfont /Courier def
18
+ /textsize 10 def
19
+ /textyoffset -7 def
20
+ /height 1 def
21
+
22
+ % Parse the input options
23
+ options {
24
+ token false eq {exit} if dup length string cvs (=) search
25
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
26
+ } loop
27
+
28
+ /textfont textfont cvlit def
29
+ /textsize textsize cvr def
30
+ /textyoffset textyoffset cvr def
31
+ /height height cvr def
32
+
33
+ % Create an array containing the character mappings
34
+ /encs
35
+ [ (111131) (311131) (131131) (331111) (113131)
36
+ (313111) (133111) (111331) (311311) (311111)
37
+ (113111) (113311)
38
+ ] def
39
+
40
+ % Create a string of the available characters
41
+ /barchars (0123456789-) def
42
+
43
+ /barlen barcode length def % Length of the code
44
+
45
+ includecheck {
46
+ barlen 10 ge {
47
+ /sbs barlen 6 mul 24 add string def
48
+ /txt barlen 2 add array def
49
+ } {
50
+ /sbs barlen 6 mul 18 add string def
51
+ /txt barlen 1 add array def
52
+ } ifelse
53
+ } {
54
+ /sbs barlen 6 mul 12 add string def
55
+ /txt barlen array def
56
+ } ifelse
57
+
58
+ % Put the start character
59
+ sbs 0 encs 10 get putinterval
60
+
61
+ /checksum1 0 def /checksum2 0 def
62
+
63
+ /xpos 8 def
64
+ 0 1 barlen 1 sub {
65
+ /i exch def
66
+ % Lookup the encoding for the each barcode character
67
+ barcode i 1 getinterval barchars exch search
68
+ pop % Discard true leaving pre
69
+ length /indx exch def % indx is the length of pre
70
+ pop pop % Discard seek and post
71
+ /enc encs indx get def % Get the indxth encoding
72
+ sbs i 6 mul 6 add enc putinterval % Put encoded digit into sbs
73
+ txt i [barcode i 1 getinterval xpos textyoffset textfont textsize] put
74
+ 0 1 5 { % xpos+=width of the character
75
+ /xpos exch enc exch get 48 sub xpos add def
76
+ } for
77
+ /checksum1 checksum1 barlen i sub 1 sub 10 mod 1 add indx mul add def
78
+ /checksum2 checksum2 barlen i sub 9 mod 1 add indx mul add def
79
+ } for
80
+
81
+ % Put the checksum and end characters
82
+ includecheck {
83
+ /checksum1 checksum1 11 mod def
84
+ barlen 10 ge {
85
+ /checksum2 checksum2 checksum1 add 11 mod def
86
+ sbs barlen 6 mul 6 add encs checksum1 get putinterval
87
+ sbs barlen 6 mul 12 add encs checksum2 get putinterval
88
+ includecheckintext {
89
+ txt barlen [barchars checksum1 1 getinterval xpos textyoffset textfont textsize] put
90
+ /enc encs checksum1 get def
91
+ 0 1 5 { % xpos+=width of the character
92
+ /xpos exch enc exch get 48 sub xpos add def
93
+ } for
94
+ txt barlen 1 add [barchars checksum2 1 getinterval xpos textyoffset textfont textsize] put
95
+ } {
96
+ txt barlen [() xpos textyoffset textfont textsize] put
97
+ txt barlen 1 add [() xpos textyoffset textfont textsize] put
98
+ } ifelse
99
+ sbs barlen 6 mul 18 add encs 11 get putinterval
100
+ } {
101
+ sbs barlen 6 mul 6 add encs checksum1 get putinterval
102
+ includecheckintext {
103
+ txt barlen [barchars checksum1 1 getinterval xpos textyoffset textfont textsize] put
104
+ } {
105
+ txt barlen [() xpos textyoffset textfont textsize] put
106
+ } ifelse
107
+ sbs barlen 6 mul 12 add encs 11 get putinterval
108
+ } ifelse
109
+ } {
110
+ sbs barlen 6 mul 6 add encs 11 get putinterval
111
+ } ifelse
112
+
113
+ % Return the arguments
114
+ /retval 8 dict def
115
+ retval (ren) (renlinear) put
116
+ retval (sbs) [sbs {48 sub} forall] put
117
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
118
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
119
+ includetext {
120
+ retval (txt) txt put
121
+ } if
122
+ retval (opt) useropts put
123
+ retval
124
+
125
+ end
126
+
127
+ } bind def
128
+ /code11 load 0 1 dict put
@@ -0,0 +1,121 @@
1
+
2
+ % --DESC: Code 128
3
+ % --EXAM: ^104^102Count^0990123456789^101!
4
+ % --EXOP: includetext
5
+ % --RNDR: renlinear
6
+ /code128 {
7
+
8
+ 0 begin % Confine variables to local scope
9
+
10
+ /options exch def % We are given an option string
11
+ /useropts options def
12
+ /barcode exch def % We are given a barcode string
13
+
14
+ /includetext false def % Enable/disable text
15
+ /textfont /Courier def
16
+ /textsize 10 def
17
+ /textyoffset -7 def
18
+ /height 1 def
19
+
20
+ % Parse the input options
21
+ options {
22
+ token false eq {exit} if dup length string cvs (=) search
23
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
24
+ } loop
25
+
26
+ /textfont textfont cvlit def
27
+ /textsize textsize cvr def
28
+ /textyoffset textyoffset cvr def
29
+ /height height cvr def
30
+
31
+ % Create an array containing the character mappings
32
+ /encs
33
+ [ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
34
+ (122312) (132212) (221213) (221312) (231212) (112232) (122132)
35
+ (122231) (113222) (123122) (123221) (223211) (221132) (221231)
36
+ (213212) (223112) (312131) (311222) (321122) (321221) (312212)
37
+ (322112) (322211) (212123) (212321) (232121) (111323) (131123)
38
+ (131321) (112313) (132113) (132311) (211313) (231113) (231311)
39
+ (112133) (112331) (132131) (113123) (113321) (133121) (313121)
40
+ (211331) (231131) (213113) (213311) (213131) (311123) (311321)
41
+ (331121) (312113) (312311) (332111) (314111) (221411) (431111)
42
+ (111224) (111422) (121124) (121421) (141122) (141221) (112214)
43
+ (112412) (122114) (122411) (142112) (142211) (241211) (221114)
44
+ (413111) (241112) (134111) (111242) (121142) (121241) (114212)
45
+ (124112) (124211) (411212) (421112) (421211) (212141) (214121)
46
+ (412121) (111143) (111341) (131141) (114113) (114311) (411113)
47
+ (411311) (113141) (114131) (311141) (411131) (211412) (211214)
48
+ (211232) (2331112)
49
+ ] def
50
+
51
+ % Create a string of the available characters for alphabets A and B
52
+ /barchars ( !"#$%&'\(\)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~) def
53
+ /barlen barcode length def % Length of the code
54
+ /sbs barlen 6 mul string def % sbs is 6 times length of barcode
55
+ /txt barlen array def
56
+
57
+ /mode -1 def % A=0, B=1, C=2
58
+ /checksum barcode 1 3 getinterval cvi def % Initialise the checksum
59
+
60
+ /i 0 def /j 0 def
61
+ { % loop
62
+ i barlen eq {exit} if
63
+ barcode i 1 getinterval (^) eq {
64
+ % indx is given by the next three characters
65
+ /indx barcode i 1 add 3 getinterval cvi def
66
+ txt j [( ) j 11 mul textyoffset textfont textsize] put
67
+ /i i 4 add def
68
+ } {
69
+ % indx depends on the mode
70
+ mode 2 eq {
71
+ /indx barcode i 2 getinterval cvi def
72
+ txt j [barcode i 2 getinterval j 11 mul textyoffset textfont textsize] put
73
+ /i i 2 add def
74
+ } {
75
+ barchars barcode i 1 getinterval search
76
+ pop % Discard true leaving pre
77
+ length /indx exch def % indx is the length of pre
78
+ pop pop % Discard seek and post
79
+ txt j [barchars indx 1 getinterval j 11 mul textyoffset textfont textsize] put
80
+ /i i 1 add def
81
+ } ifelse
82
+ } ifelse
83
+ /enc encs indx get def % Get the indxth encoding
84
+ sbs j 6 mul enc putinterval % Put encoded digit into sbs
85
+
86
+ % Update the mode
87
+ indx 101 eq indx 103 eq or {/mode 0 def} if
88
+ indx 100 eq indx 104 eq or {/mode 1 def} if
89
+ indx 99 eq indx 105 eq or {/mode 2 def} if
90
+
91
+ /checksum indx j mul checksum add def % checksum+=indx*j
92
+ /j j 1 add def
93
+ } loop
94
+
95
+ % Put the checksum character
96
+ /checksum checksum 103 mod def
97
+ sbs j 6 mul encs checksum get putinterval
98
+
99
+ % Put the end character
100
+ sbs j 6 mul 6 add encs 106 get putinterval
101
+
102
+ % Shrink sbs and txt to fit exactly
103
+ /sbs sbs 0 j 6 mul 13 add getinterval def
104
+ /txt txt 0 j getinterval def
105
+
106
+ % Return the arguments
107
+ /retval 8 dict def
108
+ retval (ren) (renlinear) put
109
+ retval (sbs) [sbs {48 sub} forall] put
110
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
111
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
112
+ includetext {
113
+ retval (txt) txt put
114
+ } if
115
+ retval (opt) useropts put
116
+ retval
117
+
118
+ end
119
+
120
+ } bind def
121
+ /code128 load 0 1 dict put
@@ -0,0 +1,106 @@
1
+
2
+ % --DESC: Code 25
3
+ % --EXAM: 01234567
4
+ % --EXOP: includetext includecheck includecheckintext
5
+ % --RNDR: renlinear
6
+ /code2of5 {
7
+
8
+ % Thanks to Michael Landers
9
+
10
+ 0 begin % Confine variable to local scope
11
+
12
+ /options exch def % We are given an option string
13
+ /useropts options def
14
+ /barcode exch def % We are given a barcode string
15
+
16
+ /includecheck false def
17
+ /includetext false def % Enable/disable text
18
+ /includecheckintext false def
19
+ /textfont /Courier def
20
+ /textsize 10 def
21
+ /textyoffset -7 def
22
+ /height 1 def
23
+
24
+ % Parse the input options
25
+ options {
26
+ token false eq {exit} if dup length string cvs (=) search
27
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
28
+ } loop
29
+
30
+ /textfont textfont cvlit def
31
+ /textsize textsize cvr def
32
+ /textyoffset textyoffset cvr def
33
+ /height height cvr def
34
+
35
+ % Create an array containing the character mappings
36
+ /encs
37
+ [ (1111313111) (3111111131) (1131111131) (3131111111)
38
+ (1111311131) (3111311111) (1131311111) (1111113131)
39
+ (3111113111) (1131113111) (313111) (311131)
40
+ ] def
41
+
42
+ % Create a string of the available characters
43
+ /barchars (0123456789) def
44
+
45
+ /barlen barcode length def % Length of the code
46
+
47
+ includecheck {
48
+ /sbs barlen 10 mul 22 add string def
49
+ /txt barlen 1 add array def
50
+ } {
51
+ /sbs barlen 10 mul 12 add string def
52
+ /txt barlen array def
53
+ } ifelse
54
+
55
+ % Put the start character
56
+ sbs 0 encs 10 get putinterval
57
+
58
+ /checksum 0 def
59
+
60
+ 0 1 barlen 1 sub {
61
+ /i exch def
62
+ % Lookup the encoding for the each barcode character
63
+ barcode i 1 getinterval barchars exch search
64
+ pop % Discard true leaving pre
65
+ length /indx exch def % indx is the length of pre
66
+ pop pop % Discard seek and post
67
+ /enc encs indx get def % Get the indxth encoding
68
+ sbs i 10 mul 6 add enc putinterval % Put encoded digit into sbs
69
+ txt i [barcode i 1 getinterval i 14 mul 10 add textyoffset textfont textsize] put
70
+ barlen i sub 2 mod 0 eq {
71
+ /checksum checksum indx add def
72
+ } {
73
+ /checksum checksum indx 3 mul add def
74
+ } ifelse
75
+ } for
76
+
77
+ % Put the checksum and end characters
78
+ includecheck {
79
+ /checksum 10 checksum 10 mod sub 10 mod def
80
+ sbs barlen 10 mul 6 add encs checksum get putinterval
81
+ sbs barlen 10 mul 16 add encs 11 get putinterval
82
+ includecheckintext {
83
+ txt barlen [barchars checksum 1 getinterval barlen 14 mul 10 add textyoffset textfont textsize] put
84
+ } {
85
+ txt barlen [( ) barlen 14 mul 10 add textyoffset textfont textsize] put
86
+ } ifelse
87
+ } {
88
+ sbs barlen 10 mul 6 add encs 11 get putinterval
89
+ } ifelse
90
+
91
+ % Return the arguments
92
+ /retval 8 dict def
93
+ retval (ren) (renlinear) put
94
+ retval (sbs) [sbs {48 sub} forall] put
95
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
96
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
97
+ includetext {
98
+ retval (txt) txt put
99
+ } if
100
+ retval (opt) useropts put
101
+ retval
102
+
103
+ end
104
+
105
+ } bind def
106
+ /code2of5 load 0 1 dict put
@@ -0,0 +1,109 @@
1
+
2
+ % --DESC: Code 39
3
+ % --EXAM: THIS IS CODE 39
4
+ % --EXOP: includetext includecheck includecheckintext
5
+ % --RNDR: renlinear
6
+ /code39 {
7
+
8
+ 0 begin % Confine variables to local scope
9
+
10
+ /options exch def % We are given an option string
11
+ /useropts options def
12
+ /barcode exch def % We are given a barcode string
13
+
14
+ /includecheck false def % Enable/disable checkdigit
15
+ /includetext false def
16
+ /includecheckintext false def
17
+ /textfont /Courier def
18
+ /textsize 10 def
19
+ /textyoffset -7 def
20
+ /height 1 def
21
+
22
+ % Parse the input options
23
+ options {
24
+ token false eq {exit} if dup length string cvs (=) search
25
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
26
+ } loop
27
+
28
+ /textfont textfont cvlit def
29
+ /textsize textsize cvr def
30
+ /textyoffset textyoffset cvr def
31
+ /height height cvr def
32
+
33
+ % Create an array containing the character mappings
34
+ /encs
35
+ [ (1113313111) (3113111131) (1133111131) (3133111111) (1113311131)
36
+ (3113311111) (1133311111) (1113113131) (3113113111) (1133113111)
37
+ (3111131131) (1131131131) (3131131111) (1111331131) (3111331111)
38
+ (1131331111) (1111133131) (3111133111) (1131133111) (1111333111)
39
+ (3111111331) (1131111331) (3131111311) (1111311331) (3111311311)
40
+ (1131311311) (1111113331) (3111113311) (1131113311) (1111313311)
41
+ (3311111131) (1331111131) (3331111111) (1311311131) (3311311111)
42
+ (1331311111) (1311113131) (3311113111) (1331113111) (1313131111)
43
+ (1313111311) (1311131311) (1113131311) (1311313111)
44
+ ] def
45
+
46
+ % Create a string of the available characters
47
+ /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*) def
48
+
49
+ /barlen barcode length def % Length of the code
50
+
51
+ includecheck {
52
+ /sbs barlen 10 mul 30 add string def
53
+ /txt barlen 3 add array def
54
+ } {
55
+ /sbs barlen 10 mul 20 add string def
56
+ /txt barlen 2 add array def
57
+ } ifelse
58
+
59
+ /checksum 0 def
60
+
61
+ % Put the start character
62
+ sbs 0 encs 43 get putinterval
63
+ txt 0 [(*) 0 textyoffset textfont textsize] put
64
+
65
+ 0 1 barlen 1 sub {
66
+ /i exch def
67
+ % Lookup the encoding for the each barcode character
68
+ barcode i 1 getinterval barchars exch search
69
+ pop % Discard true leaving pre
70
+ length /indx exch def % indx is the length of pre
71
+ pop pop % Discard seek and post
72
+ /enc encs indx get def % Get the indxth encoding
73
+ sbs i 10 mul 10 add enc putinterval % Put encoded digit into sbs
74
+ txt i 1 add [barcode i 1 getinterval i 1 add 16 mul textyoffset textfont textsize] put
75
+ /checksum checksum indx add def
76
+ } for
77
+
78
+ % Put the checksum and end characters
79
+ includecheck {
80
+ /checksum checksum 43 mod def
81
+ sbs barlen 10 mul 10 add encs checksum get putinterval
82
+ includecheckintext {
83
+ txt barlen 1 add [barchars checksum 1 getinterval barlen 1 add 16 mul textyoffset textfont textsize] put
84
+ } {
85
+ txt barlen 1 add [() barlen 1 add 16 mul textyoffset textfont textsize] put
86
+ } ifelse
87
+ sbs barlen 10 mul 20 add encs 43 get putinterval
88
+ txt barlen 2 add [(*) barlen 2 add 16 mul textyoffset textfont textsize] put
89
+ } {
90
+ sbs barlen 10 mul 10 add encs 43 get putinterval
91
+ txt barlen 1 add [(*) barlen 1 add 16 mul textyoffset textfont textsize] put
92
+ } ifelse
93
+
94
+ % Return the arguments
95
+ /retval 8 dict def
96
+ retval (ren) (renlinear) put
97
+ retval (sbs) [sbs {48 sub} forall] put
98
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
99
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
100
+ includetext {
101
+ retval (txt) txt put
102
+ } if
103
+ retval (opt) useropts put
104
+ retval
105
+
106
+ end
107
+
108
+ } bind def
109
+ /code39 load 0 1 dict put