Skip to content

Commit 189b9ca

Browse files
committed
New physspec rendering system with nominal dimensions and constraints
1 parent a5f0152 commit 189b9ca

146 files changed

Lines changed: 3158 additions & 122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGES

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
XXXX-XX-XX
1+
2026-04-03
22

33
* Text group support was added to the MaxiCode symbology.
4+
* A new physspec option was added to simplify the generation of vector symbols with specification-compliant physical dimensions.
5+
* Nominal and bounding metrics can be looked up in per-symbology application specific tables with the new ast option.
6+
* In physspec mode the gridfit option validates the effective X-dimension against specification bounds, trying alternate rounding directions when the initial snap falls outside the allowed range.
47

58

69
2026-03-31

src/auspost.ps.src

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
currentglobal
4242
true setglobal
4343
/setpacking where {pop currentpacking true setpacking} if
44-
16 dict
44+
17 dict
4545
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4646
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
47+
dup /render dup /uk.co.terryburton.bwipp findresource put
4748
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4849
begin
4950

@@ -147,6 +148,16 @@ begin
147148
/height 0.175 def
148149
/custinfoenc (character) def
149150

151+
/propspec false def
152+
/physspec false def
153+
/mag 1.0 def
154+
/xdim -1.0 def
155+
/hdim -1.0 def
156+
/ast (default) def
157+
/xmin -1.0 def /xnom -1.0 def /xmax -1.0 def
158+
/hnom -1.0 def
159+
/modunit 1 def
160+
150161
/apply //processoptions exec /options exch def
151162
/barcode exch def
152163

@@ -193,6 +204,12 @@ begin
193204
/bwipp.auspostTooLong (The message is too long) //raiseerror exec
194205
} if
195206

207+
%
208+
% Apply AST spec overrides and resolve physical specification
209+
%
210+
/auspost ast /apply_ast //render exec not { //raiseerror exec } if
211+
/resolve_physspec //render exec
212+
196213
%
197214
% Put start character
198215
%
@@ -290,6 +307,8 @@ begin
290307
encstr encstr length 14 sub checkcode putinterval
291308
encstr encstr length 2 sub //auspost.encs 74 get putinterval
292309

310+
/resolve_height //render exec
311+
293312
/bbs encstr length array def
294313
/bhs encstr length array def
295314
0 1 encstr length 1 sub {
@@ -322,6 +341,11 @@ begin
322341
/txt [ [barcode 2 barlen 2 sub getinterval 0 0 text1font text1size] ]
323342
/text1xalign (center)
324343
} if
344+
/physspec physspec
345+
/xdim xdim
346+
/xmin xmin
347+
/xmax xmax
348+
/modunit modunit
325349
/opt options
326350
>>
327351

src/azteccode.ps.src

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
currentglobal
4242
true setglobal
4343
/setpacking where {pop currentpacking true setpacking} if
44-
32 dict
44+
33 dict
4545
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4646
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
4747
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
4848
dup /fifocache dup /uk.co.terryburton.bwipp findresource put
4949
dup /setuphooks dup /uk.co.terryburton.bwipp findresource put
5050
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
51+
dup /render dup /uk.co.terryburton.bwipp findresource put
5152
begin
5253

5354
/azteccode [/before /after] //setuphooks exec
@@ -322,6 +323,14 @@ begin
322323
/raw false def
323324
/parse false def
324325
/parsefnc false def
326+
/physspec false def
327+
/mag 1.0 def
328+
/xdim -1.0 def
329+
/ast (default) def
330+
/xnom -1.0 def
331+
/xmin -1.0 def
332+
/xmax -1.0 def
333+
/modunit 2 def
325334

326335
/apply //processoptions exec /options exch def
327336
/barcode exch def
@@ -331,6 +340,12 @@ begin
331340
/uk.co.terryburton.bwipp._dontdraw dup where {exch get} {pop false} ifelse or not
332341
def
333342

343+
%
344+
% Apply AST spec overrides and resolve physical specification
345+
%
346+
/azteccode ast /apply_ast //render exec not { //raiseerror exec } if
347+
/resolve_physspec //render exec
348+
334349
(input.processoptions) //azteccode.after exec
335350

