Skip to content
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

Font module: Nested font in /usr/share/fonts/nerd-fonts and /usr/share/fonts/google-fonts not recognized by vscode running in distrobox #58

Closed
nhubaotruong opened this issue Oct 3, 2023 · 7 comments

Comments

@nhubaotruong
Copy link
Contributor

Hi, I'd like to report that nested font in /usr/share/fonts/nerd-fonts/* and /usr/share/fonts/google-fonts/* not recognized by vscode running in distrobox.

I tried to manual install the fonts using script modules, which only put the fonts in /usr/share/fonts/$font and it does get picked up

Ex: /usr/share/fonts/nerd-fonts/Meslo/* doesn't get picked up by vscode

/usr/share/fonts/Meslo/* does get picked up by vscode

@lucasvsr
Copy link
Contributor

lucasvsr commented Oct 4, 2023

This happens because distrobox does not see the fonts installed on the host. To do this, it is necessary to load the fonts that are in /run/host/usr/share/fonts, which is where the distrobox loads the fonts available on the host. Use the command fc-cache -f /run/host/usr/share/fonts

@nhubaotruong
Copy link
Contributor Author

Distrobox auto mounts the system font in /usr/local/share/fonts inside the container, I'm not sure why it didn't get picked up if the font is nested in 2 layers or more

@lucasvsr
Copy link
Contributor

lucasvsr commented Oct 4, 2023

I'm using version 1.5.0.2 of distrobox and it only mounts the following directories/files:

/tmp:/tmp
/var/home/:/var/home/
/:/run/host
/sys:/sys
/dev:/dev
/etc/hosts:/etc/hosts
/etc/resolv.conf:/etc/resolv.conf
/usr/bin/distrobox-host-exec:/usr/bin/distrobox-host-exec
/usr/bin/distrobox-export:/usr/bin/distrobox-export

But apparently, the problem is vscode. I tried to use a font that was in /run/host/usr/share/fonts and it didn't recognize it. When I used gnome-text-editor (installed in container) it worked.

It looks like the solution at the moment is what you implemented in the PR.

@nhubaotruong
Copy link
Contributor Author

I won't be at the computer for the next 4 days, please take your time to review if necessary

@nhubaotruong
Copy link
Contributor Author

nhubaotruong commented Oct 10, 2023

@lucasvsr Hi, I've been doing some testing on my machine for a few days, it seems that this situation was caused by fontconfig cache, which isn't compatible across many distros as mentioned here

A simple fix was just to run fc-cache -f in the distrobox container after adding the font module

I'll close this issue and the PR, thanks for your time

@nhubaotruong
Copy link
Contributor Author

Expanding on my explaination in case someone reads this thread.

Vscode installed in arch container are from aur, which uses the source from static build of vscode (.tar.gz file), which doesn't use system fontconfig, therefore it doesn't picked up the nested font like other applications.

Vscode installed in ubuntu container (deb) and fedora container (rpm) picks up the font just fine

@trevnels
Copy link

trevnels commented Jan 23, 2024

I'm currently seeing what I believe to be the same issue with a Fedora 39 host and Fedora 39 container, even after clearing the font cache. Even though the font is recognized by name through fc-match inside the distrobox, VSCode is still not able to use it.

rm -rf'ing ~/.cache/fontconfig does seem to fix it temporarily, but it regresses after a while. I'm wondering if this has to do with flatpak runtimes bumping fontconfig to 2.15 while Fedora and my distrobox are still on 2.14.2, and there's some incompatibility between the caches.

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 a pull request may close this issue.

3 participants