flathub / com.valvesoftware.Steam

https://flathub.org/apps/details/com.valvesoftware.Steam
348 stars 68 forks source link

Steam Flatpak client doesn't show CJK fonts. #1070

Closed benkei-kuruma closed 9 months ago

benkei-kuruma commented 1 year ago

Fedora Silverblue 38 Flatpak 1.15.4 GNOME 44

Screenshot: image

Maybe related to this issue: https://github.com/flathub/com.google.Chrome/issues/202

lumingzh commented 1 year ago

Yes, same problem here.

JaneSmith commented 1 year ago

Same problem here. I recently updated my system from Fedora Silverblue 36 to Fedora Silverblue 38, and it looks like Fedora 38 changed something with Japanese fonts. You're also on Fedora Silverblue 38. Is it possible that that's the cause? But as this is a Flatpak, I'm not sure that system font change would have any effect...

TibiIius commented 1 year ago

Same problem here. I recently updated my system from Fedora Silverblue 36 to Fedora Silverblue 38, and it looks like Fedora 38 changed something with Japanese fonts. You're also on Fedora Silverblue 38. Is it possible that that's the cause? But as this is a Flatpak, I'm not sure that system font change would have any effect...

Running Fedora Silverblue 38, I suffered from the same problem, but replacing google-noto-sans-cjk-vf-fonts with google-noto-sans-cjk-fonts in combination with this fix here (obviously changing the path to match Steam's config directory) fixed Steam's CJK fonts for me.

benkei-kuruma commented 1 year ago

Same problem here. I recently updated my system from Fedora Silverblue 36 to Fedora Silverblue 38, and it looks like Fedora 38 changed something with Japanese fonts. You're also on Fedora Silverblue 38. Is it possible that that's the cause? But as this is a Flatpak, I'm not sure that system font change would have any effect...

Running Fedora Silverblue 38, I suffered from the same problem, but replacing google-noto-sans-cjk-vf-fonts with google-noto-sans-cjk-fonts in combination with this fix here (obviously changing the path to match Steam's config directory) fixed Steam's CJK fonts for me.

I know you said it was "obvious", but would you mind explaining, step by step, what you did to get CJK fonts working in Steam? For example, where is the Steam flatpak font directory?

I can't believe this hasn't been fixed upstream yet, after a whole month.

TibiIius commented 1 year ago

Same problem here. I recently updated my system from Fedora Silverblue 36 to Fedora Silverblue 38, and it looks like Fedora 38 changed something with Japanese fonts. You're also on Fedora Silverblue 38. Is it possible that that's the cause? But as this is a Flatpak, I'm not sure that system font change would have any effect...

Running Fedora Silverblue 38, I suffered from the same problem, but replacing google-noto-sans-cjk-vf-fonts with google-noto-sans-cjk-fonts in combination with this fix here (obviously changing the path to match Steam's config directory) fixed Steam's CJK fonts for me.

I know you said it was "obvious", but would you mind explaining, step by step, what you did to get CJK fonts working in Steam? For example, where is the Steam flatpak font directory?

I can't believe this hasn't been fixed upstream yet, after a whole month.

Sure, no problem :)

  1. Remove the CJK VF fonts package from your system (rpm-ostree uninstall google-noto-sans-cjk-vf-fonts) and install the non-VF ones (rpm-ostree install google-noto-sans-cjk-fonts google-noto-serif-cjk-fonts, no idea if you actually need the serif ones, I installed them anyway). Reboot afterwards.
  2. Create a new directory inside the Steam app's config folder (mkdir -p ~/.var/app/com.valvesoftware.Steam/config/fontconfig).
  3. Download the fonts.txt file into the newly created fontconfig folder (curl -L https://github.com/flathub/com.google.Chrome/files/11254708/fonts.txt > ~/.var/app/com.valvesoftware.Steam/config/fontconfig/fonts.conf).

After then restarting Steam, you should now be able to see CJK fonts again.

Hope this helped you!

benkei-kuruma commented 1 year ago

Thank you so much!

Remove the CJK VF fonts package from your system (rpm-ostree uninstall google-noto-sans-cjk-vf-fonts) and install the non-VF ones (rpm-ostree install google-noto-sans-cjk-fonts google-noto-serif-cjk-fonts

Ah, so it looks like you're essentially reverting to the "old" CJK fonts?

Personal, but I honestly don't want to mess with my system's "defaults" unless I absolutely have to (e.g., drivers). It's one of the reasons I use Silverblue in the first place. For something as "simple" as fonts (as opposed to, say, mesa or Wayland or something), I hope they (whoever "they" are) can just patch this upstream. I've posted about it in several places by now to raise visibility (including the official Fedora forums), so hopefully someone notices.

Thank you again!

dogtopus commented 1 year ago

Slightly non-intrusive workaround: Download "All Static Language Specific OTCs" from https://github.com/notofonts/noto-cjk/releases, extract it to ~/.var/app/com.valvesoftware.Steam/data/fonts.

benkei-kuruma commented 1 year ago

Slightly non-intrusive workaround: Download "All Static Language Specific OTCs" from https://github.com/notofonts/noto-cjk/releases, extract it to ~/.var/app/com.valvesoftware.Steam/data/fonts.

That worked like a charm! Thank you!

Hasshu commented 1 year ago

@epico Apologies for the mention, but could you look into this? Appears to be related to the abovementioned F38 change.

epico commented 1 year ago

Does it work if only copy the NotoSansCJK-Regular.ttc file from the google-noto-sans-cjk-fonts package to ~/.var/app/com.valvesoftware.Steam/data/fonts?

Hasshu commented 1 year ago

@epico Just tested that, and it does — no more "tofu".

epico commented 1 year ago

Which GUI toolkit or Web Browser does the Steam package use?

Does the Steam rpm from the rpmfusion repo work with the google-noto-sans-cjk-vf-fonts rpm in Fedora 38?

Hasshu commented 1 year ago

Which GUI toolkit or Web Browser does the Steam package use?

I believe it uses the Chromium Embedded Framework. See also https://github.com/flathub/org.chromium.Chromium/issues/280 and https://github.com/flathub/com.google.Chrome/issues/202.

Does the Steam rpm from the rpmfusion repo work with the google-noto-sans-cjk-vf-fonts rpm in Fedora 38?

Appears to be working here.

epico commented 1 year ago

I think maybe one work around is to ship the NotoSansCJK-Regular.ttc fonts with the flatpak package.

In long term, please consider to rebase the font rendering packages to newer version.

Hasshu commented 1 year ago

@epico Thank you for your assistance!

@nanonyme @gasinvein Any thoughts?

nanonyme commented 1 year ago

If we are allowed to distribute these, make a PR?

Hasshu commented 1 year ago

If we are allowed to distribute these, make a PR?

Was that addressed to me, by any chance?

nanonyme commented 1 year ago

Yes.

Hasshu commented 1 year ago

I don't do code. I also — together with the other users — have been trying to troubleshoot this issue for a while.

Would it be safe to assume that this Flatpak is no longer maintained?

nanonyme commented 1 year ago

This is maintained by community as it always have been.

bc-lee commented 1 year ago

This is not a problem with Flathub. I installed Steam from rpmfusion, but I encountered a problem as well. The solution can be found here: https://github.com/ValveSoftware/steam-for-linux/issues/9418#issuecomment-1676309668

This issue is related to changes in Fedora 38, specifically the Noto CJK Variable Fonts.

I fixed it by removing the variable font and installing the normal font.

$ sudo dnf remove google-noto-sans-cjk-vf-fonts
$ sudo dnf install google-noto-sans-cjk-fonts
scottAnselmo commented 11 months ago

I just wanted to chime in for those using immutable Fedora distros like Fedora Silverblue or Fedora Kinoite that just running this and rebooting was enough for me:

sudo rpm-ostree install google-noto-sans-cjk-fonts

Hopefully either Valve or the flatpak maintainers can fix whatever underlying assumptions they're making about CJK fonts to address this issue permanently w/o requiring workarounds to be done by users

nanonyme commented 11 months ago

That is actually the way things are expected to work for more special fonts. You install them on host.

scottAnselmo commented 11 months ago

I would put forth however that if my Fedora system works just fine displaying the OS in Japanese, I can type with Japanese IME w/o issues, and read Japanese in third party software be it Firefox or Jellyfin client as was my case, it would be reasonable to expect the Steam distributable to work out of the box with displaying Japanese, Korean, or Chinese and not require user intervention. Particularly when (Mandarin) Chinese has over 1 billion speakers.

nanonyme commented 11 months ago

I don't know why things work for you without installing expected font on host

nanonyme commented 11 months ago

If things work on host without installing the font, then it sounds a lot like your distro is shipping downstream fontconfig configuration that defines fallback fonts. This kind of thing should be part of fontconfig upstream but in case you find such a thign, we should be able to add it to app. Only host fonts propagate to sandbox, not configurations.

scottAnselmo commented 11 months ago

If things work on host without installing the font, then it sounds a lot like your distro is shipping downstream fontconfig configuration that defines fallback fonts. This kind of thing should be part of fontconfig upstream but in case you find such a thign, we should be able to add it to app. Only host fonts propagate to sandbox, not configurations.

Is this fonts.config what you're referring to from /usr/etc/fonts?

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
    <description>Default configuration file</description>

<!--
    DO NOT EDIT THIS FILE.
    IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
    LOCAL CHANGES BELONG IN 'local.conf'.

    The intent of this standard configuration file is to be adequate for
    most environments.  If you have a reasonably normal environment and
    have found problems with this configuration, they are probably
    things that others will also want fixed.  Please submit any problems
    to the fontconfig issue tracking system located at fontconfig.org

    Note that the normal 'make install' procedure for fontconfig is to
    replace any existing fonts.conf file with the new version.  Place
    any local customizations in local.conf which this file references.

    Keith Packard
-->

<!-- Font directory list -->

    <dir>/usr/share/fonts</dir>
    <dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
    <dir prefix="xdg">fonts</dir>
    <!-- the following element will be removed in the future -->
    <dir>~/.fonts</dir>

<!--
  Accept deprecated 'mono' alias, replacing it with 'monospace'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>mono</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>monospace</string>
        </edit>
    </match>

<!--
  Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans serif</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>sans-serif</string>
        </edit>
    </match>

<!--
  Accept deprecated 'sans' alias, replacing it with 'sans-serif'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>sans-serif</string>
        </edit>
    </match>
<!--
  Accept alternate 'system ui' spelling, replacing it with 'system-ui'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>system ui</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>system-ui</string>
        </edit>
    </match>

<!--
  Load local system customization file
-->
    <include ignore_missing="yes">conf.d</include>

<!-- Font cache directory list -->

    <cachedir>/usr/lib/fontconfig/cache</cachedir>
    <cachedir prefix="xdg">fontconfig</cachedir>
    <!-- the following element will be removed in the future -->
    <cachedir>~/.fontconfig</cachedir>

    <config>
<!--
  Rescan configuration every 30 seconds when FcFontSetList is called
 -->
        <rescan>
            <int>30</int>
        </rescan>
    </config>

</fontconfig>

I don't see any references to the VF fonts to show why third party apps like com.github.iwalton3.jellyfin-media-player don't have issues with google-noto-sans-cjk-vf-fonts, but com.valvesoftware.Steam does. If we can get a Fedora workgroup to address any issues with this fonts.config to help Steam, it might also help with unknown apps that also have this issue. Please let me know if there's anything you'd suggest to this file for me to forward upstream to Fedora, or if I'm looking at the wrong file.

lumingzh commented 11 months ago

The real problem is all electron and chromium based apps have this bug because of electron and chromium don't support vf fonts. Steam is based on cef aka chromium.

benkei-kuruma commented 9 months ago

Just updating this to say that, as of today, the latest Steam flatpak is now displaying CJK fonts correctly. No manual changes to my system on my end, just a regular update. Big thanks to anyone responsible for fixing this after so long!

image

image