diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index 64c3545ece..bbb7de8df6 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -23,6 +23,7 @@ All changes included in 1.9: ### `typst` - ([#13362](https://github.com/quarto-dev/quarto-cli/issues/13362)): Remove unused `blockquote` definitions from template. +- ([#13474](https://github.com/quarto-dev/quarto-cli/issues/13474)): Heading font for title should default to `mainfont`. ## `publish` diff --git a/src/resources/filters/quarto-post/typst-brand-yaml.lua b/src/resources/filters/quarto-post/typst-brand-yaml.lua index 5c2cb3e00e..ba85556dca 100644 --- a/src/resources/filters/quarto-post/typst-brand-yaml.lua +++ b/src/resources/filters/quarto-post/typst-brand-yaml.lua @@ -329,7 +329,9 @@ function render_typst_brand_yaml() end meta.brand.typography = meta.brand.typography or {} local base = _quarto.modules.brand.get_typography(brandMode, 'base') - if base and next(base) then + if base and next(base) or meta['mainfont'] then + if not base then base = {} end + if meta['mainfont'] then base.family = inlinesToString(meta['mainfont']) end meta.brand.typography.base = { family = base.family and pandoc.RawInline('typst', _quarto.modules.typst.css.translate_font_family_list(base.family)), size = base.size, diff --git a/src/resources/formats/typst/pandoc/quarto/typst-show.typ b/src/resources/formats/typst/pandoc/quarto/typst-show.typ index bce5b33ee3..9044382e70 100644 --- a/src/resources/formats/typst/pandoc/quarto/typst-show.typ +++ b/src/resources/formats/typst/pandoc/quarto/typst-show.typ @@ -29,9 +29,7 @@ $if(abstract)$ abstract: [$abstract$], abstract-title: "$labels.abstract$", $endif$ -$if(mainfont)$ - font: ("$mainfont$",), -$elseif(brand.typography.base.family)$ +$if(brand.typography.base.family)$ font: $brand.typography.base.family$, $endif$ $if(fontsize)$ diff --git a/tests/docs/smoke-all/typst/brand-yaml/typography/basefont-typst.qmd b/tests/docs/smoke-all/typst/brand-yaml/typography/basefont-typst.qmd new file mode 100644 index 0000000000..9e3f5ee4ad --- /dev/null +++ b/tests/docs/smoke-all/typst/brand-yaml/typography/basefont-typst.qmd @@ -0,0 +1,22 @@ +--- +title: "Header logic" +format: + typst: + keep-typ: true +brand: + typography: + base: + family: Comic Sans MS +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - 'heading-family: \("Comic Sans MS",\)' +--- + +Some text. + +# Header logic so we have the same letters + +More text. \ No newline at end of file diff --git a/tests/docs/smoke-all/typst/brand-yaml/typography/mainfont-typst.qmd b/tests/docs/smoke-all/typst/brand-yaml/typography/mainfont-typst.qmd new file mode 100644 index 0000000000..037755d06a --- /dev/null +++ b/tests/docs/smoke-all/typst/brand-yaml/typography/mainfont-typst.qmd @@ -0,0 +1,19 @@ +--- +title: "Header logic" +format: + typst: + keep-typ: true +mainfont: Comic Sans MS +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - 'heading-family: \("Comic Sans MS",\)' +--- + +Some text. + +# Header logic so we have the same letters + +More text. \ No newline at end of file