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
62 my $veep_font = "/Helvetica-Bold findfont 6.5 scalefont setfont";
63 my $money_font = "/Helvetica-BoldOblique findfont 6.5 scalefont setfont";
80 newpath -$sqx -$sqy moveto
83 $sqx -$sqy lineto closepath
85 gsave 1 setgray fill grestore
92 ($veeps) dup stringwidth pop -0.5 mul -2.5 rmoveto show
112 my $line_word = 'moveto';
119 foreach (split /\n/, $data) {
123 s{L}{ ($repi == 0 ? 1 : 0) }ge;
124 s{R}{ ($repi == $nrepis-1 ? 1 : 0) }ge;
126 s{V}{ $vhalf / $spacing }ge;
127 my ($x,$y,$money,$veeps,$ruby) = map { eval $_ } split /\s+/;
134 $line .= " $x $y $line_word";
135 $line_word = 'lineto';
136 next unless defined $money;
142 % place $x $y $money $veeps $ruby
145 gsave ${\ chip($anychip, 0) } grestore
146 -4.7 1 moveto ($money) show
151 $o .= <<END if $ruby;
167 (" newpath $line stroke ", $o)
171 for my $places_i (qw(0 1)) {
172 for my $repi (0..$nrepis-1) {
174 % repi $places_i $repi
176 $repi $colspacing 2 mul mul 0 translate
179 o( (places($repi))[$places_i] );
191 $paper_x $x_cut sub 0 translate
195 o some_cut_line <<END;
198 $paper_x $x_cut sub $y_top lineto
206 $paper_x $x_cut sub $y_top 7 sub translate
209 arrowlen 2 add neg 0 translate
210 ${\ arrow_any("arrowlen 0 moveto -30 0 rlineto") }
214 /Helvetica-Bold findfont 6.5 scalefont setfont
224 /Times-Roman findfont 4.5 scalefont setfont
233 gsave 0 $y_top translate
240 print $ps_framing or die $!;