telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.13k stars 5.18k forks source link

Bold doesn't work for CJK characters #7775

Closed Coxxs closed 4 years ago

Coxxs commented 4 years ago

Steps to reproduce

  1. View https://t.me/cjk_test in Telegram Desktop (Windows)
  2. No Bold Style in Telegram Desktop for CJK characters:

Expected behaviour

(Telegram for Android) image

Actual behaviour

(Telegram Desktop 2.1.1) image

Configuration

Operating system: Windows 10 19041.207 (2004) Version of Telegram Desktop: 2.1.1 (However, this issue has been around for a long time.) Used theme: Default

ilya-fedin commented 4 years ago

Please read: #5368 (TL;DR; it will broke arabic fonts)

Coxxs commented 4 years ago

Thank you for the link. It's true that CJK fonts in the system do not contain semi-bold style. Is it possible to use bold version of CJK fonts when semi-bold font is requested?

ilya-fedin commented 4 years ago

Is it possible to use bold version of CJK fonts when semi-bold font is requested?

No, at least without patching of Open Sans :(

ilya-fedin commented 4 years ago

Are bold characters from this artifact readable for you? https://github.com/ilya-fedin/tdesktop/actions/runs/94518612

Coxxs commented 4 years ago

Yes, perfectly readable. It's a little too thick compared to semi-bold characters, but still better than no bold.

image

Before: image

Coxxs commented 4 years ago

image

Still have some minor issue, Telegram is using Light Italic to display Regular Italic text, and using Regular Italic to display Bold Italic text. This behavior seems already exists in old versions, maybe it's better to open another issue after fixing bold font issue.

After testing several different system locales, it turns out it only happens on Microsoft YaHei font[1], not on Malgun Gothic, Yu Gothic UI or Microsoft JhengHei UI.

[1] First & third column on the picture is using Microsoft YaHei, as YaHei also includes some Japanese characters

ilya-fedin commented 4 years ago

it turns out it only happens on Microsoft YaHei font

Maybe Telegram should use Microsoft YaHei UI? :thinking:

It's ugly and not quite readable for me

@Coxxs looks like no bold font for you :(

Coxxs commented 4 years ago

I adjusted to 125% scaling (used to be 200%), here's the result:

Telegram 2.1.1: image

actions/runs/94518612: image

Microsoft Word: image

Chrome: image

~It seems that Chrome might have some sort of rendering optimize.~ Sorry, I forgot I've set Source Han Sans as my default font in Chrome. Above screenshot has been updated.

Telegram just renders the same as Microsoft & Chrome does, when using exact same font size.

ilya-fedin commented 4 years ago

Telegram just renders the same as Microsoft & Chrome does, when using exact same font size.

Yeah, I agree @NekoInverter's Chrome screenshot looks for me more unreadable, than his Telegram screenshot

ilya-fedin commented 4 years ago

A try with Microsoft YaHei UI, I hope this will fix light weight issue https://github.com/ilya-fedin/tdesktop/actions/runs/94904040

ilya-fedin commented 4 years ago

it's built

Coxxs commented 4 years ago

image

Looks good now!

ilya-fedin commented 4 years ago

Ok, I added the fix for light weight to the PR with korean fonts fix And created a PR with bold fix: https://github.com/desktop-app/lib_ui/pull/12 But the final decision is up to @john-preston

ilya-fedin commented 4 years ago

Chinese fonts are now broken on Windows 7man_facepalming

how are they then rendered in the rest of the system?

ilya-fedin commented 4 years ago

Microsoft Yahei UI was introduced in Windows 8 and doesn't exists on Windows 7

Oh, Ihought it Windows Vista+

ilya-fedin commented 4 years ago

Add fallback to Microsoft Yahei probably fix the issue

Does Microsoft JhengHei UI exist on Windows 7?

Which fonts are right, with UI or without? Different Chinese people says different things.

ilya-fedin commented 4 years ago

From Wikipedia

This doesn't answer the second question, something like a table with default fons for different Windows versions (Vista-10) is needed

Also, what about Yu Gothic UI and Malgun Gothic?

ilya-fedin commented 4 years ago

Looks like this is related to the new DirectWrite font database which is not ready yet. Sounds horrible.

ilya-fedin commented 4 years ago

Also, looks like this function only selects default font for application when custom font is not set (but tdesktop uses open sans) and doesn't manage fallbacks

ilya-fedin commented 4 years ago

I hope that no one will say "it is not so difficult to fix" about CJK font fallback anymore

ilya-fedin commented 4 years ago

You can call SystemParametersInfo directly to get system default font and set it as fallback

Stop, this won't fix the fallback for non-CJK OS

ilya-fedin commented 4 years ago

Ok, I replaced all fonts with non-UI ones, so that they are shouldn't have diefferent weight and should be from WIndows Vista. For Japanese I also added Meiryo, since Yu Gothic is from Windows 10. Please test.

https://github.com/ilya-fedin/tdesktop/actions/runs/97374407

Coxxs commented 4 years ago

The lightweight issue for Italic comes back again in runs/97374407, maybe we could set tryFonts like this? ... "Microsoft YaHei UI", "Microsoft YaHei", "Arial", "Microsoft JhengHei UI", "Microsoft JhengHei", ...

ilya-fedin commented 4 years ago

The lightweight issue

How it looks like? Japanese should be light too and there are shouldn't be difference :thinking:

Coxxs commented 4 years ago

runs/97374407 with Chinese locale: image

runs/97374407 with Japanese locale: image

2.1.2 with Japanese locale: image

ilya-fedin commented 4 years ago

Ok, I'll try to add the UI ones

ilya-fedin commented 4 years ago

https://github.com/ilya-fedin/tdesktop/actions/runs/97476086

ilya-fedin commented 4 years ago

It's built

Coxxs commented 4 years ago

Telegram 2.1.2 / Windows 7 / Simplified Chinese locale / 100% scaling: image

runs/97476086 / Windows 7 / Simplified Chinese locale / 100% scaling: image

runs/97476086 / Windows 7 / Japanese locale / 100% scaling: image

runs/97476086 / Windows 7 / Traditional Chinese locale / 100% scaling: image

runs/97476086 / Windows 10 / Simplified Chinese locale / 200% scaling: image

ilya-fedin commented 4 years ago

runs/97476086 / Windows 7 / Japanese locale / 100% scaling:

What happend to the italic? Is it the same on 2.1.2 with Japanese locale? 😨

ilya-fedin commented 4 years ago

Ah, it's Windows 7. So, this is Meiryo, probably :thinking:

ilya-fedin commented 4 years ago

When italicized, only Latin characters are slanted, not CJK characters and kana. CJK characters use other methods of emphasis or quotation indication; thus differing from, for example, the typefaces of Romance languages (unrelated distinctions between cursive and non-cursive and other traditional writing styles do exist). Nowadays, however, italicization is used in advertising but usually combined with other, common forms of emphasis, such as bold weight, exclamation marks, and, in Japanese, katakana use. https://en.wikipedia.org/wiki/Meiryo So, this is OK :thinking:

ilya-fedin commented 4 years ago

runs/97476086 / Windows 7 / Traditional Chinese locale / 100% scaling:

Unfortunately, there are no Microsoft YaHei UI on Windows 7 to fix that. But this is better than nothing, right?

Coxxs commented 4 years ago

Microsoft YaHei Light is not introduced until Windows 8.1, so I think Qt is unable to pick a wrong font weight for YaHei in Windows 7 ;)

Vista (& Windows 7) also had Meiryo UI font, but I'm not sure if we should use it...

ilya-fedin commented 4 years ago

Vista (& Windows 7) also had Meiryo UI font, but I'm not sure if we should use it...

But it is Japanese font, when Microsoft YaHei is Chinese font

Coxxs commented 4 years ago

runs/97476086 / Windows 7 / Japanese locale / 100% scaling: (using Meiryo) image

runs/97476086 / Windows 7 / Japanese locale / 100% scaling: replace Meiryo with Meiryo UI using FontMod: image

Perhaps only Japanese native speaker can tell which style is better...

ilya-fedin commented 4 years ago

Wow, Meiryo UI looks closer to Yu Gothic UI. Perhaps I should add it :)

