Skip to content

typst css: don't wear out the "unknown font family" warning #12556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gordonwoodhull opened this issue Apr 15, 2025 · 2 comments
Open

typst css: don't wear out the "unknown font family" warning #12556

gordonwoodhull opened this issue Apr 15, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request typst
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

gordonwoodhull commented Apr 15, 2025

It's very helpful that Typst now warns about unknown fonts as of 1.12. However, it can be alarming / unhelpful for our use case.

In particular, it is a very different model from CSS font-family lists, which silently ignore missing fonts.

We can list what fonts are available for Typst with

quarto typst fonts

It takes about 5s on my Mac to list ~500 system fonts, but only 0.17s to list the 4 built-in fonts with

quarto typst fonts --ignore-system-fonts

So maybe with judicious use of --font-path and --ignore-system-paths we could quickly get a list of available fonts and then filter out the unavailable fonts when translating from CSS font-family lists to Typst font family lists.

We are already transforming these lists e.g #12542 font family lists, #11918 generic font families.

Related Typst issue: typst/typst#6010

@gordonwoodhull gordonwoodhull added this to the v1.8 milestone Apr 15, 2025
@gordonwoodhull gordonwoodhull self-assigned this Apr 15, 2025
@mcanouil mcanouil added the enhancement New feature or request label Apr 15, 2025
@cderv
Copy link
Collaborator

cderv commented Apr 16, 2025

It takes about 5s on my Mac to list ~500 system fonts, but only 0.17s to list the 4 built-in fonts with

FWIW if I call this on windows it is less that 1s for both: 0.865s and 0.553s . So acceptable

@cscheid
Copy link
Collaborator

cscheid commented Apr 16, 2025

We can also consider caching the result of these calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request typst
Projects
None yet
Development

No branches or pull requests

4 participants