2 # Books of Pumpkins, etc. Extensions to Quacks of Quedlinburg
3 # SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0
4 # Copyright 2020-2022 Ian Jackson
8 BEGIN { unshift @INC, '.'; }
13 for (@_) { $ps_framing .= $_ }
30 my $vhalf = sqrt( $spacing ** 2 - ($colspacing*0.5) ** 2 );
32 my $y_cut = 2.75 * $spacing;
34 my $x_pl_zero = $paper_x*0.5 - 3*$colspacing;
35 my $y_pl_zero = $y_cut + $spacing - $y_cutd* 0.5 * $x_cut/$colspacing;
37 my $y_top = $y_pl_zero + $y_cutd + $spacing*1.25;
39 sub some_cut_line($) {
49 o <<GS, some_cut_line(<<GR), <<END;
55 0 $y_cut $y_cutd add lineto
63 /Helvetica-Bold findfont 6.5 scalefont setfont
81 my $line_word = 'moveto';
88 foreach (split /\n/, $data) {
92 s{L}{ ($repi == 0 ? 1 : 0) }ge;
93 s{R}{ ($repi == $nrepis-1 ? 1 : 0) }ge;
95 s{V}{ $vhalf / $spacing }ge;
96 my ($x,$y,$money,$veeps,$ruby) = map { eval $_ } split /\s+/;
103 $line .= " $x $y $line_word";
104 $line_word = 'lineto';
105 next unless defined $money;
114 % place $x $y $money $veeps $ruby
117 gsave ${\ chip($anychip, 0) } grestore
118 -4 1 moveto ($money) show
124 newpath -$sqx -$sqy moveto
127 $sqx -$sqy lineto closepath
129 gsave 1 setgray fill grestore
135 ($veeps) dup stringwidth pop -0.5 mul -2.5 rmoveto show
140 $o .= <<END if $ruby;
156 (" newpath $line stroke ", $o)
160 for my $places_i (qw(0 1)) {
161 for my $repi (0..$nrepis-1) {
163 % repi $places_i $repi
165 $repi $colspacing 2 mul mul 0 translate
168 o( (places($repi))[$places_i] );
180 $paper_x $x_cut sub 0 translate
184 o some_cut_line <<END;
187 $paper_x $x_cut sub $y_top lineto
195 $paper_x $x_cut sub $y_top 7 sub translate
198 arrowlen 2 add neg 0 translate
199 ${\ arrow_any("arrowlen 0 moveto -30 0 rlineto") }
203 /Helvetica-Bold findfont 6.5 scalefont setfont
213 gsave 0 $y_top translate
220 print $ps_framing or die $!;