Bug 427733 - Use new system fonts to improve CJK letter readability under Windows
Summary: Use new system fonts to improve CJK letter readability under Windows
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (other bugs)
Version First Reported In: 4.4.0
Platform: Microsoft Windows Microsoft Windows
: NOR wishlist
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-15 03:29 UTC by Tyson Tan
Modified: 2021-06-22 13:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Krita 4.4 CJK UI letter display under Windows 10 (149.88 KB, image/png)
2020-10-15 03:34 UTC, Tyson Tan
Details
Krita 4.4 CJK UI letter display under Linux (262.32 KB, image/png)
2020-10-15 03:36 UTC, Tyson Tan
Details
Krita UI with PMingLiU (Traditional Chinese) where even the smaller text is sharp (83.09 KB, image/png)
2020-10-15 07:56 UTC, Alvin Wong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2020-10-15 03:29:15 UTC
When Krita is set to use a CJK (Chinese, Japanese, Korean) locale, Qt fallbacks to use ancient Windows XP era font sets. These are bitmap, serif fonts. They requires certain letter size (12px) to be pixel exact, and do not work well with sub-pixel anti-aliasing, making them a poor choice for Krita. I will attach screenshots later to showcase what I mean.

Since Windows 7, Microsoft ships a new series of UI font sets. They are:

Latin default:
Segoe UI

Simplified Chinese:
Microsoft YaHei UI

Traditional Chinese:
Microsoft JhengHei UI

Japanese:
Yu Gothic UI

Korean:
Malgun Gothic

These are sans-serif, vector fonts. They scale nicely regardless of their size. I wonder if we can specify these fonts respectively to each CJK locale, or at least add them to qt's fallback font list.
Comment 1 Tyson Tan 2020-10-15 03:34:00 UTC
Created attachment 132373 [details]
Krita 4.4 CJK UI letter display under Windows 10

This is how Krita 4.4's CJK UI letters look under Windows 10 2004. The letters in on the Blending Mode droplist are difficult to read. They are not big enough to use anti-aliasing, while also not pixel-exact to their bitmap sizes, so they got crushed.
Comment 2 Tyson Tan 2020-10-15 03:36:36 UTC
Created attachment 132374 [details]
Krita 4.4 CJK UI letter display under Linux

This is how Krita 4.4 CJK UI letters look under Linux. The anti-aliasing works properly, provided better readability.
Comment 3 Alvin Wong 2020-10-15 07:31:15 UTC
Probably related: https://bugreports.qt.io/browse/QTBUG-58610

If Qt is not using Segoe UI on English language Windows, then this issue is not limited to CJK.
Comment 4 Alvin Wong 2020-10-15 07:56:58 UTC
Created attachment 132380 [details]
Krita UI with PMingLiU (Traditional Chinese) where even the smaller text is sharp

To add to this, the CJK texts with pre-Vista fonts are usually quite readable as long as the font size used matches one of the bitmap sizes (which I think for MingLiU/PMingLiU includes at least 12px, 13px, 14px, 16px and 18px but I could be wrong), albeit having a dated appearance. It gets blurry only when the font size is too small (< 8pt).

... which comes to the question, does SimSun contain fewer bitmap sizes than MingLiU? Because my Traditional Chinese UI text is *sharp* (compare the names of the dockers).
Comment 5 Alvin Wong 2020-10-15 08:15:04 UTC
Never mind, I just checked with FontForge. MingLiU/PMingLiU contains bitmaps for 11, 12, 13, 15, 16 and 20px, but SimSun only contains bitmaps for 12 to 17px. This explains the difference.
Comment 6 Halla Rempt 2020-10-15 08:15:28 UTC
Yes, that looks like a relevant Qt bug report. Looks like this will only be fixed for Qt6. Question is... Should we override the default fonts in Krita, patch our Qt or wait and do nothing?
Comment 7 Halla Rempt 2020-10-16 09:37:55 UTC
I think for now, I'll add a config option. I don't want to mess around patching Qt's font database...
Comment 8 Halla Rempt 2020-10-16 14:26:39 UTC
Git commit 0bad1b9b0bf3d7e0f6269956ad381bbd2b6e1431 by Boudewijn Rempt.
Committed on 16/10/2020 at 14:25.
Pushed by rempt into branch 'master'.

Add a UI font selection option

Qt doesn't select the modern, nice user interface fonts on Windows,
so give the user a chance to select those themselves. And once that's
there, why not let everyone select that font.

