Skip to content

Variants fonts from same family can be selected using Typst Brand YAML #13548

Open

Description

@jimjam-slam

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

I'm having trouble using a specific font, IBM Plex Sans Condensed, with Quarto and Typst. IBM Plex Sans does work. When going through the Quarto docs on missing fonts with Brand YAML, I note that some fonts might require a different name — that's definitely possible! "IBM Plex Sans Condensed" is how it appears to both R and my font book, so I'm not sure how I might vary it.

Steps to reproduce

---
title: Typst font test
format: typst
brand:
  typography:
    fonts:
      - family: IBM Plex Sans
        source: google
      - family: IBM Plex Sans Condensed
        source: google
    base: IBM Plex Sans
    headings: IBM Plex Sans Condensed
---

Ahoy there! This body renders fine with IBM Plex Sans. The heading falls back, though.

Actual behavior

The body renders successfully, but headings fall back to Libertinus following an error from Quarto and Typst:

pandoc 
  to: typst
  output-file: test.typ
  standalone: true
  shift-heading-level-by: -1
  default-image-extension: svg
  wrap: none
  citeproc: false
  variables: {}
  
metadata
  title: Typst font test
  brand:
    typography:
      fonts:
        - family: IBM Plex Sans
          source: google
        - family: IBM Plex Sans Condensed
          source: google
      base: IBM Plex Sans
      headings: IBM Plex Sans Condensed
  
[typst]: Compiling test.typ to test.pdf...warning: unknown font family: ibm plex sans condensed
    ┌─ test.typ:277:30
    │
277 │ #show heading: set text(font: ("IBM Plex Sans Condensed",), )
    │                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unknown font family: ibm plex sans condensed
    ┌─ test.typ:206:23
    │
206 │         set text(font: heading-family, weight: heading-weight, style: heading-style, fill: heading-color)
    │                        ^^^^^^^^^^^^^^

DONE

Output created: test.pdf

Checking the Quarto Typst font cache reveals that the Condensed version is not downloaded:

quarto typst fonts --variants --ignore-system-fonts --font-path .quarto/typst-font-cache/
DejaVu Sans Mono
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
IBM Plex Sans
- Style: Normal, Weight: 400, Stretch: FontStretch(750)
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
Libertinus Serif
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Italic, Weight: 700, Stretch: FontStretch(1000)
- Style: Normal, Weight: 600, Stretch: FontStretch(1000)
- Style: Italic, Weight: 600, Stretch: FontStretch(1000)
New Computer Modern
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Italic, Weight: 700, Stretch: FontStretch(1000)
New Computer Modern Math
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Normal, Weight: 450, Stretch: FontStretch(1000)
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)

I have the condensed and regular versions installed on my system too, but if I just run quarto typst fonts, only the regular version (IBM Plex Sans) appears there. (R picks the Condensed version fine up, though; if I add an R figure to my Typst doc, I can use the Condensed font with systemfonts).

Downloading the TTFs from Google Fonts and specifying them directly produces the same result:

brand:
  typography:
    fonts:
      - family: IBM Plex Sans
        source: google
      - family: IBM Plex Sans Condensed
        source: file
        files:
          - path: fonts/IBMPlexSansCondensed-SemiBold.ttf

Expected behavior

Headings should render in IBM Plex Sans Condensed.

Your environment

  • IDE: VSCode 1.104.3
  • OS: macOS 26.0.1

Quarto check output

quarto check
Quarto 99.9.9
[✓] Checking environment information...
      Quarto cache location: /Users/jimjamslam/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      NOTE: Deno version 2.4.5 does not strictly match 2.3.1 and strict checking is enabled. Please use 2.3.1.
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: c9c36f0add0d41a3a23b5cdcd21b407343dc6bca
      Path: /Users/jimjamslam/code/tools/quarto-cli/package/dist/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.13.5
      Path: /opt/homebrew/opt/[email protected]/bin/python3.13
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.5.1
      Path: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources
      LibPaths:
        - /Users/jimjamslam/Library/R/arm64/4.5/library
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: 1.50
      rmarkdown: 2.30

