Skip to content

Commit d268064

Browse files
committed
Font size tweaks
1 parent 7ecdff3 commit d268064

2 files changed

Lines changed: 37 additions & 45 deletions

File tree

tests/text-sizes/test.typ

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#show: bips-theme
44
#title-slide(title: "Test")
55

6-
// small and tiny
7-
#bips-slide(title: "Small and Tiny")[
8-
Normal text.
9-
#small[This is small text.]
10-
#tiny[This is tiny text.]
6+
// text size utilities
7+
#bips-slide(title: "Text Sizes")[
8+
#huge[Huge text.] \
9+
#large[Large text.] \
10+
Normal text. \
11+
#small[Small text.] \
12+
#tiny[Tiny text.]
1113
]
1214

1315
// compact spacing

theme.typ

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#let font-size-small = 14pt
4545

4646
#let font-size-tiny = 12pt
47+
#let font-size-large = 22pt
48+
#let font-size-huge = 26pt
4749

4850
// Regular heading styling
4951
#let font-size-heading-1 = 20pt
@@ -54,8 +56,8 @@
5456
#let font-color-heading-2 = bips-blue
5557
#let font-weight-heading-2 = "bold"
5658

57-
#let font-size-heading-3 = 17pt
58-
#let font-color-heading-3 = bips-blue
59+
#let font-size-heading-3 = 18pt
60+
#let font-color-heading-3 = bips-text-gray
5961
#let font-weight-heading-3 = "bold"
6062

6163
// Slide title and subtitle styling
@@ -153,6 +155,8 @@
153155
page-number: font-size-page-number,
154156
small: font-size-small,
155157
tiny: font-size-tiny,
158+
large: font-size-large,
159+
huge: font-size-huge,
156160
title-align: left,
157161
))
158162

@@ -162,6 +166,12 @@
162166
/// Render content at the smallest size (scales with base-size)
163167
#let tiny(body) = context text(size: _bips-sizes.get().tiny)[#body]
164168