M  +1    -0    libs/ui/KisApplication.cpp
M  +11   -0    libs/ui/KisMainWindow.cpp
M  +28   -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +182  -132  libs/ui/forms/wdggeneralsettings.ui
M  +2    -2    libs/widgets/KoToolBoxButton.cpp
M  +1    -0    libs/widgetutils/CMakeLists.txt
R  +19   -7    libs/widgetutils/kis_font_family_combo_box.cpp [from: plugins/tools/svgtexttool/kis_font_family_combo_box.cpp - 094% similarity]
R  +9    -5    libs/widgetutils/kis_font_family_combo_box.h [from: plugins/tools/svgtexttool/kis_font_family_combo_box.h - 090% similarity]
M  +0    -1    plugins/tools/svgtexttool/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/0bad1b9b0bf3d7e0f6269956ad381bbd2b6e1431
Comment 9 Tyson Tan 2020-10-16 15:07:36 UTC
Thank you Boud and Alvin! Now we can have better looking texts under Windows! :D
Comment 10 Halla Rempt 2020-10-20 11:39:42 UTC
Git commit 40616316f0e36cfa6cfb026158400a1b7b1f09eb by Boudewijn Rempt.
Committed on 20/10/2020 at 09:12.
Pushed by rempt into branch 'krita/4.3'.

Add a UI font selection option

Qt doesn't select the modern, nice user interface fonts on Windows,
so give the user a chance to select those themselves. And once that's
there, why not let everyone select that font.
(cherry picked from commit 0bad1b9b0bf3d7e0f6269956ad381bbd2b6e1431)

M  +1    -0    libs/ui/KisApplication.cpp
M  +11   -0    libs/ui/KisMainWindow.cpp
M  +28   -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +186  -66   libs/ui/forms/wdggeneralsettings.ui
M  +2    -2    libs/widgets/KoToolBoxButton.cpp
M  +1    -0    libs/widgetutils/CMakeLists.txt
R  +19   -7    libs/widgetutils/kis_font_family_combo_box.cpp [from: plugins/tools/svgtexttool/kis_font_family_combo_box.cpp - 094% similarity]
R  +9    -5    libs/widgetutils/kis_font_family_combo_box.h [from: plugins/tools/svgtexttool/kis_font_family_combo_box.h - 090% similarity]
M  +0    -1    plugins/tools/svgtexttool/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/40616316f0e36cfa6cfb026158400a1b7b1f09eb
Comment 11 Alvin Wong 2021-06-22 09:54:09 UTC
Git commit 40c1cd91f30ae8dbb3febf244b1dc721762e07bd by Alvin Wong.
Committed on 22/06/2021 at 09:50.
Pushed by alvinwong into branch 'master'.

win: Use new modern system font as default

Use the new system font introduced since Windows Vista, which is Segoe
UI on English locale, MS JhengHei on Trad. Chinese, MS YaHei on Simp.
Chinese, Meiryo on Japanese, etc.

The code is referenced from Qt.

See also: https://bugreports.qt.io/browse/QTBUG-58610

M  +94   -0    libs/ui/KisUiFont.cpp

https://invent.kde.org/graphics/krita/commit/40c1cd91f30ae8dbb3febf244b1dc721762e07bd
Comment 12 Tyson Tan 2021-06-22 10:00:02 UTC
Thank you Alvin! :D
Comment 13 Tyson Tan 2021-06-22 10:08:22 UTC
Now that Krita's CJK fonts has been renewed, I wonder if we can somehow do the same for other KDE apps under Windows, without changing each app individually? The same problem happens to Krita, digiKam, Kdenlive, Kate Editor, etc.
Comment 14 Alvin Wong 2021-06-22 11:03:40 UTC
I cannot decide for other applications whether they would want to apply this change now. From what I understand the new default font is used in Qt 6. It is possible to patch Qt 5 to enable the new default fonts, but I don't know how the other applications share the Qt builds, so I can't answer this question.
Comment 15 Tyson Tan 2021-06-22 13:05:55 UTC
Thank you for the explanation. If Qt6 is going to use them, I suppose we can just wait for it. 

Maybe I can let digiKam, Kdenlive and Kate teams know about this. For those apps are popular and text heavy.
Comment 16 Tyson Tan 2021-06-22 13:13:07 UTC
This also fixed half of the issues we discussed in Bug 432882.

(For some reason when I was reporting Bug 432882, I wasn't able to find Bug 427733 by searching the keyword "font"...they are sort of duplicate now but now really, sorry about that)