Title: [197573] trunk
Revision
197573
Author
[email protected]
Date
2016-03-04 11:09:37 -0800 (Fri, 04 Mar 2016)

Log Message

Whitespace causes font-variant: all-small-caps to synthesize
https://bugs.webkit.org/show_bug.cgi?id=155004
<rdar://problem/24630796>

Reviewed by Darin Adler.

Source/WebCore:

Many fonts (such as Avenir Next) don't report to support whitespace characters under
smcp or c2sc. Previously, we were using this as a signal to synthesize small caps
instead of true small caps. However, a better solution is for whitespace to never
cause synthesis with all-small-caps.

Test: fast/text/all-small-caps-whitespace.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::shouldSynthesize):
(WebCore::ComplexTextController::collectComplexTextRuns):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(allowedFontFamilySet):
* WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
(WTR::allowedFontFamilySet):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::allowedFontFamilySet):

LayoutTests:

* fast/text/all-small-caps-whitespace-expected.html: Added.
* fast/text/all-small-caps-whitespace.html: Added.
* platform/mac/TestExpectations: Skip on platforms which don't support proper coverage
queries.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197572 => 197573)


--- trunk/LayoutTests/ChangeLog	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/LayoutTests/ChangeLog	2016-03-04 19:09:37 UTC (rev 197573)
@@ -1,3 +1,16 @@
+2016-03-04  Myles C. Maxfield  <[email protected]>
+
+        Whitespace causes font-variant: all-small-caps to synthesize
+        https://bugs.webkit.org/show_bug.cgi?id=155004
+        <rdar://problem/24630796>
+
+        Reviewed by Darin Adler.
+
+        * fast/text/all-small-caps-whitespace-expected.html: Added.
+        * fast/text/all-small-caps-whitespace.html: Added.
+        * platform/mac/TestExpectations: Skip on platforms which don't support proper coverage
+        queries.
+
 2016-03-04  Simon Fraser  <[email protected]>
 
         REGRESSION (r197541): many tiled drawing tests failing after new "large tile size" logic was added

Added: trunk/LayoutTests/fast/text/all-small-caps-whitespace-expected.html (0 => 197573)


--- trunk/LayoutTests/fast/text/all-small-caps-whitespace-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/all-small-caps-whitespace-expected.html	2016-03-04 19:09:37 UTC (rev 197573)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that font-variant: all-small-caps doesn't cause synthesis due to whitespace. Avenir Next says that it supports all of the following characters except the space. This space character should not make us synthesize.
+<div style="font: 100px 'Avenir Next'; font-feature-settings: 'smcp', 'c2sc';">Hello Kitty!</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/all-small-caps-whitespace.html (0 => 197573)


--- trunk/LayoutTests/fast/text/all-small-caps-whitespace.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/all-small-caps-whitespace.html	2016-03-04 19:09:37 UTC (rev 197573)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that font-variant: all-small-caps doesn't cause synthesis due to whitespace. Avenir Next says that it supports all of the following characters except the space. This space character should not make us synthesize.
+<div style="font: 100px 'Avenir Next'; font-variant: all-small-caps;">Hello Kitty!</div>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (197572 => 197573)


--- trunk/LayoutTests/platform/mac/TestExpectations	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2016-03-04 19:09:37 UTC (rev 197573)
@@ -1296,6 +1296,7 @@
 # Yosemite and El Capitan do not support font feature coverage queries.
 [ Yosemite ElCapitan ] css3/font-variant-small-caps-synthesis-coverage.html [ ImageOnlyFailure ]
 [ Yosemite ElCapitan ] css3/font-variant-petite-caps-synthesis-coverage.html [ ImageOnlyFailure ]
+[ Yosemite ElCapitan ] fast/text/all-small-caps-whitespace.html [ ImageOnlyFailure ]
 
 # Temporarily disable font feature synthesis tests.
 [ Yosemite ElCapitan ] css3/font-variant-small-caps-synthesis.html [ ImageOnlyFailure ]
@@ -1328,3 +1329,4 @@
 webkit.org/b/152506 webgl/1.0.2/conformance/extensions/get-extension.html [ Pass Timeout ]
 
 webkit.org/b/154709 [ ElCapitan+ ] fast/text/crash-complex-text-surrogate.html [ Pass Failure ]
+

Modified: trunk/Source/WebCore/ChangeLog (197572 => 197573)


--- trunk/Source/WebCore/ChangeLog	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/Source/WebCore/ChangeLog	2016-03-04 19:09:37 UTC (rev 197573)
@@ -1,5 +1,24 @@
 2016-03-04  Myles C. Maxfield  <[email protected]>
 
