-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.typ
More file actions
221 lines (201 loc) · 6.2 KB
/
lib.typ
File metadata and controls
221 lines (201 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// Inkhaven Fair poster design system
// Defaults ported from Aelerinya's 24x36 moloch poster.
// Alias the built-in `columns` function so the `poster(columns: ...)`
// parameter does not shadow it inside the function body.
#let _columns-fn = columns
#let solarized = rgb("#fdf6e3")
#let ink-dark = rgb("#4b2e05")
#let ink-medium = rgb("#834f08")
#let gold-light = rgb("#d4af37")
#let gold-dark = rgb("#b8860b")
#let _paper-dims = (
"16x20in": (16in, 20in),
"18x24in": (18in, 24in),
"22x28in": (22in, 28in),
"24x36in": (24in, 36in),
"36x48in": (36in, 48in),
)
// Column counts target ~6" per column on the existing 18x24 / 24x36 / 36x48
// baseline. 16x20 gets 3 columns in both orientations (~5.3"–6.7"/col) so
// the column width stays within the same readable range. 22x28 slots
// between 18x24 and 24x36 — 5 columns landscape (5.6"/col), 4 portrait
// (5.5"/col).
#let _column-lookup = (
"16x20in": (landscape: 3, portrait: 2),
"18x24in": (landscape: 4, portrait: 3),
"22x28in": (landscape: 5, portrait: 4),
"24x36in": (landscape: 6, portrait: 4),
"36x48in": (landscape: 8, portrait: 6),
)
#let _margin-lookup = (
"16x20in": (x: 1in, top: 0.75in, bottom: 1.5in),
"18x24in": (x: 1in, top: 0.75in, bottom: 1.5in),
"22x28in": (x: 1in, top: 0.75in, bottom: 1.5in),
"24x36in": (x: 1in, top: 0.75in, bottom: 1.5in),
"36x48in": (x: 1in, top: 0.75in, bottom: 1.5in),
)
#let _resolve-page-size(paper, orientation) = {
let dims = _paper-dims.at(paper)
let short = dims.at(0)
let long = dims.at(1)
if orientation == "landscape" {
(width: long, height: short)
} else {
(width: short, height: long)
}
}
#let _resolve-columns(paper, orientation, columns) = {
if columns == auto {
_column-lookup.at(paper).at(orientation)
} else {
columns
}
}
#let byline(author, date: none, blog: none, accent: rgb("#b8860b")) = {
set align(center)
set text(size: 19pt, fill: ink-dark, weight: "semibold", tracking: 0.2em)
block(above: 0.8em, below: 1.2em)[
#upper(author)#if blog != none [ · #upper(blog)]#if date != none [ · #upper(date)]
]
}
#let pull-quote(body) = {
set text(size: 14pt, style: "italic")
set par(leading: 0.7em)
block(
inset: (left: 2em, right: 2em, top: 0.5em, bottom: 0.5em),
fill: none,
stroke: none,
body,
)
}
#let inkhaven-logo(height: 0.8in, text-size: auto, fill: ink-medium) = {
let resolved-size = if text-size == auto { height * 0.6 } else { text-size }
block(below: 1in,
// stroke: 1pt + red
)[
#set align(center)
#image("assets/inkhaven_logo.webp", height: height)
#block(above: 0.3em, below: 0em)[
#text(
font: ("Libertinus Serif", "New Computer Modern", "Noto Serif CJK SC"),
size: resolved-size,
weight: "regular",
tracking: 0.3em,
fill: fill,
upper[Inkhaven],
)
]
#block(above: 0.3em, below: 0em)[
#text(
font: ("Libertinus Serif", "New Computer Modern", "Noto Serif CJK SC"),
size: resolved-size,
weight: "regular",
tracking: 0.3em,
fill: fill,
upper[Residency],
)
]
]
}
#let poster(
body,
title: "",
author: "",
date: none,
paper: "24x36in",
orientation: "landscape",
accent-color: gold-dark,
columns: auto,
qr-svg: none,
blog: none,
font-size: 13pt,
title-size: 58pt,
) = {
let page-size = _resolve-page-size(paper, orientation)
let column-count = _resolve-columns(paper, orientation, columns)
set page(
width: page-size.width,
height: page-size.height,
margin: _margin-lookup.at(paper),
fill: solarized,
footer: [
#v(1fr)
#line(length: 100%, stroke: 0.4pt + accent-color)
#set align(center)
#text(size: 18pt, fill: accent-color)[Sponsored by ]
#box(baseline: 25%)[#image("assets/WPCOM-Dark-Default@2x.png", height: 18pt)]
#v(1fr)
],
)
set text(
font: ("Libertinus Serif", "New Computer Modern", "Noto Serif CJK SC"),
size: font-size,
fill: ink-dark,
lang: "en",
hyphenate: true,
)
set par(
justify: true,
leading: 0.75em,
spacing: 1.2em,
)
show link: it => {
set text(fill: accent-color)
it
}
show raw.where(block: true): it => block(
width: 100%,
fill: rgb("#f4ecd3"),
stroke: 0.5pt + gold-dark,
inset: (x: 0.8em, y: 0.6em),
radius: 3pt,
text(size: 0.9em, font: ("Menlo", "DejaVu Sans Mono", "Courier New"), it),
)
show raw.where(block: false): it => box(
fill: rgb("#f4ecd3"),
inset: (x: 0.25em, y: 0.1em),
outset: (y: 0.15em),
radius: 2pt,
text(font: ("Menlo", "DejaVu Sans Mono", "Courier New"), it),
)
// Title block, non-breakable, spans full width above the columns.
// Fixed 1.75in side columns keep the logo and QR at their natural size
// regardless of title length (prevents "RESIDENCY" from hyphenating).
block(width: 100%, breakable: false,
// stroke: 1.5pt + red
)[
#grid(
columns: (1.75in, 1fr, 1.75in),
align: (center + horizon, center + bottom, center + horizon),
// Logo and QR use place() so they don't contribute to the grid row
// height — the row sizes to the title alone, so the byline sits right
// under the title regardless of how many lines the title occupies.
[#inkhaven-logo(height: 1.1in, text-size: 0.18in)],
[
#set text(size: title-size, weight: "regular", hyphenate: false,
font: ("Libertinus Serif", "New Computer Modern", "Noto Serif CJK SC"),
bottom-edge: "descender")
#set par(justify: false, leading: 0.2em)
#block(above: 0.5em, below: 0em)[#title]
#byline(author, date: date, blog: blog, accent: accent-color)
],
[
#if qr-svg != none {
block(
// stroke: 1pt + red
)[
#image(bytes(qr-svg), format: "svg", width: 1.1in)
#block(above: 0.3em, width: 1.1in)[
#set text(size: 7pt, fill: ink-medium, tracking: 0.15em)
#set align(center)
#upper[Read online]
]
]
}
],
)
#block(above: 0.2in, below: 0.8em)[#line(length: 100%, stroke: accent-color + 0.5pt)]
]
v(0.6em)
_columns-fn(column-count, gutter: 1.2em, body)
}