336351
//azteccode.latevars /init get exec
@@ -1115,6 +1130,11 @@ begin
11151130
/pixy size
11161131
/height size 2 mul 72 div
11171132
/width size 2 mul 72 div
1133+
/physspec physspec
1134+
/xdim xdim
1135+
/xmin xmin
1136+
/xmax xmax
1137+
/modunit modunit
11181138
/opt options
11191139
>>
11201140

src/bc412.ps.src

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
currentglobal
4242
true setglobal
4343
/setpacking where {pop currentpacking true setpacking} if
44-
8 dict
44+
9 dict
4545
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4646
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
47+
dup /render dup /uk.co.terryburton.bwipp findresource put
4748
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4849
begin
4950

@@ -104,6 +105,16 @@ begin
104105
/text1yoffset -7.0 def
105106
/height 1.0 def
106107

108+
/propspec false def
109+
/physspec false def
110+
/mag 1.0 def
111+
/xdim -1.0 def
112+
/hdim -1.0 def
113+
/ast (default) def
114+
/xmin -1.0 def /xnom -1.0 def /xmax -1.0 def
115+
/hnom -1.0 def
116+
/modunit 1 def
117+
107118
/apply //processoptions exec /options exch def
108119
/barcode exch def
109120

@@ -196,6 +207,12 @@ begin
196207
} if
197208
} ifelse
198209

210+
%
211+
% Apply AST spec overrides and resolve physical specification
212+
%
213+
/bc412 ast /apply_ast //render exec not { //raiseerror exec } if
214+
/resolve_physspec //render exec
215+
199216
/sbs barlen 1 add 8 mul 5 add string def
200217

201218
%
@@ -236,6 +253,9 @@ begin
236253
} { barcode } ifelse def
237254

238255
/sbs sbs 0 pos getinterval def
256+
257+
/resolve_height //render exec
258+
239259
<<
240260
/ren /renlinear
241261
/sbs [sbs {48 sub} forall]
@@ -245,6 +265,11 @@ begin
245265
/txt [ [text 0 0 text1font text1size] ]
246266
/text1xalign (center)
247267
} if
268+
/physspec physspec
269+
/xdim xdim
270+
/xmin xmin
271+
/xmax xmax
272+
/modunit modunit
248273
/opt options
249274
>>
250275

src/channelcode.ps.src

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
currentglobal
4242
true setglobal
4343
/setpacking where {pop currentpacking true setpacking} if
44-
8 dict
44+
9 dict
4545
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4646
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
47+
dup /render dup /uk.co.terryburton.bwipp findresource put
4748
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4849
begin
4950

@@ -151,6 +152,16 @@ begin
151152
/includecheck false def
152153
/height 1.0 def
153154

155+
/propspec false def
156+
/physspec false def
157+
/mag 1.0 def
158+
/xdim -1.0 def
159+
/hdim -1.0 def
160+
/ast (default) def
161+
/xmin -1.0 def /xnom -1.0 def /xmax -1.0 def
162+
/hnom -1.0 def
163+
/modunit 1 def
164+
154165
/apply //processoptions exec /options exch def
155166
/barcode exch def
156167

@@ -176,6 +187,12 @@ begin
176187
/bwipp.channelcodeTooBig (The Channel Code value is too big for the number of channels) //raiseerror exec
177188
} if
178189

190+
%
191+
% Apply AST spec overrides and resolve physical specification
192+
%
193+
/channelcode ast /apply_ast //render exec not { //raiseerror exec } if
194+
/resolve_physspec //render exec
195+
179196
%
180197
% Tail-call optimisation FTW!
181198
%
@@ -280,6 +297,8 @@ begin
280297
check aload pop
281298
] def
282299

300+
/resolve_height //render exec
301+
283302
%
284303
% Create the human readable text
285304
%
@@ -298,6 +317,11 @@ begin
298317
/text1xalign (center)
299318
/borderleft 1.0
300319
/borderright 2.0
320+
/physspec physspec
321+
/xdim xdim
322+
/xmin xmin
323+
/xmax xmax
324+
/modunit modunit
301325
/opt options
302326
>>
303327