ilya-fedin commented 4 years ago

Microsoft YaHei Light is not introduced until Windows 8.1, so I think Qt is unable to pick a wrong font weight for YaHei in Windows 7 ;)

Then maybe Qt just renders Microsoft YaHei wrongly :(

ilya-fedin commented 4 years ago

https://github.com/ilya-fedin/tdesktop/actions/runs/97811194

ilya-fedin commented 4 years ago

@Coxxs can you say how do you check which font is used to help to debug #7823?

Coxxs commented 4 years ago

I'm only familiar with CJK font, and I checked commit history to find out which font is used...

But I think #7823 is not a issue related to font, but a issue related to UI design. Actually if you look at Windows & Chrome, they do not use lots of bold fonts in software UI. The intention of this issue is to fix the bold support for chat content area, when opening this issue, I didn't consider that the UI would also changes.

ilya-fedin commented 4 years ago

https://github.com/ilya-fedin/tdesktop/actions/runs/97811194

It's built

Coxxs commented 4 years ago

image

According to https://github.com/microsoft/vscode/pull/79735, most Japanese people prefer narrow style for kana for UI. I think the order of Japanese fonts should be: "Yu Gothic UI", "Meiryo UI", "Yu Gothic", "Meiryo" or just: "Yu Gothic UI", "Meiryo UI"

Windows 7 already had Meiryo UI, Windows 8.1 shipped Yu Gothic, Windows 10 1507 shipped Yu Gothic UI, changing the order can provide users with different system version a consistent experience.

ilya-fedin commented 4 years ago

Ok, thanks

Coxxs commented 4 years ago

runs/97843908(#7823) / Windows 7 / Japanese locale / 100% scaling: image

Also not found any issues for other CJK locale so far.

ilya-fedin commented 4 years ago

I'll give other build when a solution for persian issue will be found

ilya-fedin commented 4 years ago

https://github.com/ilya-fedin/tdesktop/actions/runs/98306815 (it's already built)

Coxxs commented 4 years ago

https://github.com/ilya-fedin/tdesktop/actions/runs/98306815 (it's already built)

Tested on Windows 7 & Windows 10 with different CJK locale, all looks good.

ilya-fedin commented 4 years ago

Ok, thanks

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.