Bug 146333 - [Cocoa] Sans-serif generic font family should map to PingFang
Summary: [Cocoa] Sans-serif generic font family should map to PingFang
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords:
Depends on:
Blocks: 146385
  Show dependency treegraph
 
Reported: 2015-06-25 17:45 PDT by Myles C. Maxfield
Modified: 2015-06-27 08:48 PDT (History)
5 users (show)

See Also:


Attachments
Patch (156.32 KB, patch)
2015-06-25 17:46 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (1.06 MB, application/zip)
2015-06-25 18:05 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews103 for mac-mavericks (872.62 KB, application/zip)
2015-06-25 18:20 PDT, Build Bot
no flags Details
Patch (14.56 KB, patch)
2015-06-25 19:43 PDT, Myles C. Maxfield
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2015-06-25 17:45:44 PDT
[Cocoa] Sans-serif generic font family should map to PingFang
Comment 1 Myles C. Maxfield 2015-06-25 17:46:49 PDT
Created attachment 255603 [details]
Patch
Comment 2 Myles C. Maxfield 2015-06-25 17:49:23 PDT
Comment on attachment 255603 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255603&action=review

> Source/WebCore/ChangeLog:4
> +        https://bugs.webkit.org/show_bug.cgi?id=146333

Need radar number
Comment 3 Myles C. Maxfield 2015-06-25 18:00:43 PDT
Comment on attachment 255603 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255603&action=review

> LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.txt:1
> +layer at (0,0) size 800x600

Turn this in to a reftest
Comment 4 Myles C. Maxfield 2015-06-25 18:04:45 PDT
Comment on attachment 255603 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255603&action=review

> LayoutTests/fast/text/han-generic-font-families.html:13
> +    d.textContent = "此段中æç®ä½ææ¬ç¨äºæµè§å¨å¸å±æµè¯ã";

Woah this is a mistake
Comment 5 Build Bot 2015-06-25 18:05:51 PDT
Comment on attachment 255603 [details]
Patch

Attachment 255603 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/6722903991123968

New failing tests:
fast/text/han-generic-font-families.html
Comment 6 Build Bot 2015-06-25 18:05:55 PDT
Created attachment 255605 [details]
Archive of layout-test-results from ews104 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 7 Build Bot 2015-06-25 18:19:58 PDT
Comment on attachment 255603 [details]
Patch

Attachment 255603 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5472806514982912

New failing tests:
fast/text/han-generic-font-families.html
Comment 8 Build Bot 2015-06-25 18:20:01 PDT
Created attachment 255607 [details]
Archive of layout-test-results from ews103 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 9 Myles C. Maxfield 2015-06-25 19:43:37 PDT
Created attachment 255615 [details]
Patch
Comment 10 Alexey Proskuryakov 2015-06-25 22:41:08 PDT
Comment on attachment 255615 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255615&action=review

We really need to kill this code, and to use APIs for language specific font fallback.

> Source/WebCore/page/mac/SettingsMac.mm:49
> +#if PLATFORM(COCOA)

Did you mean PLATFORM(MAC)?

> Source/WebCore/page/mac/SettingsMac.mm:-72
> -#if PLATFORM(COCOA)

Looks like some old mass replace mistake.
Comment 11 Myles C. Maxfield 2015-06-26 10:25:14 PDT
(In reply to comment #10)
> Comment on attachment 255615 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255615&action=review
> 
> We really need to kill this code, and to use APIs for language specific font
> fallback.

I'm not actually sure that makes sense. Which font do we use for fallback? Do we still want to hardcode Latin fonts and fall back from those? Why is Latin special?

(Maybe Latin is special because it is the only script where the concepts of "serif" and "sans serif" are really applicable)

Using naive fallback is troublesome because of some markup like "font-family: sans-serif, 'Heiti SC'". We want the sans-serif to match so that Heiti isn't rendered. Another option would be to keep the same structure, but locally probe what the fallback would be inside CoreText; this seems a little silly because we're mapping a known value to a known value. But then again, the mapping might change over time, so maybe it is valuable to dynamically create the mapping.

> 
> > Source/WebCore/page/mac/SettingsMac.mm:49
> > +#if PLATFORM(COCOA)
> 
> Did you mean PLATFORM(MAC)?
> 
> > Source/WebCore/page/mac/SettingsMac.mm:-72
> > -#if PLATFORM(COCOA)
> 
> Looks like some old mass replace mistake.
Comment 12 Myles C. Maxfield 2015-06-26 10:28:23 PDT
Committed r186001: <http://trac.webkit.org/changeset/186001>
Comment 13 Myles C. Maxfield 2015-06-26 10:30:28 PDT
(In reply to comment #11)
> (In reply to comment #10)
> > Comment on attachment 255615 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=255615&action=review
> > 
> > We really need to kill this code, and to use APIs for language specific font
> > fallback.
> 
> I'm not actually sure that makes sense. Which font do we use for fallback?
> Do we still want to hardcode Latin fonts and fall back from those? Why is
> Latin special?
> 
> (Maybe Latin is special because it is the only script where the concepts of
> "serif" and "sans serif" are really applicable)
> 
> Using naive fallback is troublesome because of some markup like
> "font-family: sans-serif, 'Heiti SC'". We want the sans-serif to match so
> that Heiti isn't rendered. Another option would be to keep the same
> structure, but locally probe what the fallback would be inside CoreText;
> this seems a little silly because we're mapping a known value to a known
> value. But then again, the mapping might change over time, so maybe it is
> valuable to dynamically create the mapping.

Oh, another thought - this code runs on web process creation. Doing a bunch of CT calls might actually cause a performance hit

> 
> > 
> > > Source/WebCore/page/mac/SettingsMac.mm:49
> > > +#if PLATFORM(COCOA)
> > 
> > Did you mean PLATFORM(MAC)?
> > 
> > > Source/WebCore/page/mac/SettingsMac.mm:-72
> > > -#if PLATFORM(COCOA)
> > 
> > Looks like some old mass replace mistake.
Comment 14 David Kilzer (:ddkilzer) 2015-06-27 08:48:58 PDT
This caused:

Bug 146385: REGRESSION (r186001): fast/text/han-generic-font-families.html always fails on Yosemite
<https://bugs.webkit.org/show_bug.cgi?id=146385>