Bug 177345

Summary: [Regression] Webkit "-apple-system" font fallback token handles font weights of PingFang incorrectly.
Product: WebKit Reporter: Shiki Suen <shikisuen>
Component: WebKit2Assignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Critical CC: achristensen, buildbot, commit-queue, ddkilzer, dino, dongyuan_liu, jonlee, mmaxfield, shikisuen, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: All   
OS: macOS 10.13   
Attachments:
Description Flags
macOS-Safari-PingFang-FakeBold-Issue-Screenshot
none
iOS-Safari-PingFang-FakeBold-Issue-Screenshot
none
Patch
none
Patch none

Description Shiki Suen 2017-09-21 23:50:33 PDT
Created attachment 321520 [details]
macOS-Safari-PingFang-FakeBold-Issue-Screenshot

This bug report was sent to Apple Bug Reporter (#33333584) on on July 15, 2017 and was informed on July 24 that "Engineering has determined that your bug report is a duplicate of another issue and will be closed." However, this issue, till now, is still left unresolved and affects all applications on macOS and iOS that relies on the Safari 11 Webkit API when "-apple-system" is used in CSS font fallback.

These are new regressions found in macOS 10.13 and iOS 11 since Developer Beta 3 till GM Builds regarding how webkit handles the font weights of PingFang typeface. See "Steps to Reproduce" below.

The reason is that a virtually bolded CJK font looks extremely terrible, definitely disobeying what the font designers really want to see. I posted some attachments here for your reference.

Steps to Reproduce:
1. In occasions that the Safari (or any app that relies on the system built-in webkit) reads a western font with Bold weight, when the font falls back to PingFang, it shows virtually bolded font in lieu of what previously done (i.e. PingFang Semibold).

2. To cope with what I described above, I extracted all six PingFang Semibold files and made a doppelgänger set of them (renamed as PingFang bold) and tested this issue again. Now I found that only the wildcard font-fallback token "-apple-system" triggers this issue.

Expected Results:
Either use PingFang Semibold (like what iOS and macOS previously did), OR ask DynaComware to make the real Bold (and possibly Heavy) weight(s) of this font family.

Observed Results:
The virtually bolded PingFang family looks extremely terrible, definitely disobeying what the font designers really want to see. I posted some attachments here for your reference.

Version:
Safari 11.0-13604.1.28.2 and 11.0 (13604.1.38.1.6) 

Notes:
I feel that no one in Webkit team wants to solve this issue quickly, but I still have to post it here.

Configuration:
macOS 10.13  Developer Beta 3 * GM Build and iOS 11 Developer Beta 3 & GM Build, running on MacBook Late 2016 TouchBar model (13 inch) and iPhone 6s.
Comment 1 Shiki Suen 2017-09-21 23:51:32 PDT
Created attachment 321521 [details]
iOS-Safari-PingFang-FakeBold-Issue-Screenshot
Comment 2 Alexey Proskuryakov 2017-09-22 11:19:02 PDT
rdar://problem/32975942
Comment 3 Shiki Suen 2017-09-22 11:24:35 PDT
(In reply to Alexey Proskuryakov from comment #2)
> rdar://problem/32975942

So someone reported this earlier than what I did, proving that there may be a reason why this issue is not wanted to be solved on time.
Comment 4 Myles C. Maxfield 2017-10-12 18:34:35 PDT
Created attachment 323618 [details]
Patch
Comment 5 Build Bot 2017-10-12 18:36:17 PDT
Attachment 323618 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Myles C. Maxfield 2017-10-12 18:45:20 PDT
*** Bug 177683 has been marked as a duplicate of this bug. ***
Comment 7 Myles C. Maxfield 2017-10-13 13:54:26 PDT
Created attachment 323740 [details]
Patch
Comment 8 WebKit Commit Bot 2017-10-17 17:34:27 PDT
Comment on attachment 323740 [details]
Patch

Clearing flags on attachment: 323740

Committed r223589: <https://trac.webkit.org/changeset/223589>
Comment 9 WebKit Commit Bot 2017-10-17 17:34:28 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Shiki Suen 2017-10-18 15:03:46 PDT
I see the Safari Developer Preview Release 42 (Safari 11.1, WebKit 13605.1.10) does not have this bug fixed. Will this be fixed in macOS 10.12.1 and the next major iOS release?
Comment 11 David Kilzer (:ddkilzer) 2017-10-19 04:40:36 PDT
(In reply to Shiki Suen from comment #10)
> I see the Safari Developer Preview Release 42 (Safari 11.1, WebKit
> 13605.1.10) does not have this bug fixed.

I believe this fix landed after we branched for STP 42.  You can check the revision range in the STP 42 release notes.

> Will this be fixed in macOS
> 10.12.1 and the next major iOS release?

Sorry, we can’t talk about the specifics of upcoming releases.
Comment 12 Alex Christensen 2017-10-20 23:10:11 PDT
I think the test was checked into the wrong directory.  Instead of putting it in LayoutTests/fast/text/system-ui-chinese-bold-fallback.html it was checked into fast/text/system-ui-chinese-bold-fallback.html
Comment 13 David Kilzer (:ddkilzer) 2017-10-24 11:23:17 PDT
(In reply to Alex Christensen from comment #12)
> I think the test was checked into the wrong directory.  Instead of putting
> it in LayoutTests/fast/text/system-ui-chinese-bold-fallback.html it was
> checked into fast/text/system-ui-chinese-bold-fallback.html

Fixed in r223901:  <https://trac.webkit.org/changeset/223901>