[✓] Checking Knitr engine render......OK

Activity

  1. added
    bug
    on Oct 14, 2025
  2. mcanouil commented on Oct 14, 2025

    @mcanouil
    Collaborator

    I think you issue is a duplicate of the real issue:

  3. cderv commented on Oct 14, 2025

    @cderv
    Member

    Checking the Quarto Typst font cache reveals that the Condensed version is not downloaded

    I believe the font is downloaded. Look into your .quarto/typst-font-cache folder

    > fs::dir_tree('.quarto/typst-font-cache', recurse = TRUE)
    .quarto/typst-font-cache
    └── fonts.gstatic.com
        └── s
            ├── ibmplexsans
            │   └── v23
            │       └── zYXGKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1swZSAXcomDVmadSD6llDB6g9.ttf
            └── ibmplexsanscondensed
                └── v15
                    └── Gg8lN4UfRSqiPg7Jn2ZI12V4DCEwkj1E4LVeHYapyKs.ttf

    However, quarto typst fonts does not report it, which is a Typst issue. And related to #11947 as mentioned.

    Though @gordonwoodhull did go through all the font, and I don't see this one in the list. So maybe this is different issue.

    What I can observe is that if you use only the condensed font

    brand:
      typography:
        fonts:
          - family: IBM Plex Sans Condensed
            source: google
        base: IBM Plex Sans Condensed
        headings: IBM Plex Sans Condensed

    and remove the .quarto/typst-font-cache folder before re-rendering then, the condensed font is downloaded, but seen by typst with same name as the non condensed

    > fs::dir_tree(".quarto/typst-font-cache/", recurse = TRUE)
    .quarto/typst-font-cache/
    └── fonts.gstatic.com
        └── s
            └── ibmplexsanscondensed
                └── v15
                    └── Gg8lN4UfRSqiPg7Jn2ZI12V4DCEwkj1E4LVeHYapyKs.ttf
    ❯ quarto typst fonts --ignore-system-fonts --font-path .quarto/typst-font-cache/
    DejaVu Sans Mono
    IBM Plex Sans
    Libertinus Serif
    New Computer Modern
    New Computer Modern Math

    It is possibly related to this Typst issue: typst/typst#2098 (comment)

    Condensed fonts are variants: so it seems Typst does not see them with name, but triage under font weight.

    Here is only with Condensed font downloaded

    ❯ quarto typst fonts --ignore-system-fonts --font-path .quarto/typst-font-cache/ --variants
    (... other fonts ...)
    IBM Plex Sans
    - Style: Normal, Weight: 400, Stretch: FontStretch(750)
    (... other fonts ...)
    

    and now with only non-condensed font downloaded in cache

    ❯ quarto typst fonts --ignore-system-fonts --font-path .quarto/typst-font-cache/ --variants
    (... other fonts ...)
    IBM Plex Sans
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    (... other fonts ...)
    

    They are exactly stored under the same weight, but different FontStretch. When both are downloaded

    ❯ quarto typst fonts --ignore-system-fonts --font-path .quarto/typst-font-cache/ --variants
    (... other fonts ...)
    IBM Plex Sans
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(750)
    (... other fonts ...)
    

    So I believe this is related to

    They need to offer a way to specify name differently so you can reference this specific font directly.

    In the meantime, if license permits, you could try to modify the .ttf file to change family name maybe 🤷‍♂️

    I tried using a different font-weight for the Condensed that would allow typst to select the condensed, but it does not seem to work

  4. changed the title [-]Google font not retrieved by Typst Brand YAML[/-] [+]Variants fonts from same family can be selected using Typst Brand YAML[/+] on Oct 14, 2025
  5. added
    upstream
    on Oct 14, 2025
  6. gordonwoodhull commented on Oct 14, 2025

    @gordonwoodhull
    Member

    This is an interesting subcase of #11947. The list I provided in a comment there is only the fonts where the font name recognized by Typst is not a prefix of the font name you request from Google.

    In this case you can do

    brand:
      typography:
        fonts:
          - family: IBM Plex Sans Condensed
            source: google
        base: IBM Plex Sans
        headings: IBM Plex Sans

    and you'll get the condensed font only. But Typst does not provide any way to distinguish this from the actual IBM Plex Sans, so you can't have both fonts.

    I classified these as "false positives" in my initial analysis, but it might be worth going back and improving the methodology to detect where multiple Google font family names map to the same Typst font family name.

    We've discussed this with the Typst folks, and they are aware that their heuristics for prettifying font family names make it difficult or impossible to select some fonts. I'm not sure if there's anything we can do in Quarto to work around this.

  7. jimjam-slam commented on Oct 15, 2025

    @jimjam-slam
    Author

    Interesting! Can confirm that actually checking the font cache folder shows that the condensed variant is actually downloaded (even though the command doesn't report it).

    They are exactly stored under the same weight, but different FontStretch. When both are downloaded

    Based on this, my workaround now (which is working) is to specify the condensed font in brand.yml's font sources (brand.typography.fonts) so that it gets downloaded, but then override headings on the Typst side by referring to the non-condensed version and adding stretch:

    format:
      typst:
        include-in-header:
          text: |
            #show heading: set text(font: "IBM Plex Sans", stretch: 70%)
    brand:
      typography:
        fonts:
          - family: IBM Plex Sans
            source: google
          - family: IBM Plex Sans Condensed
            source: google
        base: IBM Plex Sans

    It doesn't appear to work for the document title in the YAML, but it does work for headings. (I'm still a little slow on the Typst side, so I daresay there's a way to separately override that. But I'm dynamically generating headings for my present use case, is I'm not too fussed.)

    One other future workaround (for my particular case) might be if Typst implements variable font support — IBM Plex Sans has both width and weight axes in its variable font. That's obviously a substantial piece of work, though.

    Issue: typst/typst#185
    PR: typst/typst#6771

  8. gordonwoodhull commented on Oct 15, 2025

    @gordonwoodhull
    Member

    It doesn't appear to work for the document title in the YAML, but it does work for headings.

    Nod, the title is not a heading in the Pandoc template, and we chose not to deviate from that, even though we are applying font, weight and color as if it were a heading.

    Typst is getting a title element in 0.14 so maybe there’s a chance to clean this up when the new element percolates through the Pandoc template.

  9. jimjam-slam commented on Oct 15, 2025

    @jimjam-slam
    Author

    Nice! Ahh yeah, I had a look at the Typst template and can see it would be difficult for an external user to target without replacing the template wholesale:

    (I can also understand why you'd choose not to make it a heading, especially if you're feeding headings into things like a table of contents!)

    No stress — will see what Typst turns up in the future!

  10. gordonwoodhull commented on Oct 17, 2025

    @gordonwoodhull
    Member

    After looking into this further, what you describe as a workaround is Typst's intended behavior. If the font's stretch metadata is correct, you can select the variant of the font using stretch, and the same goes for weight and style. Typst trims known suffixes in these three categories

    In that light, your final brand.yml makes sense. It's not format-agnostic because HTML uses variable fonts and doesn't need the second font resource, but it should work.

    So the questions become:

    1. should we detect font problems like the original one and emit a more useful error (or even warn and correct it)
    2. should brand.yml implement stretch?
  11. cderv commented on Oct 17, 2025

    @cderv
    Member

    should brand.yml implement stretch?

    It seems this would solve the issue for Typst right ? Is this too specific to support stretch for fonts ?

  12. added this to the Future milestone on Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugtypstupstream

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions