Skip to content

Commit 8c4602d

Browse files
committed
Make the height option a multiplier under propspec
1 parent e756e01 commit 8c4602d

13 files changed

Lines changed: 59 additions & 24 deletions

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2026-04-08
2+
3+
* Under propspec, the height option now acts as a multiplier on the spec-derived bar height.
4+
5+
16
2026-04-07
27

38
* The spec-based options were renamed to propspec, strictspec and loosespec and can be set via global_ctx.

CONTRIBUTING.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,9 @@ physical specification dimensions.
639639
remain pixel-locked at 72 DPI — the user applies a single scale factor
640640
to hit both their target X-dimension and resolution. Silently falls back
641641
to default height when `hnom` is not available (harmless no-op).
642-
User-supplied `height` overrides the derived value. EPS-safe.
642+
User-supplied `height` acts as a multiplier on the derived value
643+
(e.g. `height=1.5` for 150% of spec height; `height=1.0` is identity).
644+
EPS-safe.
643645

644646
- **`strictspec`**: The renderer scales the symbol to physical spec
645647
dimensions derived from `xnom` (or explicit `xdim`). Bar height is
@@ -704,9 +706,12 @@ is not found, `default` silently passes; non-default profiles error.
704706
silently disables `strictspec` when `xnom`/`xdim` missing, suppresses
705707
bounds errors
706708
- `resolve_height` — pure function, returns derived height on the stack
707-
(or current `height` if not applicable). Derives when
708-
`hnom != -1 AND (strictspec OR (propspec AND height == sentinel))`.
709-
Pixel-locks (rounds) under propspec; not under strictspec.
709+
(or current `height` if not applicable). Under strictspec with `hdim`,
710+
derives from `hdim/xdim`. Otherwise derives from `hnom/xnom` when
711+
`hnom != -1 AND (strictspec OR propspec)`. Pixel-locks (rounds) under
712+
propspec; not under strictspec. Under propspec, `height` acts as a
713+
multiplier on the derived value (1.0 = identity); under strictspec,
714+
`height` is not permitted (use `hdim`).
710715
- `validate_xdim` — low-level `xdim xmin xmax` bounds check; returns `true`
711716
or `/errorname (info) false` with formatted error string
712717

src/render.ps.src

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,13 +809,14 @@ begin
809809
% strictspec with resolved hdim: derive from hdim/xdim
810810
hdim xdim div modunit mul 72 div
811811
} {
812-
hnom -1 ne strictspec propspec height -1.0 eq and or and {
812+
hnom -1 ne strictspec propspec or and {
813813
xnom -1 eq {
814814
/bwipp.renderHnomNeedXnom (Proportional bar height derivation requires a nominal X-dimension to be defined for the application or for xdim to be supplied) //raiseerror exec
815815
} if
816816
hnom xnom div modunit mul
817817
strictspec not { round } if % Pixel-lock derived height
818818
72 div
819+
propspec { height -1.0 ne { height mul } if } if % height is a multiplier under propspec
819820
} {
820821
height
821822
} ifelse

tests/ps_tests/ean13.ps.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@
153153
{ (9520123456788) (dontdraw strictspec height=0.5) ean13 } /bwipp.renderStrictspecDimOverride isError
154154

155155
%
156-
% propspec is no-op when user supplies height
156+
% propspec: user height acts as multiplier on derived height
157157
%
158-
{ (9520123456788) (dontdraw propspec height=0.5) ean13 /bhs get 0 get 1 array astore } [0.5] isEqual
158+
{ (9520123456788) (dontdraw propspec height=0.5) ean13 /bhs get 0 get 1 array astore } [0.4792] isEqual
159159

160160
%
161161
% loosespec: output matches strictspec for valid input

tests/ps_tests/ean8.ps.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
{ (12345670) (dontdraw) ean8 /bhs get 0 get 1 array astore } [1.0] isEqual
6868
{ (12345670) (dontdraw propspec) ean8 /bhs get 0 get 1 array astore } [0.7639] isEqual
6969

70-
% propspec + user height: user wins
71-
{ (12345670) (dontdraw propspec height=0.5) ean8 /bhs get 0 get 1 array astore } [0.5] isEqual
70+
% propspec + user height: multiplier on derived height
71+
{ (12345670) (dontdraw propspec height=0.5) ean8 /bhs get 0 get 1 array astore } [0.3819] isEqual
7272

7373
% strictspec: xdim resolves from default AST xnom (0.330)
7474
{ (12345670) (dontdraw strictspec) ean8 dup /strictspec get exch /xdim get 2 array astore } [true 0.330] isEqual

tests/ps_tests/gs1-128.ps.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
(\(01\)09521234543213) (dontdraw strictspec ast=gs1.sst2) gs1-128 dup /strictspec get exch /xdim get 2 array astore
7575
} [true 0.495] isEqual
7676

77-
% propspec + user height with SST: user wins
78-
{ (\(01\)09521234543213) (dontdraw propspec ast=gs1.sst2 height=0.3) gs1-128 /bhs get 0 get 1 array astore } [0.3] isEqual
77+
% propspec + user height with SST: multiplier on derived height
78+
{ (\(01\)09521234543213) (dontdraw propspec ast=gs1.sst2 height=0.3) gs1-128 /bhs get 0 get 1 array astore } [0.2667] isEqual
7979

8080
%
8181
% loosespec: falls back when default AST has no xnom

tests/ps_tests/isbn.ps.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
{ (978-1-56581-231-4) (dontdraw propspec) isbn /bhs get 0 get 1 array astore } [0.9583] isEqual
4343

4444
%
45-
% propspec + user height: user wins through wrapper
45+
% propspec + user height: multiplier on derived height through wrapper
4646
%
47-
{ (978-1-56581-231-4) (dontdraw propspec height=0.5) isbn /bhs get 0 get 1 array astore } [0.5] isEqual
47+
{ (978-1-56581-231-4) (dontdraw propspec height=0.5) isbn /bhs get 0 get 1 array astore } [0.4792] isEqual
4848

4949
% AST consumption: SST profile resolves through wrapper
5050
{ (978-1-56581-231-4) (dontdraw strictspec ast=gs1.sst2) isbn dup /strictspec get exch /xdim get 2 array astore } [true 0.660] isEqual

tests/ps_tests/itf14.ps.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
} [true 0.495] isEqual
5353