169+
/// Render content at a larger size (scales with base-size)
170+
#let large(body) = context text(size: _bips-sizes.get().large)[#body]
171+
172+
/// Render content at the largest size (scales with base-size)
173+
#let huge(body) = context text(size: _bips-sizes.get().huge)[#body]
174+
165175
// ===================================================================
166176
// BACKGROUND UTILITY FUNCTIONS
167177
// ===================================================================
@@ -202,6 +212,8 @@
202212
heading-3-size: none,
203213
small-size: none,
204214
tiny-size: none,
215+
large-size: none,
216+
huge-size: none,
205217
page-number-size: none,
206218
code-block-scale: none,
207219
code-inline-scale: none,
@@ -216,22 +228,16 @@
216228
let effective-code-inline-scale = pick-first(
217229
code-inline-scale,
218230
font-scale-code-inline,
219-
)
220-
221-
// Resolve font families
231+
) // Resolve font families
222232
let effective-font = pick-first(font, font-family-text)
223233
let effective-code-font = pick-first(code-font, font-family-code)
224-
let effective-math-font = pick-first(math-font, font-family-math)
225-
226-
// Global text and styling configuration
234+
let effective-math-font = pick-first(math-font, font-family-math) // Global text and styling configuration
227235
show: set text(
228236
font: effective-font,
229237
size: effective-font-size-base,
230238
fill: font-color-base,
231239
)
232-
show math.equation: set text(font: effective-math-font)
233-
234-
// Heading styles use em-based defaults so they scale proportionally with base-size.
240+
show math.equation: set text(font: effective-math-font) // Heading styles use em-based defaults so they scale proportionally with base-size.
235241
// Explicit pt overrides take precedence over the em-based defaults.
236242
show heading.where(level: 1): set text(
237243
size: pick-first(heading-1-size, 1.11em),
@@ -247,9 +253,7 @@
247253
size: pick-first(heading-3-size, 0.89em),
248254
weight: font-weight-heading-3,
249255
fill: font-color-heading-3,
250-
)
251-
252-
// Publish effective sizes via state so slide functions can read them.
256+
) // Publish effective sizes via state so slide functions can read them.
253257
// Sizes that aren't overridden explicitly use the module-level defaults,
254258
// which means they don't auto-scale with base-size. Use em-based values
255259
// in the state to get proportional scaling where appropriate.
@@ -260,40 +264,30 @@
260264
page-number: pick-first(page-number-size, font-size-page-number),
261265
small: pick-first(small-size, font-size-small),
262266
tiny: pick-first(tiny-size, font-size-tiny),
267+
large: pick-first(large-size, font-size-large),
268+
huge: pick-first(huge-size, font-size-huge),
263269
title-align: title-align,
264-
))
265-
266-
// Emphasis (_text_) in BIPS blue (color only, no italic)
270+
)) // Emphasis (_text_) in BIPS blue (color only, no italic)
267271
show emph: it => text(
268272
fill: font-color-emphasis,
269273
style: "italic",
270274
weight: "regular",
271-
)[#it.body]
272-
273-
// Strong text (*text*) in BIPS blue (color only, no bold)
274-
show strong: it => text(fill: font-color-strong, weight: "bold")[#it.body]
275-
276-
// Links in BIPS blue with thin underline to distinguish from emphasis
277-
show link: it => underline(text(fill: bips-blue)[#it])
278-
279-
// Table styling - set elegant defaults
275+
)[#it.body] // Strong text (*text*) in BIPS blue (color only, no bold)
276+
show strong: it => text(fill: font-color-strong, weight: "bold")[#it.body] // Links in BIPS blue with thin underline to distinguish from emphasis
277+
show link: it => underline(text(fill: bips-blue)[#it]) // Table styling - set elegant defaults
280278
set table(
281279
stroke: none,
282280
fill: (_, y) => if y == 0 { bips-blue.lighten(85%) } else { none },
283281
inset: (x: 0.7em, y: 0.6em),
284-
)
285-
286-
// Add subtle borders around tables
282+
) // Add subtle borders around tables
287283
show table: it => block(
288284
stroke: (
289285
top: 1pt + bips-blue.lighten(50%),
290286
bottom: 1pt + bips-blue.lighten(50%),
291287
),
292288
inset: 0pt,
293289
it,
294-
)
295-
296-
// List styling with configurable spacing
290+
) // List styling with configurable spacing
297291
// Spacing uses `set` (not `show`) so users can override with local `#set list(spacing: ...)`
298292
set list(spacing: list-spacing)
299293
set enum(spacing: enum-spacing)
@@ -322,16 +316,12 @@
322316
show enum: set enum(spacing: 0.4em)
323317
show list: set list(spacing: 0.4em)
324318
it
325-
}
326-
327-
// Code styling - Fira Mono pairs with Fira Sans for consistent metrics
319+
} // Code styling - Fira Mono pairs with Fira Sans for consistent metrics
328320
show raw: set text(font: effective-code-font)
329321
show raw.where(block: true): set text(size: effective-code-block-scale * 1em)
330322
show raw.where(block: false): set text(
331323
size: effective-code-inline-scale * 1em,
332-
)
333-
334-
// Use Touying's infrastructure with BIPS customizations
324+
) // Use Touying's infrastructure with BIPS customizations
335325
touying-slides(
336326
config-page(
337327
..utils.page-args-from-aspect-ratio(aspect-ratio),
@@ -959,8 +949,8 @@
959949
///
960950
/// Example: #compact[- Item A \ - Item B \ - Item C]
961951
#let compact(spacing: 0.4em, leading: 0.4em, body) = {
962-
set list(spacing: spacing)
963-
set enum(spacing: spacing)
952+
show list: set list(spacing: spacing)
953+
show enum: set enum(spacing: spacing)
964954
set par(leading: leading)
965955
show list: set text(top-edge: "cap-height", bottom-edge: "baseline")
966956
show enum: set text(top-edge: "cap-height", bottom-edge: "baseline")

0 commit comments

Comments
 (0)