Repository navigation
Support variable fonts - #8425
Merged
Merged
Conversation
This was referenced Jun 4, 2026
laurmaedje
force-pushed
the
variable-fonts
branch
from
June 4, 2026 11:21
8ec9a6c to
9b13eab
Compare
isuffix
reviewed
Jun 5, 2026
isuffix
left a comment
Collaborator
There was a problem hiding this comment.
Thought I would peruse this just a bit and check with my clippy lint branch. I don't really know enough to judge the structure, but I did find some small syntax fixes.
Comment on lines
+230
to
+233
| /// _Note:_ If you want to strongly emphasize your text, you should do so | ||
| /// using the @strong[strong] function instead. This makes it easy to adapt | ||
| /// the style later if you change your mind about how to signify the strong | ||
| /// emphasis. |
Collaborator
There was a problem hiding this comment.
Perhaps we should open an issue for Note/Info/Warning callouts?
Member
Author
There was a problem hiding this comment.
I'm not sure yet how visually notable I want those notes to be, but a component wouldn't hurt either way.
1 task done
laurmaedje
force-pushed
the
font-handling-refactors
branch
from
June 5, 2026 08:32
9ca38f9 to
38d9f43
Compare
laurmaedje
force-pushed
the
variable-fonts
branch
from
June 5, 2026 08:38
9b13eab to
492fe0a
Compare
This was necessary at some point because the used version of ttf-parser and rustybuzz were incompatible, but it's not necessary anymore.
Co-Authored-By: Jassiel Ovando <[email protected]> Co-Authored-By: Laurenz Stampfl <[email protected]>
laurmaedje
force-pushed
the
variable-fonts
branch
from
June 5, 2026 08:44
492fe0a to
ace3225
Compare
1 task done
ParaN3xus
added a commit
to ParaN3xus/typst.ts
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 10, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 10, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 10, 2026
ParaN3xus
added a commit
to ParaN3xus/typst.ts
that referenced
this pull request
Jun 10, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
Part of the Typst 0.15 cleanup stack. This slice covers text accessor, font metadata, color presentation, and viewer color-space API changes. ## Upstream Typst Changes - [`typst/typst#8393`](typst/typst#8393) changes syntax/source text access. Tinymist updates semantic tokens, analysis matchers, lint/debug instrumentation, query helpers, and AST utilities to use the new accessor style. - [`typst/typst#8425`](typst/typst#8425) adds font axis metadata. Tinymist initializes font axes and forwards them through document metrics and symbol glyph handling. - [`typst/typst#7629`](typst/typst#7629) changes color presentation behavior. Tinymist updates color presentation conversion and renderer color-space handling for the Typst 0.15 color APIs. ## Tinymist Changes - Updates text access in `tinymist-query`, `tinymist-analysis`, `tinymist-debug`, `tinymist-lint`, and AST-facing helpers. - Updates `tinymist-world` font metadata construction for the new axes field. - Updates document metrics and symbol glyph collection to preserve font axis information. - Updates `tinymist-query` color presentations for the revised Typst color API. - Updates viewer rendering color-space conversion so Typst 0.15 colors are mapped correctly before rendering. --------- Co-authored-by: paran3xus <[email protected]>
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/typst.ts
that referenced
this pull request
Jun 15, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/typst.ts
that referenced
this pull request
Jun 15, 2026
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
Part of the Typst 0.15 cleanup stack. This slice covers text accessor, font metadata, color presentation, and viewer color-space API changes. ## Upstream Typst Changes - [`typst/typst#8393`](typst/typst#8393) changes syntax/source text access. Tinymist updates semantic tokens, analysis matchers, lint/debug instrumentation, query helpers, and AST utilities to use the new accessor style. - [`typst/typst#8425`](typst/typst#8425) adds font axis metadata. Tinymist initializes font axes and forwards them through document metrics and symbol glyph handling. - [`typst/typst#7629`](typst/typst#7629) changes color presentation behavior. Tinymist updates color presentation conversion and renderer color-space handling for the Typst 0.15 color APIs. ## Tinymist Changes - Updates text access in `tinymist-query`, `tinymist-analysis`, `tinymist-debug`, `tinymist-lint`, and AST-facing helpers. - Updates `tinymist-world` font metadata construction for the new axes field. - Updates document metrics and symbol glyph collection to preserve font axis information. - Updates `tinymist-query` color presentations for the revised Typst color API. - Updates viewer rendering color-space conversion so Typst 0.15 colors are mapped correctly before rendering. --------- Co-authored-by: paran3xus <[email protected]>
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
Part of the Typst 0.15 cleanup stack. This slice covers text accessor, font metadata, color presentation, and viewer color-space API changes. ## Upstream Typst Changes - [`typst/typst#8393`](typst/typst#8393) changes syntax/source text access. Tinymist updates semantic tokens, analysis matchers, lint/debug instrumentation, query helpers, and AST utilities to use the new accessor style. - [`typst/typst#8425`](typst/typst#8425) adds font axis metadata. Tinymist initializes font axes and forwards them through document metrics and symbol glyph handling. - [`typst/typst#7629`](typst/typst#7629) changes color presentation behavior. Tinymist updates color presentation conversion and renderer color-space handling for the Typst 0.15 color APIs. ## Tinymist Changes - Updates text access in `tinymist-query`, `tinymist-analysis`, `tinymist-debug`, `tinymist-lint`, and AST-facing helpers. - Updates `tinymist-world` font metadata construction for the new axes field. - Updates document metrics and symbol glyph collection to preserve font axis information. - Updates `tinymist-query` color presentations for the revised Typst color API. - Updates viewer rendering color-space conversion so Typst 0.15 colors are mapped correctly before rendering. --------- Co-authored-by: paran3xus <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for variable fonts to Typst. It is based on prior work in #8240 and #6771, but in the end I made some deeper structural changes, so I've opened a new PR.
User-facing changes
Typst now correctly recognizes variable fonts and considers their variant coverage for the purposes of font selection.
For a selected font, it automatically configures the
ital,slnt,wght,wdth, andopszaxes based ontext.style,text.weight,text.stretch, andtext.size.Font variations can be explicitly configured via
text.variations. When one of the well-known axes is specified, it takes precedence over the automatically selected value.Usage of variable fonts in SVG is likewise supported, including optical sizing.
Variable font and axis information is now visible in font summaries for IDE tooling, e.g. in autocomplete and tooltips. For example, the summary for Fraunces could read "Variable. Weight 100–900. Has italics. Supports optical sizing. SOFT 0–100. WONK 0–1."
typst fontslikewise lists variable font information. Its output is generally revamped for improved readability.Example output of typst fonts
Implementation considerations
The
Fonttype was split intoFontandFontInstance. The former represents a (potentially variable) font without variation coordinates while the latter represents a font with known variation values. Only the latter provides access to any kind of metrics that depend on variations, ensuring that a font is always instantiated before we try to read metrics.Font selection takes into account variation axes, but is still only based on
style,weight, andstretch, not on point size or custom variations. Technically, it could be expanded, but I don't think this is practically very relevant for variable fonts (e.g. having two different font files with different optical size coverage). For static fonts, optical-size based selection would be nice, but out of scope for this PR. In Add variable font support #8240, the same amount of information was taken into account, butbook.select's signature was changed because selection and instantiation happened in one step. Due to theFont/FontInstancesplit,book.select's signature remains unchanged in this PR.The
FontInfostruct now contains metadata about all variation axes in a font. This design is a bit more generic than the one in Add variable font support #8240 and Add initial support for variable fonts #6771 and allows us to (a) potentially expand font selection to include more axis information and (b) is useful metadata for things like IDE tooling.I've fixed a few bugs / missing features with variable fonts in dependencies:
krilla-svgLaurenzV/krilla#402The krilla change has not yet landed, so this PR is blocked on that.The SVG hashes have all changed because
FontInstancehashes differently than the oldFont. In Add variable font support #8240, this was resolved by avoiding hashing empty variations, but I think this could technically lead to hash collisions on types like&[FontInstance], so I've avoided this and just accepted the ref changes.