Skip to content

[WIP] Use fontdb to search fonts, with basic fontconfig support - #2472

Merged
laurmaedje merged 3 commits into
typst:mainfrom
7sDream:cli/fontdb
Oct 25, 2023
Merged

laurmaedje merged 3 commits into
typst:mainfrom
7sDream:cli/fontdb

Conversation

@7sDream

@7sDream 7sDream commented Oct 23, 2023

Copy link
Copy Markdown
Contributor

According to discuss in #100, this PR use fontdb to repalce the home-made font searcher in cli.

This is not expected to bring about big changes. Except in Linux, fontdb will try to find config file of fontconfig, parse it(using fontconfig-parser) and load dirs configured in those file.

Notice that fontconfig-parser is not a binding to the fontconfig C lib, but just a parser. So the specific behavior may be inconsistent with using the fontconfig program, which is expected.

@laurmaedje

Copy link
Copy Markdown
Member

As expected it does a little more and duplicate work, which degraded performance a little on my system (~8%), but that's not the end of the world. Fundamentally, scanning a bunch of directories for fonts and collecting their metadata is just a slow process. Would be nice to either use system APIs (hard to get the right metadata) or somehow cache this process in the future. But this is already a good improvement on Linux.

@laurmaedje
laurmaedje merged commit b80382b into typst:main Oct 25, 2023
@laurmaedje

Copy link
Copy Markdown
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants