Skip to content

Commit

Permalink
add version to footer; use portraitPage and landscapePage on every page
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Apr 8, 2023
1 parent 81509d7 commit f3d8d3b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 68 deletions.
Binary file modified SSS32.ps
Binary file not shown.
34 changes: 16 additions & 18 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
};
};

Expand Down Expand Up @@ -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 = {
Expand Down
12 changes: 2 additions & 10 deletions include/checksum-table-1.ps.inc
Original file line number Diff line number Diff line change
@@ -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
12 changes: 2 additions & 10 deletions include/checksum-table-2.ps.inc
Original file line number Diff line number Diff line change
@@ -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
50 changes: 23 additions & 27 deletions include/checksum-worksheet.ps.inc
Original file line number Diff line number Diff line change
@@ -1,67 +1,63 @@
% 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
% (2NAMES5GS8YDXGMLUW34LEN0PRDAK9GL ) fillgrid
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
Expand Down
10 changes: 7 additions & 3 deletions include/setup.ps.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit f3d8d3b

Please sign in to comment.