src/codablockf.ps.src

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@
4141
currentglobal
4242
true setglobal
4343
/setpacking where {pop currentpacking true setpacking} if
44-
16 dict
44+
17 dict
4545
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4646
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
4747
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
4848
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
49+
dup /render dup /uk.co.terryburton.bwipp findresource put
4950
begin
5051

5152
/codablockf.swa -1 def /codablockf.swb -2 def /codablockf.swc -3 def /codablockf.sft -4 def
@@ -183,6 +184,14 @@ begin
183184
/sepheight 1 def
184185
/parse false def
185186
/parsefnc false def
187+
/physspec false def
188+
/mag 1.0 def
189+
/xdim -1.0 def
190+
/ast (default) def
191+
/xnom -1.0 def
192+
/xmin -1.0 def
193+
/xmax -1.0 def
194+
/modunit 1 def
186195

187196
/apply //processoptions exec /options exch def
188197
/barcode exch def
@@ -192,6 +201,12 @@ begin
192201
/uk.co.terryburton.bwipp._dontdraw dup where {exch get} {pop false} ifelse or not
193202
def
194203

204+
%
205+
% Apply AST spec overrides and resolve physical specification
206+
%
207+
/codablockf ast /apply_ast //render exec not { //raiseerror exec } if
208+
/resolve_physspec //render exec
209+
195210
//codablockf.latevars /init get exec
196211

197212
barcode length 25000 gt {
@@ -670,6 +685,11 @@ begin
670685
/pixy symhgt
671686
/height symhgt 72 div
672687
/width symwid 72 div
688+
/physspec physspec
689+
/xdim xdim
690+
/xmin xmin
691+
/xmax xmax
692+
/modunit modunit
673693
/opt options
674694
>>
675695

src/code11.ps.src

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
currentglobal
4242
true setglobal
4343
/setpacking where {pop currentpacking true setpacking} if
44-
8 dict
44+
9 dict
4545
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4646
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
47+
dup /render dup /uk.co.terryburton.bwipp findresource put
4748
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4849
begin
4950

@@ -97,6 +98,16 @@ begin
9798
/text1yoffset -7.0 def
9899
/height 1.0 def
99100

101+
/propspec false def
102+
/physspec false def
103+
/mag 1.0 def
104+
/xdim -1.0 def
105+
/hdim -1.0 def
106+
/ast (default) def
107+
/xmin -1.0 def /xnom -1.0 def /xmax -1.0 def
108+
/hnom -1.0 def
109+
/modunit 1 def
110+
100111
/apply //processoptions exec /options exch def
101112
/barcode exch def
102113

@@ -124,6 +135,12 @@ begin
124135
} if
125136
} for
126137

138+
%
139+
% Apply AST spec overrides and resolve physical specification
140+
%
141+
/code11 ast /apply_ast //render exec not { //raiseerror exec } if
142+
/resolve_physspec //render exec
143+
127144
/barlen barcode length def
128145
validatecheck {
129146
barlen 11 eq {
@@ -198,15 +215,24 @@ begin
198215
} ifelse
199216
} { barcode } ifelse def
200217

218+
/sbs [sbs {48 sub} forall] def
219+
220+
/resolve_height //render exec
221+
201222
<<
202223
/ren /renlinear
203-
/sbs [sbs {48 sub} forall]
224+
/sbs sbs
204225
/bhs [sbs length 1 add 2 idiv {height} repeat]
205226
/bbs [sbs length 1 add 2 idiv {0} repeat]
206227
includetext {
207228
/txt [ [text 0 0 text1font text1size] ]
208229
/text1xalign (center)
209230
} if
231+
/physspec physspec
232+
/xdim xdim
233+
/xmin xmin
234+
/xmax xmax
235+
/modunit modunit
210236
/opt options
211237
>>
212238

0 commit comments

Comments
 (0)