sqlitebrowser / sqlitebrowser

Official home of the DB Browser for SQLite (DB4S) project. Previously known as "SQLite Database Browser" and "Database Browser for SQLite". Website at:
https://sqlitebrowser.org
Other
20.93k stars 2.12k forks source link

Ugly font on Windows 10 #2744

Open wdscxsj opened 3 years ago

wdscxsj commented 3 years ago

On Windows 10 Simplified Chinese Edition, the old-style, unpleasant SimSun font is used by sqlitebrowser as the main UI font almost everywhere, even though the OS default font is Microsoft Yahei (微软雅黑).

Screenshot118

Could we have Microsoft Yahei (微软雅黑) back, or an option to select one's favorite? Thanks.

mgrojo commented 3 years ago

This might be due to saved settings from a previous version. What happens if you use the Restore Defaults button?

wdscxsj commented 3 years ago

This might be due to saved settings from a previous version. What happens if you use the Restore Defaults button?

Thanks for your suggestion! I tried "Restore Default" on v3.12.0 and v3.12.2, but in both cases the default UI font was still SimSun.

Please note in my previous screenshot, there is a field typeset in Microsoft Yahei. It turns out that field is affected by the Font setting (in my case 微软雅黑, aka Microsoft Yahei) on the Data Browser tab.

chrisjlocke commented 3 years ago

Please note in my previous screenshot, there is a field typeset in Microsoft Yahei.

This is an example of what the data browser font looks like, which is controlled by the top font setting

image

wdscxsj commented 3 years ago

@chrisjlocke Sorry I was not quite clear on this point. The Font field is set to 微软雅黑 (aka Microsoft Yahei), but on this dialog, this setting only affects the field containing "Preview only (N/A)". Other fields are still in SimSun.

The Font field may not be designed to control the dialog/UI font, but this doesn't actually matter. The desirable behavior is to inherit the OS default UI font, or have an option to set it manually.

chrisjlocke commented 3 years ago

Completely agree - was just explaining what that field was for, and why that one field was in the correct font. 😁

mgrojo commented 3 years ago

In theory, we are getting the default font for the application according to documentation, and then we set the configured size in General > Font size, so it might be a problem in Qt.

wdscxsj commented 3 years ago

@mgrojo You are right, thanks! It turns out there are plenty of complaints about the ugly default font of Qt on a Chinese Edition of Windows. Could we add an option for a lovely user to choose her favorite?

Not a Qt developer, I come up with this tiny program in PyQt5:

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5.QtGui import QFont

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('My App 我的应用')
        button = QPushButton('Press Me 点我')
        self.setCentralWidget(button)

def main():
    app = QApplication(sys.argv)

    # Set default GUI font.
    font = QFont()
    font.setFamily('Microsoft Yahei')
    app.setFont(font)

    window = MainWindow()
    window.show()
    app.exec_()

if __name__ == '__main__':
    sys.exit(main())

Without app.setFont(font), the default font is SimSun:

1

With app.setFont(font), we can use Microsoft Yahei or anything:

2

mgrojo commented 3 years ago

Ideally, Qt should fix the bug, and we update to the new version, otherwise we could end up with too many options which will confuse users. The font for the application should be configured at the desktop level, and not application per application. Haven't you found a reference to a bug report which we can monitor from this issue?

wdscxsj commented 3 years ago

Hi, it's reported back in 2011 as QTBUG-19309 "Wrong default font on Windows 7". The conclusion was SimSun had to be the fallback font due to support for Windows XP.

It's reported again in 2020 as QTBUG-87391 "Default font in Chinese Windows 10 is wrong". It seems that Qt6 has fixed this issue but not yet Qt5.

The ugly default SimSun was called by bosbyj the "SimSun Ghost in QT" in this Zeal issue and I totally agree. This StackOverflow question was also fun to read. But as a PC user from the last century, I'm quite sure that Chinese users are NOT used to that look & feel.

By the way, it seems that this behavior cannot be overridden using the Windows font link mechanism (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink).

FearYuzu commented 3 years ago

In Japanese Windows Environment, it's more ugly fonts at default. The only saddest things in this useful app :/ I hope to fix this as fast as possible, being an all UI font customizable is better if possible.

Just installed the latest version and didn't tweak any locate setting in Windows.

ss_20210722

justinclift commented 2 years ago

Hmmm, it's been about a year since this bug report. Maybe we should figure out a way to check for the presence of the "Microsoft Yahei" font (on Windows), and if it's present we use that as the default.

wdscxsj commented 2 years ago

I think the default "modern" UI font differs on Chinese, Japanese, and Korean Windows systems. My personal recommendation is to follow the practice of EmEditor (which uses WTL instead Qt, but faced a similar issue for the dialog font), as described in its v21.3 release announcement, Nov 2021:

We have decided to hard-code Microsoft YaHei for Simplified Chinese, and Microsoft JhengHei for Traditional Chinese. We have not changed the other language UI yet but will test the other languages in beta versions for the next version. We will use Meiryo UI for Japanese, Malgun Gothic for Korean, and Segoe UI for other languages.

The "will use" part was done in EmEditor v21.4, Dec 2021. And no change ever since.

I think we can "just use" these fonts without detection, unless Windows XP is to be supported. They are standard UI fonts distributed since Windows Vista, as documented here.

By the way, this change to EmEditor was proposed by me, "another customer using the Chinese UI" mentioned in the release announcement. As Yutaka (author of the EmEditor) is from Japan, we can be sure that the new look is good on at least Simplified Chinese Windows and Japanese Windows.

neonleo commented 2 years ago

I am using Traditional Chinese Windows 11 home editon, the GUI font size is quite weird too, it is usable but ugly. You can see the data browser is fine because I can set the font and size on perferences, but the GUI just font size.

圖片 001