You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for example, https://fonts.google.com/specimen/Bitter, if have the variable font version Bitter-VariableFont_wght.ttf installed, selecting font weight by #set text(font: "Bitter", weight: "medium") would still render the ExtraLight variant and setting other weight options would not change the font weight appeared in the PDF output anyway.
Reacted by snjågloe, Tesla Zhang, blluv, Oliver Schrenk, Marlon Regenhardt, Y.D.X., Val Packett, nitn3lav, Matthew Brown, John Bernard and 138 more
Reacted by Tiemen Schuijbroek, 呃呃, Yannik Tausch, Jonas Broeckmann, George-Vladut PIRCA, Juhan Oskar Hennoste, Allan, Brian Li and Cosmin Truta
#set text(font: "Quadraat Pro") selects Quadraat Pro Italic. I did not manage to get the Regular style. Names in the system are: Regular, Italic, Demibold, Demibold Italic, Bold, Bold Italic.
@laurmaedje I work on the Google Fonts team and I'm a big proponent for variable fonts. If you want any free consulting advice on this topic, please reach out to me or fonts@google.com :) I wrote a little about this for the Flutter team here
Reacted by Chad Skeeters, Alberto Fabbri, Ernesto Martínez García, Nemo, Juntong Chen, Derived Cat, memeplex, Alex Muirhead, Zeratoxx, anthoid and 43 more
Reacted by japanoise, Bastien Voirin, TANIGUCHI Masaya, Nikolaus Waxweiler, Dusty Pomerleau, shxxyz, Victor L., Benjamín Vicente, Qingyang Jiang, TechnicJelle and 23 more
We use our own subsetter, which should be at least on par with theirs (apart from the fact that we won't support CFF2 yet): https://github.com/typst/subsetter
Using theirs would require us to pull in all of allsorts in our dependency tree, which wouldn't be great considering that we are using the rustybuzz/ttf-parser font stack (and probably will switch to fontations in the future).
Just faced this issue with NixOS and the default VF.otf.ttc files for Noto CJK fonts, which produces tofu even though it says that the fonts were embedded (#5277). Had to manually download the static OTF fonts. #5304 would've made the debugging a breeze.
Today discovered that fira-code package also uses variable font, but I've been using it for months and didn't have any problem with it. So Typst does support it, but...a subset of it?
Here's a stop-gap solution I have while I wait for this feature to be implemented - fonttools has a built-in script called mutator, and you can use it to make static versions of fonts. For example:
Tested v0.15.0-rc.1 against a real project: a 323-page 6x9 trade paperback set in Libre Baskerville, five weights via text(weight:), bold skim-layer spans, italic chapter openers, and a custom top/bottom-edge line grid.
I'm picky about weights. Picky enough that on 0.14.2 we baked our own static instances out of the variable font with fonttools varLib.instancer, because only the default instance was readable. On rc.1 the system LibreBaskerville[wght].ttf just works: 400/500/600/700 and the italic all resolve from text(weight:) with no configuration.
The part worth reporting: the rendered geometry from runtime variable-font instancing is identical to our hand-baked static instances. We diffed full-book pdftotext bounding boxes and got zero differences, and the glyph-width fingerprints match exactly. We can delete the workaround entirely at stable.
Whole-book regression vs 0.14.2: body layout is page-for-page identical, all 77 chapter endings unchanged. The only difference we found was TOC dot-leader packing, consistent with the documented repeat weak/fractional spacing change.
We love this project. Deterministic plain-text layout at this typographic quality is something some of us have wanted for a very long time.
Reacted by Neil Girdhar, Jean, Cody Neiman, JL710, Matt Fellenz, Tobias Schmitz, Luke Hsiao, Kauê Hunnicutt Bazilli, Alexander, Laurenz and 16 more
Activity
owiecc commentedon Mar 24, 2023
Same here. With these fonts:
#set text(font: "Quadraat Pro")selects Quadraat Pro Italic. I did not manage to get the Regular style. Names in the system are: Regular, Italic, Demibold, Demibold Italic, Bold, Bold Italic.[-]Having trouble select weight for variable font[/-][+]Support variable fonts[/+]reknih commentedon Apr 4, 2023
Typst does not support variable fonts at the moment. They could be a good addition.
@owiecc This is an unrelated bug on normal font discovery. I will file a separate issue.
mattfbacon commentedon Aug 30, 2023
What is missing here? Is any current work addressing this?
laurmaedje commentedon Aug 30, 2023
There is no current work. Supporting variable fonts is a major effort. It needs large changes to the font handling and to the PDF export.
davelab6 commentedon Jul 29, 2024
@laurmaedje I work on the Google Fonts team and I'm a big proponent for variable fonts. If you want any free consulting advice on this topic, please reach out to me or fonts@google.com :) I wrote a little about this for the Flutter team here
laurmaedje commentedon Aug 4, 2024
@davelab6 Thanks for the offer! We'll get back to it when we start work on variable fonts.
davelab6 commentedon Aug 6, 2024
Zxilly commentedon Oct 22, 2024
Currently, could we consider throwing a warning when we need to parse variable fonts?
sonovice commentedon Nov 22, 2024
Variable font support was recently added to the allsorts rust lib: https://github.com/yeslogic/allsorts/releases/tag/v0.15.0
Since it also includes a font subsetter, it might come in handy for typst in that matter?
Example: https://github.com/yeslogic/allsorts-tools/blob/master/src/subset.rs
LaurenzV commentedon Nov 22, 2024
We use our own subsetter, which should be at least on par with theirs (apart from the fact that we won't support CFF2 yet): https://github.com/typst/subsetter
Using theirs would require us to pull in all of
allsortsin our dependency tree, which wouldn't be great considering that we are using the rustybuzz/ttf-parser font stack (and probably will switch to fontations in the future)..otf.ttcfonts get fully embedded, but PDF viewer only shows tofu #5954 as a duplicate of this issueAndrew15-5 commentedon Feb 25, 2025
Just faced this issue with NixOS and the default
VF.otf.ttcfiles for Noto CJK fonts, which produces tofu even though it says that the fonts were embedded (#5277). Had to manually download the static OTF fonts. #5304 would've made the debugging a breeze.#5954
Andrew15-5 commentedon Mar 30, 2025
Today discovered that
fira-codepackage also uses variable font, but I've been using it for months and didn't have any problem with it. So Typst does support it, but...a subset of it?FiraCode-VF.ttf.zip
japanoise commentedon May 20, 2025
Here's a stop-gap solution I have while I wait for this feature to be implemented - fonttools has a built-in script called mutator, and you can use it to make static versions of fonts. For example:
I have a script that will do that over a range of weights + italic/not italic: https://github.com/japanoise/font-mungers/blob/main/static_cut.sh
YDX-2147483647 commentedon May 20, 2025
FYI, I wrote a guide with explanation in 2023. It uses python, which might be easier for Windows users. See #2508.
ethanc8 commentedon Sep 2, 2025
Why does it not work to manually specify
wghtintext(features: ("wght": 700))?magistau commentedon Sep 3, 2025
Here's what I use to build static fonts with Nix:
madig commentedon Oct 26, 2025
You may want to use
fonttools varLib.instancerinstead,varLib.mutatoris deprecated.pwelty commentedon Jun 11, 2026
Tested v0.15.0-rc.1 against a real project: a 323-page 6x9 trade paperback set in Libre Baskerville, five weights via
text(weight:), bold skim-layer spans, italic chapter openers, and a custom top/bottom-edge line grid.I'm picky about weights. Picky enough that on 0.14.2 we baked our own static instances out of the variable font with
fonttools varLib.instancer, because only the default instance was readable. On rc.1 the systemLibreBaskerville[wght].ttfjust works: 400/500/600/700 and the italic all resolve fromtext(weight:)with no configuration.The part worth reporting: the rendered geometry from runtime variable-font instancing is identical to our hand-baked static instances. We diffed full-book pdftotext bounding boxes and got zero differences, and the glyph-width fingerprints match exactly. We can delete the workaround entirely at stable.
Whole-book regression vs 0.14.2: body layout is page-for-page identical, all 77 chapter endings unchanged. The only difference we found was TOC dot-leader packing, consistent with the documented
repeatweak/fractional spacing change.We love this project. Deterministic plain-text layout at this typographic quality is something some of us have wanted for a very long time.