PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.89k stars 1.63k forks source link

[BUG]: Non-latin fonts are unavailable on Linux (OSD/BigPicture) #10524

Closed guoyunhe closed 10 months ago

guoyunhe commented 11 months ago

Describe the Bug

My System is openSUSE Linux in Chinese. All Qt UI shows Chinese fonts as normal. But the OSD shows only question mark ????

图片

图片

Reproduction Steps

  1. In Linux, switch system language to Chinese
  2. Run any game
  3. Press Esc key to open OSD

Expected Behavior

Chinese texts should be shown as normal

PCSX2 Revision

1.7.5371

Operating System

Linux (64bit) - Specify distro below

If Linux - Specify Distro

openSUSE Tumbleweed

Logs & Dumps

No response

stenzek commented 11 months ago

Unfortunately working as expected - there's no straightforward way to query fonts to use for non-latin glyphs on Linux.

It works fine on Windows/Mac. My plan was to just ship fonts alongside, but that would bloat the download size by like 30MB..

guoyunhe commented 11 months ago

@stenzek Is font-config an option?

stenzek commented 11 months ago

I took a brief look at the API a while back and it didn't seem very friendly.

I think long-term the best option probably is to just ship the fonts, or, make them downloadable at runtime. That way we have consistency across all platforms, and don't run into spacing issues, which are particularly problematic in Big Picture.

Leaning towards the downloadable option - we can make it semi-automatic.

guoyunhe commented 11 months ago

@stenzek I use AetherSX2 on Android and its OSD doesn't have this issue. Maybe it is implemented in a different way. If the OSD itself is written in Qt, I guess you don't need to care about fonts and languages?

stenzek commented 11 months ago

The OSD is not written in Qt, it uses ImGui to render. It is not possible to use Qt to render the OSD, the core takes over the surface. And we wouldn't want to anyway, since it'd be detrimental to performance.

The issue here is that the OSD strings are translated, and it's trying to display non-latin characters from a font that does not support it, because Linux does not have a font: https://github.com/PCSX2/pcsx2/blob/ec12d9b657ce34891640749309f038892982c635/pcsx2-qt/Translations.cpp#L354-L380 (field order is font for windows, linux, mac).

That's why it works fine on Windows:

image
eschcn commented 10 months ago

I took a brief look at the API a while back and it didn't seem very friendly.

I think long-term the best option probably is to just ship the fonts, or, make them downloadable at runtime. That way we have consistency across all platforms, and don't run into spacing issues, which are particularly problematic in Big Picture.

Leaning towards the downloadable option - we can make it semi-automatic.

Can you add an option to set the font so that the user can add the font file themselves? I had the same problem on steamdeck, it was running archlinux and in big picture mode it showed some "?" It is worth mentioning that both pcsx2 and duckstation have the same problem.

Screenshot_20240106_144554 Screenshot_20240106_140025

stenzek commented 10 months ago

No, I'm going to make the fonts auto download. Just haven't had a chance to implement it yet.

guoyunhe commented 10 months ago

@stenzek here is a problem that China blocks GitHub downloads heavily. So I got this error (without a VPN):

图片

Could you use some free hosting like https://www.netlify.com/

stenzek commented 10 months ago

Sorry, that's entirely out of our control. We could pull from Google Fonts, but then I suspect you'd run into the same issue.

Our main binary downloads are from GitHub too, so if you can't download the font, it's unlikely you'll be able to download PCSX2 either.

You can always manually download the file and add it.

eschcn commented 10 months ago

@stenzek I just updated the last version. After downloading the fonts, the large screen mode can display the fonts normally. Thank you for your efforts.

@guoyunhe 网络的问题自己想办法解决吧,找个便宜的机场一年也就一包烟钱。