This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
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 intends to bring the upstream fixes for fontconfig support, in typst/typst#2472, to the Typst LSP. This is necessary for proper font lookup support on NixOS, and is done by using the
fontdb
package to search for fonts. I also added a feature to toggle fontconfig support (and thus revert to the old behavior) if necessary (in case some Linux distribution isn't compatible with it or something).Fixes #358.
Note: This does not seem to work perfectly when using VSCode through Flatpak together with NixOS' Home Manager, but setting the environment variable
FONTCONFIG_FILE
to point to the relevant.conf
file (e.g.FONTCONFIG_FILE="/home/username/.config/fontconfig/conf.d/10-hm-fonts.conf"
) seems to fix it. (When using VSCode outside Flatpak, that is not at all necessary, as long as this PR's patches are applied. Note that such behavior is not the LSP's fault; it appears to just be a limitation withinfontdb
.)(Edit: possibly relevant upstream issue: RazrFalcon/fontdb#59)
I added a note about this to the README. Ideally, we'd have support for custom font paths as an option in the LSP itself to remedy this in a more general manner, but this will suffice for now.