Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Add minimal fontconfig support #359

Merged
merged 8 commits into from
Nov 29, 2023
Merged

Conversation

PgBiel
Copy link
Contributor

@PgBiel PgBiel commented Nov 18, 2023

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 within fontdb.)

(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.

@PgBiel PgBiel mentioned this pull request Nov 19, 2023
9 tasks
@nvarner
Copy link
Owner

nvarner commented Nov 20, 2023

@PgBiel can you add the new feature to the native-tls steps in .github/workflows/checks.yml?

Otherwise (assuming checks pass), this looks good, thanks! I appreciate the documentation.

@PgBiel
Copy link
Contributor Author

PgBiel commented Nov 20, 2023

So, VSCode automatically removed trailing spaces in the workflow files, so I added that change in a separate commit. I updated checks.yml, and also saw that there was a test in full_build.yml that could perhaps use an update as well, so I changed it in a separate commit in case you think that's not appropriate and should be reverted (feel free).

@nvarner nvarner merged commit 7dce8bc into nvarner:master Nov 29, 2023
5 checks passed
@nvarner
Copy link
Owner

nvarner commented Nov 29, 2023

The formatting changes are fine. Thank you!

@PgBiel PgBiel deleted the fontconfig-fix branch November 29, 2023 20:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font lookup not working when compiling on save
2 participants