better naming of page fitting

master
LEdoian 2 years ago
parent b959cf5806
commit a7f40080f7

@ -1,9 +1,12 @@
from settings access outformat;
outformat="pdf";
unitsize(1mm);
//A4: 210 x 297 mm
int pgw = 210;
int pgh = 297;
size(pgw, pgh);
bool force_output_size = true;
int sqsz = pgw;
@ -15,12 +18,12 @@ string envfmt = "C6";
// debugging tool
bool with_labels = true;
bool force_a4 = true;
// It is unpractical to try emulating second quadrant. We will work in the
// first quadrant with the origin at the bottom-left corner of the square (not
// the whole page). Therefore, the bottom edge of the page is at y=(210-297)
// for an A4 paper
int pgbot = pgw - pgh;
// gimme a square?
@ -115,9 +118,9 @@ draw(cl1 -- (0, sqsz) -- ct2);
draw(ct1 -- cr1);
draw(cr2 -- (sqsz, 0) -- cb1);
//Force A4 output size
path a4_outline = (0,pgbot) -- (0, sqsz) -- (sqsz, sqsz) -- (sqsz, pgbot) -- cycle;
if (force_a4) {
draw(a4_outline, invisible);
clip(a4_outline);
//Force declared output size
path output_outline = (0,pgbot) -- (0, sqsz) -- (sqsz, sqsz) -- (sqsz, pgbot) -- cycle;
if (force_output_size) {
draw(output_outline, invisible);
clip(output_outline);
}

Loading…
Cancel
Save