From f3d8d3b84689c93714ed5740477bda81074b698a Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Sat, 8 Apr 2023 00:57:09 +0000 Subject: [PATCH] add version to footer; use portraitPage and landscapePage on every page --- SSS32.ps | Bin 66973 -> 67372 bytes default.nix | 34 ++++++++++---------- include/checksum-table-1.ps.inc | 12 ++----- include/checksum-table-2.ps.inc | 12 ++----- include/checksum-worksheet.ps.inc | 50 ++++++++++++++---------------- include/setup.ps.inc | 10 ++++-- 6 files changed, 50 insertions(+), 68 deletions(-) diff --git a/SSS32.ps b/SSS32.ps index 2523380716eee9377419dcc6e70a409d02f372bf..48b9b81db6110a4c357563d004eaf72ea97d5e64 100644 GIT binary patch delta 1058 zcmaKqOH30{6ozxBQ-lkMRS=K>w-AXN>D+0jk7zV1j~Iv+V}c7=6qo|xQK03aabqMT z#>AMMU}2%MqlG8>)6nVfU}^W8iDnMe2d z#ryozDoaM4&livffm&We_k1zTEfhm*_2D9s*oc3qmGt_C<$w>9wNh|z9N;A)VXen)NLo2NQ88ic z@AQpa_4PM*%5sm}(*d{FNOH(Q9NLhwy6^wL%Hfly7b*Ip|UhVBveci4q__kMNQ!pBGYIk)S43M z?Si-AeUgn(TS_GANvFT=lO#e_6ALl5>O@$y6RSWR1m1^_rY~nF)Sg7Lou2qMYtY=Q zFggfL*$UlTi^|9E7x;A3NvP^Ao9f=m$xbz3@>d0OL#*iW^tJojJpD3TluTOXj;=mT z^&Vq*uuu&*e?LS{Fzqz6*tK&U?yQw1Rtm~a<-aldHRv%XBi9&aJW`d$e2Dx9qu-Z` znO`@-%R1fN5}nHUnc#JVa-cWvV(Co0KA6R^G!nnUQ9C@@b54w-Ql8q4&{*&jhpJ00KCjm=2W}8aVn3Da#adyM*dzhYPBlCq PG9b)pnE80O53MzcW}dXc2QTew7|JLl}z?1kpnns*rmmQXmk(`u|U+d5=)6Np5T zN^n?4FS_t5L5Xr8(4wFagdl%Hei0JnO*ihUyPY`;`SAm~dCxrW`#jHipTo>eNUvT< zZ+(7Grlwfh zPisSm9lgIQX!pl*XZb^^P~?!~9H-{fh{$G`HfJm8%I9)gw_oO5{PM@c%s~u6h(25+ zbo6_W<1mC>TsGKe4&5|UU46QqbZ?aDyH&3kfrvYGW>-R|Ib8*n%e#L7$5Dv7_+%7R zAOXNCo!+Qm6R)HIRycKH)usCQN|)BE_>cf5?$CoV5S0PI!GB6-6W~g1y^0R67nQr~ zu8Ws8ZIp1Q$&G666b8%#IKIu-BJV^17ng3>+LpMc^LJ6xur=$nZ}-T&`EBRCYt$1} zAZ=QjrOQ}>cz>@2_w+=+A*T|9{ZDkzlBO1il$nzKDfTQ~pg->IgSdXbh&v9jtboht z07FlJmDY^Gr0YtXvP&pPOLJYU-p$oYx)JA(OJ{Ny{^tgpySLZ|4ST+W4W94u4O$M~ zpcYt)W69n0$3iJk7YQjxQ!2E6|F#fT>FEBf93%=1n2&VJWcmGcAYa4o9?vIHfadaT ztX?U!usU3bvASGHpg=}J?W_(V*3T@WMpm>4Vi=w8{6juR4tGo zoyZg05RjT#K&R|^0X1iK*hfJ?cLaiIQ^9LL6_FPads;*>gzcXq8ezu+3DutnvLxY< YLVKrtbaE>8z68kv`$a0H*tK@~FV-r0ga7~l diff --git a/default.nix b/default.nix index 6bf2827..1896c4e 100644 --- a/default.nix +++ b/default.nix @@ -41,18 +41,19 @@ let sourceHeader = "Title Page"; content = builtins.readFile "${src}/include/title.ps.inc"; dependencies = [ ]; + skipPageNumber = true; }; license = { sourceHeader = "License Information"; - drawPageContent = true; content = builtins.readFile "${src}/include/license.ps.inc"; dependencies = [ ]; + skipPageNumber = true; }; reference = { sourceHeader = "Reference Sheet"; - drawPageContent = true; content = builtins.readFile "${src}/include/reference.ps.inc"; dependencies = [ ]; + drawFooter = true; }; principalTables = { sourceHeader = "Arithmetic Tables"; @@ -90,21 +91,25 @@ let content = builtins.readFile "${src}/include/checksum-table-1.ps.inc"; isLandscape = true; dependencies = [ ]; + drawFooter = true; }; checksumTable2 = { content = builtins.readFile "${src}/include/checksum-table-2.ps.inc"; - isLandscape = true; dependencies = [ ]; + isLandscape = true; + drawFooter = true; }; checksumWorksheet = { content = builtins.readFile "${src}/include/checksum-worksheet.ps.inc"; - isLandscape = true; dependencies = [ ]; + isLandscape = true; + drawFooter = true; }; shareTable = a: b: c: d: { content = "${toString a} ${toString b} ${toString c} ${toString d} showShareTablePage\n"; dependencies = [ ]; + drawFooter = true; }; }; @@ -154,25 +159,18 @@ let %**************************************************************** '' + '' %%Page: ${toString content.nextPgIdx} ${toString content.nextPgIdx} - ${lib.optionalString (pageData ? isLandscape) "%%PageOrientation: Landscape\n"}%%BeginPageSetup + ${lib.optionalString (pageData ? isLandscape) "%%PageOrientation: Landscape\n"} + %%BeginPageSetup /pgsave save def %%EndPageSetup - '' + ( - if pageData ? drawPageContent - then - if pageData ? isLandscape - then "landscapePage begin ${toString content.nextFooterIdx} drawPageContent\n" - else "portraitPage begin ${toString content.nextFooterIdx} drawPageContent\n" - else - if pageData ? isLandscape - then "90 rotate\n" - else "" - ) + '' + ${if pageData ? isLandscape then "landscapePage" else "portraitPage"} begin + ${lib.optionalString (pageData ? drawFooter) "${toString content.nextFooterIdx} drawFooter"} ${pageData.content} - ${lib.optionalString (pageData ? drawPageContent) "end\n"}pgsave restore + end + pgsave restore showpage ''; - nextFooterIdx = content.nextFooterIdx + (if pageData ? drawPageContent then 1 else 0); + nextFooterIdx = content.nextFooterIdx + (if pageData ? drawFooter then 1 else 0); nextPgIdx = content.nextPgIdx + 1; }; initialContent = { diff --git a/include/checksum-table-1.ps.inc b/include/checksum-table-1.ps.inc index f12e316..8abe308 100644 --- a/include/checksum-table-1.ps.inc +++ b/include/checksum-table-1.ps.inc @@ -1,19 +1,11 @@ -10 dict begin -pgsize aload pop -/pageW exch def -/pageH exch def - -0 pageH neg translate - /Helvetica-Bold findfont 10 scalefont setfont pageW 2 div pageH 48 sub moveto (MS32 Checksum Table) centreshow /Courier findfont 8.5 scalefont setfont 36 pageH 64 sub % x y -pageW 64 sub pageH 144 sub 2 div % w h +pageW 64 sub pageH 148 sub 2 div % w h 0 drawChecksumTable 36 pageH 2 div 16 sub % x y -pageW 64 sub pageH 144 sub 2 div % w h +pageW 64 sub pageH 148 sub 2 div % w h 8 drawChecksumTable -end diff --git a/include/checksum-table-2.ps.inc b/include/checksum-table-2.ps.inc index f350560..3f464c0 100644 --- a/include/checksum-table-2.ps.inc +++ b/include/checksum-table-2.ps.inc @@ -1,19 +1,11 @@ -10 dict begin -pgsize aload pop -/pageW exch def -/pageH exch def - -0 pageH neg translate - /Helvetica-Bold findfont 10 scalefont setfont pageW 2 div pageH 48 sub moveto (MS32 Checksum Table) centreshow /Courier findfont 8.5 scalefont setfont 36 pageH 64 sub % x y -pageW 64 sub pageH 144 sub 2 div % w h +pageW 64 sub pageH 148 sub 2 div % w h 16 drawChecksumTable 36 pageH 2 div 16 sub % x y -pageW 64 sub pageH 144 sub 2 div % w h +pageW 64 sub pageH 148 sub 2 div % w h 24 drawChecksumTable -end diff --git a/include/checksum-worksheet.ps.inc b/include/checksum-worksheet.ps.inc index 255e681..7ae3b1e 100644 --- a/include/checksum-worksheet.ps.inc +++ b/include/checksum-worksheet.ps.inc @@ -1,12 +1,9 @@ -% 0 pgsize aload pop pop neg translate -0 -750 translate - /Helvetica-Bold findfont 10 scalefont setfont pgsize aload pop exch pop 2 div 700 moveto (ms32 Checksum Worksheet) centreshow gsave -50 680 translate +50 560 translate ladder begin drawgrid % (2NAMES5GS8YDXGMLUW34LEN0PRDAK9GLF307N04SN6SKL) fillgrid @@ -14,54 +11,53 @@ ladder begin end grestore -100 420 moveto +100 320 moveto /Helvetica-Bold findfont 10 scalefont setfont (Verifying Checksums) show -100 400 moveto +100 300 moveto /Helvetica findfont 9 scalefont setfont (Write out the 45 character data portion in the) show -100 390 moveto +100 290 moveto (bold boxes, two at a time, starting on the top) show -100 380 moveto +100 280 moveto (row. Working from the top row down, look up) show -100 370 moveto +100 270 moveto (the first two characters of each odd row in the) show -100 360 moveto +100 260 moveto (ms32 Checksum Table and write the ) polymodulus length 10 string cvs concatstrings show -100 350 moveto +100 250 moveto (character word into the even row below it. Fill) show -100 340 moveto +100 240 moveto (in the odd rows by adding the two characters) show -100 330 moveto +100 230 moveto (above each cell. You may use either the) show -100 320 moveto +100 220 moveto (addition wheel table. The first few boxes are) show -100 310 moveto +100 210 moveto (already filled in for you. The last row will sum) show -100 300 moveto +100 200 moveto (to ) show checksumstring {glyphshow} forall ( if the checksum is valid.) show -100 260 moveto +100 160 moveto /Helvetica-Bold findfont 10 scalefont setfont (Creating Checksums) show -100 240 moveto +100 140 moveto /Helvetica findfont 9 scalefont setfont (Follow the "Verifying Checksums" instructions) show -100 230 moveto +100 130 moveto (to fill in everything but the shaded cells. To fill in) show -100 220 moveto +100 120 moveto (the shaded cells, write ) show checksumstring {glyphshow} forall ( into the bottom) show -100 210 moveto +100 110 moveto (row. Working from the bottom up, fill in the) show -100 200 moveto +100 100 moveto (shaded cells by adding the two characters below) show -100 190 moveto +100 90 moveto (each cell. The ) polymodulus length 10 string cvs ( characters in the bold shaded) concatstrings concatstrings show -100 180 moveto +100 80 moveto (boxes will be the checksum.) show -450 650 -/offsety exch def -/offsetx exch def +/offsety 550 def +/offsetx 450 def /Courier findfont 10 scalefont setfont 20 offsetx add offsety moveto (Addition Table) show /Courier-Bold findfont 8 scalefont setfont diff --git a/include/setup.ps.inc b/include/setup.ps.inc index 12fa652..102f085 100644 --- a/include/setup.ps.inc +++ b/include/setup.ps.inc @@ -370,13 +370,17 @@ def % Draw the page number and any (TODO) content in the page content array % Takes the pagenum as a numeric value - /drawPageContent { + /drawFooter { 10 dict begin /pagenum exch def gsave /Times-Roman findfont 12 scalefont setfont centerX marginY2 moveto pagenum pagenum 10 lt { 1 } { 2 } ifelse string cvs show + + /Courier findfont 10 scalefont setfont + marginX1 marginY2 4 sub moveto + ver show grestore end } bind def @@ -396,10 +400,10 @@ portraitPage dup 20 dict copy dup /landscapePage exch def begin /pageW portraitPage /pageH get def /pageH portraitPage /pageW get def - /drawPageContent { + /drawFooter { 90 rotate 0 pageH neg translate - portraitPage /drawPageContent get exec + portraitPage /drawFooter get exec } bind def end