Skip to content

Commit 7d69ece

Browse files
heading-family should default to mainfont in typst-brand-yaml.lua
fixes #13474
1 parent fbfe3aa commit 7d69ece

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ All changes included in 1.9:
2323
### `typst`
2424

2525
- ([#13362](https://github.com/quarto-dev/quarto-cli/issues/13362)): Remove unused `blockquote` definitions from template.
26+
- ([#13474](https://github.com/quarto-dev/quarto-cli/issues/13474)): Heading font for title should default to `mainfont`.
2627

2728
## `publish`
2829

src/resources/filters/quarto-post/typst-brand-yaml.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ function render_typst_brand_yaml()
329329
end
330330
meta.brand.typography = meta.brand.typography or {}
331331
local base = _quarto.modules.brand.get_typography(brandMode, 'base')
332-
if base and next(base) then
332+
if base and next(base) or meta['mainfont'] then
333+
if not base then base = {} end
334+
if meta['mainfont'] then base.family = inlinesToString(meta['mainfont']) end
333335
meta.brand.typography.base = {
334336
family = base.family and pandoc.RawInline('typst', _quarto.modules.typst.css.translate_font_family_list(base.family)),
335337
size = base.size,

src/resources/formats/typst/pandoc/quarto/typst-show.typ

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ $if(abstract)$
2929
abstract: [$abstract$],
3030
abstract-title: "$labels.abstract$",
3131
$endif$
32-
$if(mainfont)$
33-
font: ("$mainfont$",),
34-
$elseif(brand.typography.base.family)$
32+
$if(brand.typography.base.family)$
3533
font: $brand.typography.base.family$,
3634
$endif$
3735
$if(fontsize)$
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: "Header logic"
3+
format:
4+
typst:
5+
keep-typ: true
6+
brand:
7+
typography:
8+
base:
9+
family: Comic Sans MS
10+
_quarto:
11+
tests:
12+
typst:
13+
ensureTypstFileRegexMatches:
14+
-
15+
- 'heading-family: \("Comic Sans MS",\)'
16+
---
17+
18+
Some text.
19+
20+
# Header logic so we have the same letters
21+
22+
More text.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: "Header logic"
3+
format:
4+
typst:
5+
keep-typ: true
6+
mainfont: Comic Sans MS
7+
_quarto:
8+
tests:
9+
typst:
10+
ensureTypstFileRegexMatches:
11+
-
12+
- 'heading-family: \("Comic Sans MS",\)'
13+
---
14+
15+
Some text.
16+
17+
# Header logic so we have the same letters
18+
19+
More text.

0 commit comments

Comments
 (0)