rghost_barcode 0.8

Sign up to get free protection for your applications and to get access to all the features.
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,308 @@
1
+
2
+ % --BEGIN RENDERER renlinear--
3
+ /renlinear {
4
+
5
+ 0 begin % Confine variables to local scope
6
+
7
+ /args exch def % We are given some arguments
8
+
9
+ % Default options
10
+ /sbs [] def
11
+ /bhs [] def
12
+ /bbs [] def
13
+ /txt [] def
14
+ /barcolor (unset) def
15
+ /includetext false def
16
+ /textcolor (unset) def
17
+ /textxalign (unset) def
18
+ /textyalign (unset) def
19
+ /textfont (Courier) def
20
+ /textsize 10 def
21
+ /textxoffset 0 def
22
+ /textyoffset 0 def
23
+ /bordercolor (unset) def
24
+ /backgroundcolor (unset) def
25
+ /inkspread 0.15 def
26
+ /width 0 def
27
+ /barratio 1 def
28
+ /spaceratio 1 def
29
+ /showborder false def
30
+ /borderleft 10 def
31
+ /borderright 10 def
32
+ /bordertop 1 def
33
+ /borderbottom 1 def
34
+ /borderwidth 0.5 def
35
+ /guardwhitespace false def
36
+ /guardleftpos 0 def
37
+ /guardleftypos 0 def
38
+ /guardrightpos 0 def
39
+ /guardrightypos 0 def
40
+ /guardwidth 6 def
41
+ /guardheight 7 def
42
+
43
+ % Apply the renderer options
44
+ args {exch cvlit exch def} forall
45
+
46
+ % Parse the user options
47
+ opt {
48
+ token false eq {exit} if dup length string cvs (=) search
49
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
50
+ } loop
51
+
52
+ /barcolor barcolor cvlit def
53
+ /textcolor textcolor cvlit def
54
+ /textxalign textxalign cvlit def
55
+ /textyalign textyalign cvlit def
56
+ /textfont textfont cvlit def
57
+ /textsize textsize cvr def
58
+ /textxoffset textxoffset cvr def
59
+ /textyoffset textyoffset cvr def
60
+ /bordercolor bordercolor cvlit def
61
+ /backgroundcolor backgroundcolor cvlit def
62
+ /inkspread inkspread cvr def
63
+ /width width cvr def
64
+ /barratio barratio cvr def
65
+ /spaceratio spaceratio cvr def
66
+ /borderleft borderleft cvr def
67
+ /borderright borderright cvr def
68
+ /bordertop bordertop cvr def
69
+ /borderbottom borderbottom cvr def
70
+ /borderwidth borderwidth cvr def
71
+ /guardleftpos guardleftpos cvr def
72
+ /guardleftypos guardleftypos cvr def
73
+ /guardrightpos guardrightpos cvr def
74
+ /guardrightypos guardrightypos cvr def
75
+ /guardwidth guardwidth cvr def
76
+ /guardheight guardheight cvr def
77
+
78
+ % Create bar elements and put them into the bars array
79
+ /bars sbs length 1 add 2 idiv array def
80
+ /x 0.00 def /maxh 0 def
81
+ 0 1 sbs length 1 add 2 idiv 2 mul 2 sub {
82
+ /i exch def
83
+ i 2 mod 0 eq { % i is even
84
+ /d sbs i get barratio mul barratio sub 1 add def % d=digit*r-r+1
85
+ /h bhs i 2 idiv get 72 mul def % Height from bhs
86
+ /c d 2 div x add def % Centre of the bar = x + d/2
87
+ /y bbs i 2 idiv get 72 mul def % Baseline from bbs
88
+ /w d inkspread sub def % bar width = digit - inkspread
89
+ bars i 2 idiv [h c y w] put % Add the bar entry
90
+ h maxh gt {/maxh h def} if
91
+ } {
92
+ /d sbs i get spaceratio mul spaceratio sub 1 add def % d=digit*r-r+1
93
+ } ifelse
94
+ /x x d add def % x+=d
95
+ } for
96
+
97
+ gsave
98
+
99
+ currentpoint translate
100
+
101
+ % Force symbol to given width
102
+ width 0 ne {
103
+ width 72 mul x div 1 scale
104
+ } if
105
+
106
+ % Set RGB or CMYK color depending on length of given hex string
107
+ /setanycolor {
108
+ /anycolor exch def
109
+ anycolor length 6 eq {
110
+ (< >) 8 string copy dup 1 anycolor putinterval cvx exec {255 div} forall setrgbcolor
111
+ } if
112
+ anycolor length 8 eq {
113
+ (< >) 10 string copy dup 1 anycolor putinterval cvx exec {255 div} forall setcmykcolor
114
+ } if
115
+ } bind def
116
+
117
+ % Display the border and background
118
+ newpath
119
+ borderleft neg borderbottom neg moveto
120
+ x borderleft add borderright add 0 rlineto
121
+ 0 maxh borderbottom add bordertop add rlineto
122
+ x borderleft add borderright add neg 0 rlineto
123
+ 0 maxh borderbottom add bordertop add neg rlineto
124
+ closepath
125
+ backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
126
+ showborder {
127
+ gsave
128
+ bordercolor (unset) ne { bordercolor setanycolor } if
129
+ borderwidth setlinewidth stroke
130
+ grestore
131
+ } if
132
+
133
+ % Display the bars for elements in the bars array
134
+ gsave
135
+ barcolor (unset) ne { barcolor setanycolor } if
136
+ bars {
137
+ {} forall
138
+ newpath setlinewidth moveto 0 exch rlineto stroke
139
+ } forall
140
+ grestore
141
+
142
+ % Display the text for elements in the text array
143
+ textcolor (unset) ne { textcolor setanycolor } if
144
+ includetext {
145
+ textxalign (unset) eq textyalign (unset) eq and {
146
+ /s 0 def /f () def
147
+ txt {
148
+ {} forall
149
+ 2 copy s ne exch f ne or {
150
+ 2 copy /s exch def /f exch def
151
+ exch findfont exch scalefont setfont
152
+ } {
153
+ pop pop
154
+ } ifelse
155
+ moveto show
156
+ } forall
157
+ } {
158
+ textfont findfont textsize scalefont setfont
159
+ /txt [ txt { 0 get {} forall } forall ] def
160
+ /tstr txt length string def
161
+ 0 1 txt length 1 sub { dup txt exch get tstr 3 1 roll put } for
162
+ /textxpos textxoffset x tstr stringwidth pop sub 2 div add def
163
+ textxalign (left) eq { /textxpos textxoffset def } if
164
+ textxalign (right) eq { /textxpos x textxoffset sub tstr stringwidth pop sub def } if
165
+ textxalign (offleft) eq { /textxpos tstr stringwidth pop textxoffset add neg def } if
166
+ textxalign (offright) eq { /textxpos x textxoffset add def } if
167
+ /textypos textyoffset textsize add 3 sub neg def
168
+ textyalign (above) eq { /textypos textyoffset maxh add 1 add def } if
169
+ textyalign (center) eq { /textypos textyoffset maxh textsize 4 sub sub 2 div add def } if
170
+ textxpos textypos moveto tstr show
171
+ } ifelse
172
+ } if
173
+
174
+ % Display the guard elements
175
+ guardwhitespace {
176
+ 0.75 setlinewidth
177
+ guardleftpos 0 ne {
178
+ newpath
179
+ guardleftpos neg guardwidth add guardleftypos guardwidth 2 div add moveto
180
+ guardwidth neg guardheight -2 div rlineto
181
+ guardwidth guardheight -2 div rlineto
182
+ stroke
183
+ } if
184
+ guardrightpos 0 ne {
185
+ newpath
186
+ guardrightpos x add guardwidth sub guardrightypos guardheight 2 div add moveto
187
+ guardwidth guardheight -2 div rlineto
188
+ guardwidth neg guardheight -2 div rlineto
189
+ stroke
190
+ } if
191
+ } if
192
+
193
+ grestore
194
+
195
+ end
196
+
197
+ } bind def
198
+ /renlinear load 0 1 dict put
199
+ % --END RENDERER renlinear--
200
+
201
+ % --BEGIN RENDERER renmatrix--
202
+ /renmatrix {
203
+
204
+ 0 begin
205
+
206
+ /args exch def
207
+
208
+ % Default options
209
+ /width 1 def
210
+ /height 1 def
211
+
212
+ % Apply the renderer options
213
+ args {exch cvlit exch def} forall
214
+
215
+ % Parse the user options
216
+ opt {
217
+ token false eq {exit} if dup length string cvs (=) search
218
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
219
+ } loop
220
+
221
+ /width width cvr def
222
+ /height height cvr def
223
+
224
+ % Convert the bits into a string
225
+ /imgstr pixs length string def
226
+ 0 1 pixs length 1 sub {
227
+ dup imgstr 3 1 roll pixs exch get 1 exch sub 255 mul put
228
+ } for
229
+
230
+ % Draw the image
231
+ gsave
232
+ currentpoint translate
233
+ 72 width mul 72 height mul scale
234
+ pixx pixy 8 [ pixx 0 0 pixy neg 0 pixy ] {imgstr} image
235
+ grestore
236
+
237
+ end
238
+
239
+ } bind def
240
+ /renmatrix load 0 1 dict put
241
+ % --END RENDERER renmatrix--
242
+
243
+ % --BEGIN RENDERER renmaximatrix--
244
+ /renmaximatrix {
245
+
246
+ 0 begin
247
+
248
+ /args exch def % We are given some arguments
249
+
250
+ % Apply the renderer options
251
+ args {exch cvlit exch def} forall
252
+
253
+ % Parse the user options
254
+ opt {
255
+ token false eq {exit} if dup length string cvs (=) search
256
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
257
+ } loop
258
+
259
+ gsave
260
+
261
+ currentpoint translate
262
+
263
+ 2.4945 dup scale % from 1pt to 1.88mm
264
+ 0.5 0.5774 translate
265
+
266
+ pixs {
267
+ dup
268
+ /x exch 30 mod def
269
+ /y exch 30 idiv def
270
+ y 2 mod 0 eq {x} {x 0.5 add} ifelse
271
+ 32 y sub 0.8661 mul
272
+ moveto
273
+ 0 0.5774 rmoveto
274
+ -0.5 -0.2887 rlineto
275
+ 0 -0.5774 rlineto
276
+ 0.5 -0.2887 rlineto
277
+ 0.5 0.2887 rlineto
278
+ 0 0.5774 rlineto
279
+ -0.5 0.2887 rlineto
280
+ closepath fill
281
+ } forall
282
+
283
+ % Plot the locator symbol
284
+ newpath 14 13.8576 0.5774 0 360 arc closepath
285
+ 14 13.8576 1.3359 360 0 arcn closepath fill
286
+ newpath 14 13.8576 2.1058 0 360 arc closepath
287
+ 14 13.8576 2.8644 360 0 arcn closepath fill
288
+ newpath 14 13.8576 3.6229 0 360 arc closepath
289
+ 14 13.8576 4.3814 360 0 arcn closepath fill
290
+
291
+ grestore
292
+
293
+ end
294
+
295
+ } bind def
296
+ /renmaximatrix load 0 1 dict put
297
+ % --END RENDERER renmaximatrix--
298
+
299
+ % --BEGIN DISPATCHER--
300
+ /barcode {
301
+ 0 begin
302
+ dup (ren) get cvx exec
303
+ end
304
+ } bind def
305
+ /barcode load 0 1 dict put
306
+ % --END DISPATCHER--
307
+
308
+
@@ -0,0 +1,119 @@
1
+
2
+ % --DESC: Royal Mail 4 State Customer Code (RM4SCC)
3
+ % --EXAM: LE28HS9Z
4
+ % --EXOP: includetext includecheckintext barcolor=FF0000
5
+ % --RNDR: renlinear
6
+ /royalmail {
7
+
8
+ 0 begin
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
+ /includecheckintext false def
16
+ /textfont /Courier def
17
+ /textsize 10 def
18
+ /textyoffset -7 def
19
+ /height 0.175 def
20
+
21
+ % Parse the input options
22
+ options {
23
+ token false eq {exit} if dup length string cvs (=) search
24
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
25
+ } loop
26
+
27
+ /textfont textfont cvlit def
28
+ /textsize textsize cvr def
29
+ /textyoffset textyoffset cvr def
30
+ /height height cvr def
31
+
32
+ % Create an array containing the character mappings
33
+ /encs
34
+ [ (3300) (2211) (2301) (2310) (3201) (3210)
35
+ (1122) (0033) (0123) (0132) (1023) (1032)
36
+ (1302) (0213) (0303) (0312) (1203) (1212)
37
+ (1320) (0231) (0321) (0330) (1221) (1230)
38
+ (3102) (2013) (2103) (2112) (3003) (3012)
39
+ (3120) (2031) (2121) (2130) (3021) (3030)
40
+ (2) (3)
41
+ ] def
42
+
43
+ % Create a string of the available characters
44
+ /barchars (ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS) def
45
+
46
+ /barlen barcode length def
47
+ /encstr barlen 4 mul 6 add string def
48
+ /txt barlen 1 add array def
49
+
50
+ % Put start character
51
+ encstr 0 encs 36 get putinterval
52
+
53
+ /checksumrow 0 def
54
+ /checksumcol 0 def
55
+ 0 1 barlen 1 sub {
56
+ /i exch def
57
+ % Lookup the encoding for the each barcode character
58
+ barcode i 1 getinterval barchars exch search
59
+ pop % Discard true leaving pre
60
+ length /indx exch def % indx is the length of pre
61
+ pop pop % Discard seek and post
62
+ /enc encs indx get def % Get the indxth encoding
63
+ encstr i 4 mul 1 add enc putinterval
64
+ txt i [barcode i 1 getinterval i 4 mul 1 add 3.312 mul textyoffset textfont textsize] put
65
+ /checksumrow checksumrow indx 6 idiv add def
66
+ /checksumcol checksumcol indx 6 mod add def
67
+ } for
68
+
69
+ % Put the checksum character
70
+ /checksum checksumrow 6 mod 6 mul checksumcol 6 mod add def
71
+ /enc encs checksum get def
72
+ encstr barlen 4 mul 1 add enc putinterval
73
+ includecheckintext {
74
+ txt barlen [barchars checksum 1 getinterval barlen 4 mul 1 add 3.312 mul textyoffset textfont textsize] put
75
+ } {
76
+ txt barlen [( ) barlen 4 mul 1 add 3.312 mul textyoffset textfont textsize] put
77
+ } ifelse
78
+
79
+ % Put end character
80
+ encstr barlen 4 mul 5 add encs 37 get putinterval
81
+
82
+ /bbs encstr length array def
83
+ /bhs encstr length array def
84
+ 0 1 encstr length 1 sub {
85
+ /i exch def
86
+ /enc encstr i 1 getinterval def
87
+ enc (0) eq {
88
+ bbs i 3 height mul 8 div put
89
+ bhs i 2 height mul 8 div put
90
+ } if
91
+ enc (1) eq {
92
+ bbs i 0 height mul 8 div put
93
+ bhs i 5 height mul 8 div put
94
+ } if
95
+ enc (2) eq {
96
+ bbs i 3 height mul 8 div put
97
+ bhs i 5 height mul 8 div put
98
+ } if
99
+ enc (3) eq {
100
+ bbs i 0 height mul 8 div put
101
+ bhs i 8 height mul 8 div put
102
+ } if
103
+ } for
104
+
105
+ /retval 8 dict def
106
+ retval (ren) (renlinear) put
107
+ retval (bbs) bbs put
108
+ retval (bhs) bhs put
109
+ retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put
110
+ includetext {
111
+ retval (txt) txt put
112
+ } if
113
+ retval (opt) useropts put
114
+ retval
115
+
116
+ end
117
+
118
+ } bind def
119
+ /royalmail load 0 1 dict put
@@ -0,0 +1,237 @@
1
+
2
+ % --DESC: Reduced Space Symbology 14 (RSS-14)
3
+ % --EXAM: 24012345678905
4
+ % --EXOP: height=0.3
5
+ % --RNDR: renlinear
6
+ /rss14 {
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
+ /height 1 def
15
+ /linkage false def
16
+
17
+ % Parse the input options
18
+ options {
19
+ token false eq {exit} if dup length string cvs (=) search
20
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
21
+ } loop
22
+
23
+ % Create the human readable text
24
+ /txt barcode length array def
25
+ 0 1 barcode length 1 sub {
26
+ /i exch def
27
+ txt i [barcode i 1 getinterval 0 0 () 0] put
28
+ } for
29
+
30
+ /height height cvr def
31
+
32
+ /getRSSwidths {
33
+ /oe exch def
34
+ /mw exch def
35
+ /nm exch def
36
+ /val exch def
37
+ /j 0 def /i 0 def {
38
+ /v () def
39
+ mw 1 ne {/v i mw 4 string cvrs def} if
40
+ 0 v {48 sub add} forall 4 add nm eq {
41
+ /out [ 4 {1} repeat v {47 sub} forall ] v length 4 getinterval def
42
+ /hasone false def out {1 eq {/hasone true def} if} forall
43
+ oe not hasone or {
44
+ j val eq {exit} if
45
+ /j j 1 add def
46
+ } if
47
+ } if
48
+ /i i 1 add def
49
+ } loop
50
+ out
51
+ } bind def
52
+
53
+ /binval [barcode {48 sub} forall] def
54
+ /binval [linkage {1} {0} ifelse binval 0 13 getinterval {} forall] def
55
+
56
+ 0 1 12 {
57
+ /i exch def
58
+ binval i 1 add 2 copy get binval i get 4537077 mod 10 mul add put
59
+ binval i binval i get 4537077 idiv put
60
+ } for
61
+ /right binval 13 get 4537077 mod def
62
+ binval 13 2 copy get 4537077 idiv put
63
+
64
+ /left 0 def
65
+ /i true def
66
+ 0 1 13 {
67
+ /j exch def
68
+ binval j get
69
+ dup 0 eq i and {
70
+ pop
71
+ } {
72
+ /i false def
73
+ /left left 3 -1 roll 10 13 j sub exp cvi mul add def
74
+ } ifelse
75
+ } for
76
+
77
+ /d1 left 1597 idiv def
78
+ /d2 left 1597 mod def
79
+ /d3 right 1597 idiv def
80
+ /d4 right 1597 mod def
81
+
82
+ /tab164 [
83
+ 160 0 12 4 8 1 161 1
84
+ 960 161 10 6 6 3 80 10
85
+ 2014 961 8 8 4 5 31 34
86
+ 2714 2015 6 10 3 6 10 70
87
+ 2840 2715 4 12 1 8 1 126
88
+ ] def
89
+
90
+ /tab154 [
91
+ 335 0 5 10 2 7 4 84
92
+ 1035 336 7 8 4 5 20 35
93
+ 1515 1036 9 6 6 3 48 10
94
+ 1596 1516 11 4 8 1 81 1
95
+ ] def
96
+
97
+ /i 0 def {
98
+ d1 tab164 i get le {
99
+ tab164 i 1 add 7 getinterval {} forall
100
+ /d1te exch def /d1to exch def
101
+ /d1mwe exch def /d1mwo exch def
102
+ /d1ele exch def /d1elo exch def
103
+ /d1gs exch def
104
+ exit
105
+ } if
106
+ /i i 8 add def
107
+ } loop
108
+
109
+ /i 0 def {
110
+ d2 tab154 i get le {
111
+ tab154 i 1 add 7 getinterval {} forall
112
+ /d2te exch def /d2to exch def
113
+ /d2mwe exch def /d2mwo exch def
114
+ /d2ele exch def /d2elo exch def
115
+ /d2gs exch def
116
+ exit
117
+ } if
118
+ /i i 8 add def
119
+ } loop
120
+
121
+ /i 0 def {
122
+ d3 tab164 i get le {
123
+ tab164 i 1 add 7 getinterval {} forall
124
+ /d3te exch def /d3to exch def
125
+ /d3mwe exch def /d3mwo exch def
126
+ /d3ele exch def /d3elo exch def
127
+ /d3gs exch def
128
+ exit
129
+ } if
130
+ /i i 8 add def
131
+ } loop
132
+
133
+ /i 0 def {
134
+ d4 tab154 i get le {
135
+ tab154 i 1 add 7 getinterval {} forall
136
+ /d4te exch def /d4to exch def
137
+ /d4mwe exch def /d4mwo exch def
138
+ /d4ele exch def /d4elo exch def
139
+ /d4gs exch def
140
+ exit
141
+ } if
142
+ /i i 8 add def
143
+ } loop
144
+
145
+ /d1wo d1 d1gs sub d1te idiv d1elo d1mwo false getRSSwidths def
146
+ /d1we d1 d1gs sub d1te mod d1ele d1mwe true getRSSwidths def
147
+ /d2wo d2 d2gs sub d2to mod d2elo d2mwo true getRSSwidths def
148
+ /d2we d2 d2gs sub d2to idiv d2ele d2mwe false getRSSwidths def
149
+ /d3wo d3 d3gs sub d3te idiv d3elo d3mwo false getRSSwidths def
150
+ /d3we d3 d3gs sub d3te mod d3ele d3mwe true getRSSwidths def
151
+ /d4wo d4 d4gs sub d4to mod d4elo d4mwo true getRSSwidths def
152
+ /d4we d4 d4gs sub d4to idiv d4ele d4mwe false getRSSwidths def
153
+
154
+ /d1w 8 array def
155
+ 0 1 3 {
156
+ /i exch def
157
+ d1w i 2 mul d1wo i get put
158
+ d1w i 2 mul 1 add d1we i get put
159
+ } for
160
+
161
+ /d2w 8 array def
162
+ 0 1 3 {
163
+ /i exch def
164
+ d2w 7 i 2 mul sub d2wo i get put
165
+ d2w 6 i 2 mul sub d2we i get put
166
+ } for
167
+
168
+ /d3w 8 array def
169
+ 0 1 3 {
170
+ /i exch def
171
+ d3w 7 i 2 mul sub d3wo i get put
172
+ d3w 6 i 2 mul sub d3we i get put
173
+ } for
174
+
175
+ /d4w 8 array def
176
+ 0 1 3 {
177
+ /i exch def
178
+ d4w i 2 mul d4wo i get put
179
+ d4w i 2 mul 1 add d4we i get put
180
+ } for
181
+
182
+ /widths [
183
+ d1w {} forall
184
+ d2w {} forall
185
+ d3w {} forall
186
+ d4w {} forall
187
+ ] def
188
+
189
+ /checkweights [
190
+ 1 3 9 27 2 6 18 54
191
+ 58 72 24 8 29 36 12 4
192
+ 74 51 17 32 37 65 48 16
193
+ 64 34 23 69 49 68 46 59
194
+ ] def
195
+
196
+ /checkwidths [
197
+ 3 8 2 1 1 3 5 5 1 1 3 3 7 1 1
198
+ 3 1 9 1 1 2 7 4 1 1 2 5 6 1 1
199
+ 2 3 8 1 1 1 5 7 1 1 1 3 9 1 1
200
+ ] def
201
+
202
+ /checksum 0 def
203
+ 0 1 31 {
204
+ /i exch def
205
+ /checksum checksum widths i get checkweights i get mul add def
206
+ } for
207
+ /checksum checksum 79 mod def
208
+ checksum 8 ge {/checksum checksum 1 add def} if
209
+ checksum 72 ge {/checksum checksum 1 add def} if
210
+ /checklt checkwidths checksum 9 idiv 5 mul 5 getinterval def
211
+ /checkrtrev checkwidths checksum 9 mod 5 mul 5 getinterval def
212
+ /checkrt 5 array def
213
+ 0 1 4 {
214
+ /i exch def
215
+ checkrt i checkrtrev 4 i sub get put
216
+ } for
217
+
218
+ /sbs [
219
+ 1 d1w {} forall checklt {} forall d2w {}
220
+ forall d4w {} forall checkrt {} forall d3w {} forall 1 1
221
+ ] def
222
+
223
+ % Return the arguments
224
+ /retval 8 dict def
225
+ retval (ren) (renlinear) put
226
+ retval (sbs) sbs put
227
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
228
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
229
+ retval (txt) txt put
230
+ retval (textxalign) (center) put
231
+ retval (opt) useropts put
232
+ retval
233
+
234
+ end
235
+
236
+ } bind def
237
+ /rss14 load 0 1 dict put