Typst 0.15 contains multitudes
Typst 0.15 contains multitudes
Typst 0.15 包含万象
Between myriads of instances of the same font, multi-file output, multiple bibliographies, and support for more than one PDF standard at once, Typst 0.15 is all about multiplicity. 从同一字体的无数实例、多文件输出、多重参考文献,到同时支持多种 PDF 标准,Typst 0.15 的核心主题就是“多样性”。
Typst 0.15, our latest and largest release to date, brings long-desired support for variable fonts to Typst, pushes the experimental HTML export further with MathML and multi-file support, solidifies existing features like bibliography management and PDF standards support, and improves Typst in tons of other ways. Typst 0.15 是我们迄今为止最新且规模最大的版本。它为 Typst 带来了期待已久的可变字体(Variable Fonts)支持,通过 MathML 和多文件支持进一步推进了实验性的 HTML 导出功能,巩固了参考文献管理和 PDF 标准支持等现有功能,并在诸多方面对 Typst 进行了改进。
In this release cycle, we’ve also heavily invested into foundational systems to keep making Typst easier to adopt and use. In an effort to expand and improve our documentation, we’ve ported it to Typst and now also publish a print version of it. We’re also, for the first time, including a comprehensive migration guide in the changelog. 在本发布周期中,我们还投入了大量精力优化基础系统,以确保 Typst 更易于采用和使用。为了扩展和改进文档,我们已将其迁移至 Typst 编写,并现已发布打印版本。此外,我们首次在更新日志中包含了详尽的迁移指南。
On the compiler side, we’ve been working on clearer, more actionable diagnostics and hints (with the new introspection warnings being just one of them). And for future Typst releases, we’ve started work on even smoother upgrades through migration tooling and automatic compatibility behavior of packages. 在编译器方面,我们致力于提供更清晰、更具操作性的诊断信息和提示(新的内省警告只是其中之一)。针对未来的 Typst 版本,我们已开始着手通过迁移工具和包的自动兼容性行为,实现更平滑的升级体验。
Contents
目录
In this blog post, we’ll take a closer look at some of the highlights of this release: 在本篇博文中,我们将深入探讨此版本的一些亮点:
- Variable fonts (可变字体)
- MathML
- Bundle export (捆绑导出)
- Multiple bibliographies (多重参考文献)
- Multiple PDF standards at once (同时支持多种 PDF 标准)
- Layout convergence diagnostics (布局收敛诊断)
- Print version of the documentation (文档打印版本)
To get started with Typst 0.15…
如何开始使用 Typst 0.15……
…in the web app: Just open any of your projects! You’ll get a prompt offering you to upgrade to the latest version. ……在 Web 应用中: 只需打开你的任意项目!你将收到升级到最新版本的提示。
…on the command line: Run typst update in your terminal or, if you haven’t installed Typst previously, download the latest version of the CLI.
……在命令行中: 在终端运行 typst update;如果你之前未安装过 Typst,请下载最新版本的 CLI。
For a comprehensive overview of all changes in the release, visit the changelog. If you’re looking to upgrade your document to Typst 0.15, you can also skip ahead to its Migration guide. 如需查看本次发布的所有变更概览,请访问更新日志。如果你希望将文档升级至 Typst 0.15,也可以直接跳转至迁移指南。
Variable fonts
可变字体
Typefaces often come with different design variants suitable for different design elements in a document. A common baseline is to have four fonts in a family: A regular one, a bold one, an italic one, and a bold-italic one. Beyond this, many fonts ship with more weights, different stretches (also called widths), or variants intended for different point sizes. 字体通常带有不同的设计变体,以适应文档中的不同设计元素。最基础的配置通常是一个字体家族包含四种字形:常规体、粗体、斜体和粗斜体。除此之外,许多字体还提供更多的字重、不同的拉伸(也称为宽度)或针对不同字号设计的变体。
Classically, each of the variants comes in a different font file. This can easily lead to situations where a font family comes with a ton of files and yet it still lacks the exact desired variant. This is where variable fonts come in. They let font designers express glyph outlines and metrics in a parametric way, such that different weights, widths, and more can be derived from a single outline definition. 传统上,每种变体都对应一个独立的字体文件。这很容易导致一个字体家族包含大量文件,却依然缺少所需的特定变体。这时,可变字体(Variable Fonts)应运而生。它们允许字体设计师以参数化方式定义字形轮廓和度量,从而可以通过单一的轮廓定义衍生出不同的字重、宽度等属性。
The different tweakable parameters of a variable font are called variation axes. There are a few standard axes for classic design options like italics, slant, weight, stretch, and optical sizing (adjustments based on point size). Typst will automatically configure those based on the style, weight, stretch, and size parameters of the text function.
可变字体中可调节的参数被称为“变化轴”(Variation Axes)。针对斜体、倾斜度、字重、拉伸和光学尺寸(基于字号的调整)等经典设计选项,存在一些标准轴。Typst 会根据 text 函数的样式、字重、拉伸和尺寸参数自动配置这些轴。
(Code examples omitted for brevity) (代码示例略)
MathML
MathML
If you’ve already played around with Typst’s HTML export before, you might’ve noticed that it would just completely ignore equations. A pretty good workaround was available by using html.frame and rendering equations to SVG. However, this turns the equation inaccessible and unselectable.
如果你之前尝试过 Typst 的 HTML 导出功能,可能已经注意到它会完全忽略公式。虽然可以通过使用 html.frame 并将公式渲染为 SVG 来实现不错的变通,但这会导致公式无法被访问且不可选中。
With Typst 0.15, we’ve added native support for equations via MathML. MathML encodes an equation’s structure and semantics. MathML equations keep text selectable, can be read out aloud with a screen reader, and be rendered at high resolution by browsers. 在 Typst 0.15 中,我们通过 MathML 增加了对公式的原生支持。MathML 对公式的结构和语义进行了编码。MathML 公式保持了文本的可选性,可以被屏幕阅读器朗读,并能由浏览器进行高分辨率渲染。
MathML is supported across all major browsers, but the rendering quality varies somewhat. If absolute visual consistency is crucial for you, rendering to SVG may still prove more suitable, but otherwise, using the native MathML output is highly preferable as it makes your math accessible to more audiences. 所有主流浏览器都支持 MathML,但渲染质量略有差异。如果你对视觉一致性有极高要求,渲染为 SVG 可能仍然更合适;但在其他情况下,使用原生 MathML 输出是更好的选择,因为它能让更多受众访问你的数学内容。
Bundle export
捆绑导出
When we first released Typst, PDF was the only supported export format. In Typst 0.5, we added PNG export and in Typst 0.8 SVG export. Those two were still very close to PDF export in that they all hook in after Typst has fully laid out the document. Then, in Typst 0.13, we added experimental support for HTML export. This is a structurally very different output format, as it needs to hook in earlier, with layout being fully delegated to the browser. As of Typst 0.14, HTML export… 当我们首次发布 Typst 时,PDF 是唯一支持的导出格式。在 Typst 0.5 中,我们增加了 PNG 导出,并在 Typst 0.8 中增加了 SVG 导出。这两者与 PDF 导出非常相似,因为它们都是在 Typst 完成文档布局后介入的。随后,在 Typst 0.13 中,我们增加了对 HTML 导出的实验性支持。这是一种结构上截然不同的输出格式,因为它需要更早介入,并将布局完全委托给浏览器。从 Typst 0.14 开始,HTML 导出……