Disable hinting when webkit-font-smoothing:antialiased is used on Mac.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 20:06:21 +0000 (20:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 20:06:21 +0000 (20:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98061

Patch by Ben Wagner <bungeman@chromium.org> on 2012-10-09
Reviewed by Stephen White.

Normal anti-aliased text matches subpixel anti-aliased text.
However, text marked with webkit-font-smoothing:antialiased should be drawn without hinting to match Safari.
See crbug.com/152304 .

Test is fast/css/font-smoothing.html, but DRT runs with font smoothing disabled, so no change visible.

* platform/graphics/skia/FontSkia.cpp:
(WebCore::setupPaint):
Set kNo_Hinting when webkit-font-smoothing is antialiased.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130800 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/skia/FontSkia.cpp

index 2b005e9..40001eb 100644 (file)
@@ -1,3 +1,20 @@
+2012-10-09  Ben Wagner  <bungeman@chromium.org>
+
+        Disable hinting when webkit-font-smoothing:antialiased is used on Mac.
+        https://bugs.webkit.org/show_bug.cgi?id=98061
+
+        Reviewed by Stephen White.
+
+        Normal anti-aliased text matches subpixel anti-aliased text.
+        However, text marked with webkit-font-smoothing:antialiased should be drawn without hinting to match Safari.
+        See crbug.com/152304 . 
+
+        Test is fast/css/font-smoothing.html, but DRT runs with font smoothing disabled, so no change visible. 
+
+        * platform/graphics/skia/FontSkia.cpp:
+        (WebCore::setupPaint):
+        Set kNo_Hinting when webkit-font-smoothing is antialiased.
+
 2012-10-09  Max Vujovic  <mvujovic@adobe.com>
 
         [CSS Shaders] Create constants for vertex attribute sizes and offsets
index 8d5649d..00ca1cc 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "Font.h"
 
+#include "FontSmoothingMode.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContext.h"
 #include "LayoutTestSupport.h"
@@ -71,6 +72,13 @@ static void setupPaint(SkPaint* paint, const SimpleFontData* fontData, const Fon
     paint->setAutohinted(false); // freetype specific
     paint->setLCDRenderText(shouldSmoothFonts);
     paint->setSubpixelText(true);
+
+#if OS(DARWIN)
+    // When using CoreGraphics, disable hinting when webkit-font-smoothing:antialiased is used.
+    // See crbug.com/152304
+    if (font->fontDescription().fontSmoothing() == Antialiased)
+        paint->setHinting(SkPaint::kNo_Hinting);
+#endif
     
     if (font->fontDescription().textRenderingMode() == GeometricPrecision)
         paint->setHinting(SkPaint::kNo_Hinting);