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/steam: support using system fonts in Steam interface #302591

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

eclairevoyant
Copy link
Contributor

@eclairevoyant eclairevoyant commented Apr 8, 2024

Description of changes

Without this fix, all Chinese and Japanese text in the Steam interface display as boxes ("tofu").

As we use the existing fonts on the system, this avoids closure impact.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@eclairevoyant eclairevoyant added the 11.by: package-maintainer This PR was created by the maintainer of the package it changes label Apr 8, 2024
@ofborg ofborg bot requested review from jagajaga and jonringer April 8, 2024 15:20
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 11-100 labels Apr 8, 2024
@Aleksanaa
Copy link
Member

Is it able to pick up noto-fonts-cjk or source-han-sans (they are the same project but packaged by google and adobe)? Wenquanyi is quite aged imo

@eclairevoyant
Copy link
Contributor Author

In comparison, noto and source han have 62 and 111 MB respectively.
I guess this is because they are packaged as TTC files, which will include a lot of variants.
I already use Source Han Sans on my system, but for other users that may be a lot to ask in terms of closure size increase...

Does wenquanyi lack any code points that I didn't notice?
If so, maybe we can explore some way to create a "minimal" version of one of those packages.

@Aleksanaa
Copy link
Member

Does wenquanyi lack any code points that I didn't notice?

Not really. I did hear some people complain that it didn't look good, or didn't work well on their high-resolution screens. Not a big problem compared to closure size.

@eclairevoyant eclairevoyant marked this pull request as draft April 8, 2024 16:27
@Aleksanaa
Copy link
Member

Aleksanaa commented Apr 8, 2024

Also it seems that it is not completely impossible to load Chinese fonts. Some Chinese users reported that they were once able to load the system's Chinese fonts correctly, although some games were still missing fonts. But after recent update it's broken again. This problem may be caused by steam incompatible with variable fonts.

The workaround they mentioned earlier is consistent with the changes you made in this PR: adding (non-variable) Chinese fonts to extraPackages.

I don't currently have steam installed on my computer, so I'm sorry I can't help you.

CC @A1ca7raz @ocfox @yilozt @oxalica @LostAttractor for reporting font problems in NixOS Chinese group.

@eclairevoyant
Copy link
Contributor Author

I don't think it's a variable font issue necessarily; it did used to pick up my system fonts until a few weeks ago. Now, even adding wqy to the system fonts doesn't help.

Either way I will see if a minimal font package can be made, based on one of the newer projects.

@jonringer
Copy link
Contributor

Is it able to pick up noto-fonts-cjk or source-han-sans (they are the same project but packaged by google and adobe)? Wenquanyi is quite aged imo

32bit support is needed for a lot of this.... age is an awkward thing :)

@jonringer
Copy link
Contributor

I wonder if we could have the steam nixos module also pick up system fonts.... that seems like a more scalable and less closure bloat way to go about this.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` and removed 6.topic: steam labels Apr 8, 2024
@eclairevoyant eclairevoyant changed the title steam: support Chinese, Japanese in Steam interface nixos/steam: support using system fonts in Steam interface Apr 8, 2024
@eclairevoyant eclairevoyant marked this pull request as ready for review April 8, 2024 22:02
@eclairevoyant
Copy link
Contributor Author

I wonder if we could have the steam nixos module also pick up system fonts.... that seems like a more scalable and less closure bloat way to go about this.

Thanks, seems to work as well.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

Looks right to me, should be minimal closure increase since the fonts are already going to be be installed

@jonringer jonringer merged commit 0c165de into NixOS:master Apr 8, 2024
27 checks passed
@eclairevoyant eclairevoyant deleted the steam-fonts branch April 8, 2024 23:05
@oxalica
Copy link
Contributor

oxalica commented Apr 9, 2024

It does not eval for me on 0c165de. Is the steam module tested?

error:
       … while calling the 'head' builtin

         at /nix/store/j0dd6cvy5nfv70v5nvsx0glrfc2is0k6-source/lib/attrsets.nix:1541:11:

         1540|         || pred here (elemAt values 1) (head values) then
         1541|           head values
             |           ^
         1542|         else

       … while evaluating the attribute 'value'

         at /nix/store/j0dd6cvy5nfv70v5nvsx0glrfc2is0k6-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attempt to call something which is not a function but a list

       at /nix/store/j0dd6cvy5nfv70v5nvsx0glrfc2is0k6-source/pkgs/games/steam/fhsenv.nix:47:8:

           46|     sqlite
           47|   ] ++ extraPkgs pkgs;
             |        ^
           48|

@eclairevoyant
Copy link
Contributor Author

eclairevoyant commented Apr 9, 2024

You're right, extraPkgs should be a function, not a list. I'm not sure why it went through despite cherry-picking the change into the nixpkgs used by my config 😕 Edit: got tarball-ttl'd 🤦

@jonringer
Copy link
Contributor

That's on me. I should have attempted a system rebuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: steam 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants