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

nixos/fontconfig: Fix compatibility with unstable apps #97441

Merged
merged 1 commit into from Sep 8, 2020

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Sep 8, 2020

Fontconfig 2.14 from unstable reverted back to using /etc/fonts/fonts.conf
for its configuration. Unfortunately, on NixOS 20.03, this still points
to configuration for Fontconfig 2.10, with cache version 3.

When an app linked against Fontconfig 2.14 reads the config and does not
find a compatible cache, it writes a new cache entries to ~/.cache/fontconfig.
Unfortunately, the fontconfig 2.14 uses the same cache version as 2.12 in 20.03 (7)
so when the apps from 20.03 later read the cache, they cannot make much sense
of it and are unable to find any fonts.

I added a new fonts.fontconfig.disableVersionedFontConfiguration option, which,
when enabled, makes /etc/fonts/fonts.conf point to the configuration file
for the latest fontconfig, instead of the ancient 2.10 version.
This is necessary to prevent packages from Nixpkgs unstable breaking apps
from 20.03.

Enabling this should not cause any issues as there are no programs
using the legacy fontconfig version since NixOS 15.03.

Unfortunately, if a person already ran an app from unstable
before applying this patch, they will need to delete ~/.cache/fontconfig manually.

Closes: #97418
cc @worldofpeace @samueldr

Fontconfig 2.14 from unstable reverted back to using /etc/fonts/fonts.conf
for its configuration. Unfortunately, on NixOS 20.03, this still points
to configuration for Fontconfig 2.10, with cache version 3.

When an app linked against Fontconfig 2.14 reads the config and does not
find a compatible cache, it writes a new cache entries to ~/.cache/fontconfig.
Unfortunately, the fontconfig 2.14 uses the same cache version as 2.12 in 20.03 (7)
so when the apps from 20.03 later read the cache, they cannot make much sense
of it and are unable to find any fonts.

I added a new fonts.fontconfig.disableVersionedFontConfiguration option, which,
when enabled, makes /etc/fonts/fonts.conf point to the configuration file
for the latest fontconfig, instead of the ancient 2.10 version.
This is necessary to prevent packages from Nixpkgs unstable breaking apps
from 20.03.

Enabling this should not cause any issues as there are no programs
using the legacy fontconfig version since NixOS 15.03.

Unfortunately, if a person already ran an app from unstable
before applying this patch, they will need to delete ~/.cache/fontconfig manually.
@jtojnar
Copy link
Contributor Author

jtojnar commented Sep 8, 2020

I confirmed in 20.03 VM with this patch, that running piper from unstable no longer creates the cache in user's profile. (And running it with FONTCONFIG_FILE=/etc/fonts/2.10/fonts.conf still does.)

Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially stumbled upon this yesterday. Can confirm that this patch fixes the issue.

@Ma27 Ma27 merged commit 5dd6ab5 into NixOS:release-20.03 Sep 8, 2020
Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post commit I am approving 👍 thanks.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/all-fonts-suddenly-inaccessible/8994/2

@jtojnar jtojnar deleted the drop-fc-210-conf branch September 14, 2020 09:31
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixos-unusable-no-fonts-displayed-freedesktop-fontconfig-warning-fcpattern-object-weight-does-not-accept-value-50-200/9077/11

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-can-i-fix-my-broken-gtk-fonts/10358/6

@xuguojun168
Copy link

I have met the same problem when I run pywebio with deepin-linux.
Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
Option 'sandbox' is unknown. Ignoring.
It is too big bug.

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

Successfully merging this pull request may close these issues.

None yet

5 participants