Add postcard and postcard small templates

This commit is contained in:
Artemis Tosini 2023-09-30 22:34:36 +00:00
parent b4ec250ce1
commit 1d1c0d6139
Signed by: artemist
GPG key ID: EE5227935FE3FF18
4 changed files with 67 additions and 4 deletions

12
cards_lettersheet.typ Normal file
View file

@ -0,0 +1,12 @@
#{
set page("us-letter", margin: 0em)
import "common.typ"
let options = json("options.json")
let cards = options.cards
let args = options.args
common.card_sheets(6in, 4in, 1in/16, args, cards)
}

View file

@ -0,0 +1,12 @@
#{
set page("us-letter", margin: 0em)
import "common.typ"
let options = json("options.json")
let cards = options.cards
let args = options.args
common.card_sheets(149mm, 99mm, 1in/16, args, cards)
}

View file

@ -70,8 +70,8 @@
dx: 1in/8,
dy: 1in/8,
block(
width - 2.75in,
height - 0.25in,
width: width - 2in - 7in/8,
height: height - 0.25in,
breakable: false,
content_fn(card)
)
@ -80,7 +80,7 @@
// Stamp placement guide
place(
top + right,
dx: -0.75in,
dx: -0.25in,
dy: 0.25in,
image("nixowos.png", width: 0.5in)
)
@ -88,7 +88,7 @@
// Address block
place(
horizon + right,
dx: -2in - 5in/8,
dx: -1in/8,
address_block(2.5in, 1in, card)
)
}
@ -101,3 +101,35 @@
postcard_content(width, height, content_fn, card)
)
}
#let postcard_square(width, height, margin, content_fn, card) = {
rect(
width: width + margin * 2,
height: height + margin * 2,
inset: margin,
postcard_block(width, height, content_fn, card)
)
}
#let card_sheets(width, height, margin, args, cards) = {
let content_fn = if args.no_content {
_ => []
} else {
import "content/content.typ"
content.content
}
for (idx, card) in cards.enumerate() {
let row = calc.rem(idx + args.skip, 2)
if idx != 0 and row == 0 {
pagebreak()
}
place(
top + left,
dx: 50% - width / 2 - margin,
dy: 25% - height / 2 - margin + 50% * row,
postcard_square(width, height, margin, content_fn, card)
)
}
}

View file

@ -107,6 +107,13 @@ parser.add_argument(
help="CSV file containing addresses",
)
parser.add_argument(
"-n",
"--no-content",
action="store_true",
help="Skip content, e.g. to make postcard back labels"
)
args = parser.parse_args()
root = ET.parse(