diff --git a/SSS32.ps b/SSS32.ps index 2523380..48b9b81 100644 Binary files a/SSS32.ps and b/SSS32.ps differ diff --git a/default.nix b/default.nix index 21ca540..4b9c056 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