+        Whitespace causes font-variant: all-small-caps to synthesize
+        https://bugs.webkit.org/show_bug.cgi?id=155004
+        <rdar://problem/24630796>
+
+        Reviewed by Darin Adler.
+
+        Many fonts (such as Avenir Next) don't report to support whitespace characters under
+        smcp or c2sc. Previously, we were using this as a signal to synthesize small caps
+        instead of true small caps. However, a better solution is for whitespace to never
+        cause synthesis with all-small-caps.
+
+        Test: fast/text/all-small-caps-whitespace.html
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::shouldSynthesize):
+        (WebCore::ComplexTextController::collectComplexTextRuns):
+
+2016-03-04  Myles C. Maxfield  <[email protected]>
+
         [iOS] Crash during font loading when injected bundle cancels load
         https://bugs.webkit.org/show_bug.cgi?id=155001
 

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (197572 => 197573)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2016-03-04 19:09:37 UTC (rev 197573)
@@ -304,6 +304,17 @@
     return Nullopt;
 }
 
+static bool shouldSynthesize(const Font* nextFont, UChar32 baseCharacter, Optional<UChar32> capitalizedBase, FontVariantCaps fontVariantCaps, bool engageAllSmallCapsProcessing)
+{
+    if (!nextFont || nextFont == Font::systemFallback())
+        return false;
+    if (engageAllSmallCapsProcessing && isASCIISpace(baseCharacter))
+        return false;
+    if (!engageAllSmallCapsProcessing && !capitalizedBase)
+        return false;
+    return !nextFont->variantCapsSupportsCharacterForSynthesis(fontVariantCaps, baseCharacter);
+}
+
 void ComplexTextController::collectComplexTextRuns()
 {
     if (!m_end)
@@ -346,8 +357,7 @@
     bool nextIsSmallCaps = false;
 
     auto capitalizedBase = capitalized(baseCharacter);
-    if (nextFont && nextFont != Font::systemFallback() && (capitalizedBase || engageAllSmallCapsProcessing)
-        && !nextFont->variantCapsSupportsCharacterForSynthesis(fontVariantCaps, baseCharacter)) {
+    if (shouldSynthesize(nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) {
         synthesizedFont = &nextFont->noSynthesizableFeaturesFont();
         smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription());
         UChar32 characterToWrite = capitalizedBase ? capitalizedBase.value() : cp[0];
@@ -388,8 +398,7 @@
             nextFont = m_font.fontForCombiningCharacterSequence(cp + index, curr - cp - index);
 
         capitalizedBase = capitalized(baseCharacter);
-        if (!synthesizedFont && nextFont && nextFont != Font::systemFallback() && (capitalizedBase || engageAllSmallCapsProcessing)
-            && !nextFont->variantCapsSupportsCharacterForSynthesis(fontVariantCaps, baseCharacter)) {
+        if (!synthesizedFont && shouldSynthesize(nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) {
             // Rather than synthesize each character individually, we should synthesize the entire "run" if any character requires synthesis.
             synthesizedFont = &nextFont->noSynthesizableFeaturesFont();
             smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription());

Modified: trunk/Tools/ChangeLog (197572 => 197573)


--- trunk/Tools/ChangeLog	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/Tools/ChangeLog	2016-03-04 19:09:37 UTC (rev 197573)
@@ -1,5 +1,20 @@
 2016-03-04  Myles C. Maxfield  <[email protected]>
 
+        Whitespace causes font-variant: all-small-caps to synthesize
+        https://bugs.webkit.org/show_bug.cgi?id=155004
+        <rdar://problem/24630796>
+
+        Reviewed by Darin Adler.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (allowedFontFamilySet):
+        * WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
+        (WTR::allowedFontFamilySet):
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::allowedFontFamilySet):
+
+2016-03-04  Myles C. Maxfield  <[email protected]>
+
         [iOS] Crash during font loading when injected bundle cancels load
         https://bugs.webkit.org/show_bug.cgi?id=155001
 

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (197572 => 197573)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-03-04 19:09:37 UTC (rev 197573)
@@ -319,6 +319,7 @@
         @"Arial Rounded MT Bold",
         @"Arial Unicode MS",
         @"Arial",
+        @"Avenir Next",
         @"Ayuthaya",
         @"Baghdad",
         @"Baskerville",

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm (197572 => 197573)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm	2016-03-04 19:09:37 UTC (rev 197573)
@@ -68,6 +68,7 @@
         @"Arial Rounded MT Bold",
         @"Arial Unicode MS",
         @"Arial",
+        @"Avenir Next",
         @"Ayuthaya",
         @"Baghdad",
         @"Baskerville",

Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (197572 => 197573)


--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2016-03-04 19:05:00 UTC (rev 197572)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2016-03-04 19:09:37 UTC (rev 197573)
@@ -149,6 +149,7 @@
         @"Arial Rounded MT Bold",
         @"Arial Unicode MS",
         @"Arial",
+        @"Avenir Next",
         @"Ayuthaya",
         @"Baghdad",
         @"Baskerville",
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to