Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/changelog-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ All changes included in 1.9:
- ([#13555](https://github.com/quarto-dev/quarto-cli/issues/13555)): Add support for `icon=false` in callouts when used in `format: typst`.
- ([#13589](https://github.com/quarto-dev/quarto-cli/issues/13589)): Fix callouts with invalid ID prefixes crashing with "attempt to index a nil value". Callouts with unknown reference types now render as non-crossreferenceable callouts with a warning, ignoring the invalid ID.
- ([#13602](https://github.com/quarto-dev/quarto-cli/issues/13602)): Fix support for multiple files set in `bibliography` field in `biblio.typ` template partial.
- ([#13745](https://github.com/quarto-dev/quarto-cli/issues/13745)): Fix relative `font-paths` from extensions or document metadata not resolving correctly for Typst compilation. Relative paths are now resolved against the document directory before being passed to the Typst CLI.
- ([#13775](https://github.com/quarto-dev/quarto-cli/issues/13775)): Fix brand fonts not being applied when using `citeproc: true` with Typst format. Format detection now properly handles Pandoc format variants like `typst-citations`.
- ([#13868](https://github.com/quarto-dev/quarto-cli/issues/13868)): Add image alt text support for PDF/UA accessibility. Alt text from markdown captions and explicit `alt` attributes is now passed to Typst's `image()` function. (Temporary workaround until [jgm/pandoc#11394](https://github.com/jgm/pandoc/pull/11394) is merged.)
- ([#13249](https://github.com/quarto-dev/quarto-cli/pull/13249)): Update to Pandoc's Typst template following Pandoc 3.8.3 and Typst 0.14.2 support:
Expand Down
13 changes: 11 additions & 2 deletions src/command/render/output-typst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
* Copyright (C) 2020-2022 Posit Software, PBC
*/

import { dirname, join, normalize, relative } from "../../deno_ral/path.ts";
import {
dirname,
isAbsolute,
join,
normalize,
relative,
resolve,
} from "../../deno_ral/path.ts";
import {
copySync,
ensureDirSync,
Expand Down Expand Up @@ -146,7 +153,9 @@ export function typstPdfOutputRecipe(
const pdfOutput = join(inputDir, inputStem + ".pdf");
const typstOptions: TypstCompileOptions = {
quiet: options.flags?.quiet,
fontPaths: asArray(format.metadata?.[kFontPaths]) as string[],
fontPaths: (asArray(format.metadata?.[kFontPaths]) as string[]).map(
(p) => isAbsolute(p) ? p : resolve(inputDir, p),
),
pdfStandard: normalizePdfStandardForTypst(
asArray(
format.render?.[kPdfStandard] ?? format.metadata?.[kPdfStandard],
Expand Down
12 changes: 9 additions & 3 deletions src/command/render/pandoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
* Copyright (C) 2020-2022 Posit Software, PBC
*/

import { basename, dirname, isAbsolute, join } from "../../deno_ral/path.ts";
import {
basename,
dirname,
isAbsolute,
join,
resolve,
} from "../../deno_ral/path.ts";

import { info, warning } from "../../deno_ral/log.ts";

Expand Down Expand Up @@ -99,7 +105,6 @@ import {
kFormatResources,
kFrom,
kHighlightStyle,
kSyntaxHighlighting,
kHtmlMathMethod,
kIncludeAfterBody,
kIncludeBeforeBody,
Expand All @@ -125,6 +130,7 @@ import {
kSectionTitleAbstract,
kSelfContained,
kSyntaxDefinitions,
kSyntaxHighlighting,
kTemplate,
kTheme,
kTitle,
Expand Down Expand Up @@ -1529,7 +1535,7 @@ async function resolveExtras(
const font = Zod.BrandFontFile.parse(_font);
for (const file of font.files || []) {
const path = typeof file === "object" ? file.path : file;
fontdirs.add(dirname(join(brand.brandDir, path)));
fontdirs.add(resolve(dirname(join(brand.brandDir, path))));
}
} else if (source === "bunny") {
const font = Zod.BrandFontBunny.parse(_font);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.quarto/
**/*.quarto_ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project:
type: default
brand: branding/brand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
typography:
fonts:
- family: "Amaranth"
source: file
files:
- fonts/Amaranth-Regular.ttf
base:
family: Amaranth
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Brand font-paths from subdirectory"
format: typst
include-in-header:
text: |
#set text(fallback: false)
_quarto:
tests:
typst:
printsMessage:
level: INFO
regex: 'warning: unknown font family'
negate: true
---

```{=typst}
#set text(font: "Amaranth")
Testing brand font-paths from a subdirectory.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.quarto/
**/*.quarto_ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Font Provider Extension
author: Test
version: 1.0.0
quarto-required: ">=99.9.0"
contributes:
formats:
typst:
font-paths:
- fonts
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project:
type: default
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Extension font-paths from subdirectory"
format: font-provider-typst
include-in-header:
text: |
#set text(fallback: false)
_quarto:
tests:
font-provider-typst:
printsMessage:
level: INFO
regex: 'warning: unknown font family'
negate: true
---

```{=typst}
#set text(font: "Amaranth")
Testing extension font-paths from a subdirectory.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.quarto/
**/*.quarto_ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project:
type: default
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Document font-paths from subdirectory"
format:
typst:
font-paths:
- ../fonts
include-in-header:
text: |
#set text(fallback: false)
_quarto:
tests:
typst:
printsMessage:
level: INFO
regex: 'warning: unknown font family'
negate: true
---

```{=typst}
#set text(font: "Amaranth")
Testing document font-paths from a subdirectory.
```
Loading