5454
%
55-
% propspec with user height override: user height wins
55+
% propspec with user height: multiplier on derived height
5656
%
5757
{
5858
(0952876543210) (dontdraw propspec height=0.3) itf14 /bhs get 0 get 1 array astore
59-
} [0.3] isEqual
59+
} [0.2667] isEqual
6060

6161
% AST consumption: SST profile resolves through wrapper
6262
{ (0952876543210) (dontdraw strictspec ast=gs1.sst2) itf14 dup /strictspec get exch /xdim get 2 array astore } [true 0.495] isEqual

tests/ps_tests/pharmacode.ps.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
{ (117480) (dontdraw) pharmacode /bhs get 0 get 1 array astore } [1.0] isEqual
4141
{ (117480) (dontdraw propspec) pharmacode /bhs get 0 get 1 array astore } [0.2222] isEqual
4242

43-
% propspec + user height: user wins
44-
{ (117480) (dontdraw propspec height=0.5) pharmacode /bhs get 0 get 1 array astore } [0.5] isEqual
43+
% propspec + user height: multiplier on derived height
44+
{ (117480) (dontdraw propspec height=0.5) pharmacode /bhs get 0 get 1 array astore } [0.1111] isEqual

tests/ps_tests/renderresolve.ps.test

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
} [0.9617] isEqual
162162

163163
%
164-
% resolve_height: propspec with user-set height returns user height
164+
% resolve_height: propspec with user height applies as multiplier
165165
%
166166
{
167167
7 dict begin
@@ -170,7 +170,31 @@
170170
/resolve_height render
171171
1 array astore
172172
end
173-
} [0.5] isEqual
173+
} [0.4792] isEqual
174+
175+
%
176+
% resolve_height: propspec height=1.0 is identity
177+
%
178+
{
179+
7 dict begin
180+
/propspec true def /strictspec false def /height 1.0 def
181+
/hnom 22.85 def /xnom 0.330 def /modunit 1 def
182+
/resolve_height render
183+
1 array astore
184+
end
185+
} [0.9583] isEqual
186+
187+
%
188+
% resolve_height: propspec height=1.5 scales up
189+
%
190+
{
191+
7 dict begin
192+
/propspec true def /strictspec false def /height 1.5 def
193+
/hnom 22.85 def /xnom 0.330 def /modunit 1 def
194+
/resolve_height render
195+
1 array astore
196+
end
197+
} [1.4375] isEqual
174198

175199
%
176200
% resolve_height: returns sentinel when hnom is -1

0 commit comments

Comments
 (0)