四开:如何使用自定义(网络)字体?

bal*_*lin 8 html css quarto

我正在尝试获取地面的四开主页,其中一个要求是自定义字体(免费网络字体; Tex-Gyre-Adventor)。

按照文档,我在各种迭代中使用了html特定于格式的mainfont标签(请参见下面的标题示例),但无法使这项工作正常工作 - 包括字体是否另外定义为 in @font-facestyle.css以及许多其他尝试)。

谁能指出如何使用mainfont非标准字体的正确方向?

感谢您的指点!

---
title: "Page"
title-block-banner: false
format:
  html:
    theme: vapor
    mainfont: `https://fontlibrary.org/en/font/tex-gyre-adventor`
    code-fold: true
    toc: false
    number-sections: false
link-citations: yes
---
Run Code Online (Sandbox Code Playgroud)

sha*_*fee 5

要使用自定义 webfont 作为mainfont,只需在文档标题中添加字体样式表文件header-includes,并在 yaml 键中设置字体名称mainfont

---
title: "Page"
title-block-banner: false
format:
  html:
    theme: vapor
    code-fold: true
    toc: false
    number-sections: false
    header-includes: |
      <link rel="stylesheet" media="screen" href="https://fontlibrary.org//face/tex-gyre-adventor" type="text/css"/>
link-citations: yes
mainfont: TeXGyreAdventorRegular
---

## Quarto

Quarto enables you to weave together content and executable code into a
finished document. To learn more about Quarto see <https://quarto.org>.

## Running Code

When you click the **Render** button a document will be generated that
includes both content and the output of embedded code. You can embed 
code like this:

```{r}
1 + 1
```

Run Code Online (Sandbox Code Playgroud)

带有自定义网页字体的 HTML 页面