chiark / gitweb /
actually make pages be different pages
[pandemic-rising-tide.git] / generate-board
index 7994569a0c713d224c26620cf9fed38164e51c68..8faca3dc16ef38066796ccb64bf129ecfb391dbe 100755 (executable)
@@ -37,6 +37,8 @@ our $a1_h = 2384;
 our $max_printeredge = 5.50 * MM2PT;
 our $a1m_pasteedge = 3.5 * MM2PT; # along each edge
 our $preamble_from_boundings = '';
+our $top_adjuncts_dy_from_boundings = 0;
+our $bottom_adjuncts_dy_from_boundings = 0;
 
 # ----- region names from plag, incl. reverse mapping -----
 
@@ -343,25 +345,49 @@ sub computeboundings() {
                         @{ $bb{PrintableT} }[2..3],
                        ];
   } elsif ($maxpaper =~ m/^a1/) {
+    my $hairs = 30 * MM2PT;
+    my $hairsw = $bb{Entire}[2];
+    my $hairsh = $bb{Entire}[3];
     my $surround = 5 * MM2PT;
     my $surroundw = $bb{Entire}[2] + $surround*2;
     my $surroundh = $bb{Entire}[3] + $surround*2;
     $somepage->('P', 0,0, $a1_w, $a1_h);
     my $offx = 0.5*($bb{PageP}[2] - $bb{Entire}[2]);
     my $offy = 0.5*($bb{PageP}[3] - $bb{Entire}[3]);
+    my @hrect = @{ $bb{Entire} };
     $bb{Entire}[0] += $offx;  $bb{Entire}[1] += $offy;
     $bb{Entire}[2] += $offx;  $bb{Entire}[3] += $offy;
+    if ($maxpaper eq 'a1m') {
+      @hrect = @{ $submargins->($a1m_pasteedge, \@hrect) };
+      $bb{Cutout} = $submargins->($a1m_pasteedge, $bb{Entire});
+    }
+    my $w_stroke = $xopts =~ m/W/ ?
+       ' gsave 3 setlinewidth stroke grestore '
+       : '';
     $preamble_from_boundings = <<END;
         $offx $offy translate
+         1 setlinewidth
+         0 setgray
+         /a1hairs {
+             newpath moveto
+             $hairs 0        rmoveto
+             $hairs -2 mul 0 rlineto
+             $hairs $hairs   rmoveto
+             0 $hairs -2 mul rlineto
+             stroke
+         } def
+         $hrect[0] $hrect[1] a1hairs
+         $hrect[0] $hrect[3] a1hairs
+         $hrect[2] $hrect[3] a1hairs
+         $hrect[2] $hrect[1] a1hairs
          -$surround -$surround moveto
           $surroundw 0         rlineto
           0 $surroundh         rlineto
           -$surroundw 0        rlineto
-                 closepath clip
+                 closepath $w_stroke clip
 END
-    if ($maxpaper eq 'a1m') {
-      $bb{Cutout} = $submargins->($a1m_pasteedge, $bb{Entire});
-    }
+    $top_adjuncts_dy_from_boundings = 35;
+    $bottom_adjuncts_dy_from_boundings = -7;
   } else {
     confess;
   }
@@ -413,6 +439,7 @@ sub preamble() {
 << /PageSize [ @$sz ] >> setpagedevice
 /board {
   gsave
+  $bb->[0] neg  $bb->[1] neg  translate
 $preamble_from_boundings
   34 -15 translate
 END
@@ -706,9 +733,11 @@ sub decks(){
   o("    200 0 translate deck1path\n");
   o("  } bind def");
   o("  $lw setlinewidth ",miscpscolour('playerdeck'),"\n");
-  o("  gsave 401 44 translate deckpairpathx stroke grestore");
+  o("  gsave 401 44 $bottom_adjuncts_dy_from_boundings add translate");
+  o("     deckpairpathx stroke grestore");
   o("  $lw setlinewidth ",miscpscolour('dykefail'),"\n");
-  o("  gsave 242 1363 translate 90 rotate deckpairpathx stroke grestore");
+  o("  gsave 242 1363 $top_adjuncts_dy_from_boundings add translate ");
+  o("     90 rotate deckpairpathx stroke grestore");
 }
 
 sub sea_track(){
@@ -860,7 +889,7 @@ sub hs_initial_1 ($$$;$$$) {
   my $demo_w = $demo_x0 + $dyke_l * 0.60;
   o("  % HS I $colour\n");
   o("  gsave\n");
-  o("    550 1705 translate\n");
+  o("    550 1705 $top_adjuncts_dy_from_boundings add translate\n");
   o("    ", ($xi*$interval), " ", (($yi-1)*$interval), " translate\n");
   if ($fn) {
     o("  gsave\n");
@@ -897,7 +926,8 @@ sub hs_initial () {
 
 sub play_hint () {
   my $sz = 20;
-  o("  gsave ",miscpscolour('hinttext')," 260 1715 translate\n");
+  o("  gsave ",miscpscolour('hinttext'),
+    " 260 1715 $top_adjuncts_dy_from_boundings add translate\n");
   o("  /Helvetica-Bold findfont $sz scalefont setfont\n");
   my @t = split /\n/, $c{PlayHint};
   foreach my $i (0..$#t) {