Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1436)

Unified Diff: Source/platform/fonts/mac/FontPlatformDataMac.mm

Issue 692643006: Restore webkit-font-smoothing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Actually suppress flaky tests. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/fonts/mac/FontPlatformDataMac.mm
diff --git a/Source/platform/fonts/mac/FontPlatformDataMac.mm b/Source/platform/fonts/mac/FontPlatformDataMac.mm
index 833692d9cc280454631886462a48552a7b960692..8fd334b56354753ca44c99285ad698f7c0e27d5e 100644
--- a/Source/platform/fonts/mac/FontPlatformDataMac.mm
+++ b/Source/platform/fonts/mac/FontPlatformDataMac.mm
@@ -30,6 +30,7 @@
#include "platform/LayoutTestSupport.h"
#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/fonts/Font.h"
#import "platform/fonts/shaping/HarfBuzzFace.h"
#include "third_party/skia/include/ports/SkTypeface_mac.h"
@@ -44,7 +45,7 @@ unsigned FontPlatformData::hash() const
return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
}
-void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*) const
+void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*, const Font* font) const
{
bool shouldSmoothFonts = true;
bool shouldAntialias = true;
@@ -61,10 +62,14 @@ void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*) const
paint->setTypeface(typeface());
paint->setFakeBoldText(m_syntheticBold);
paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0);
- paint->setAutohinted(false); // freetype specific
paint->setLCDRenderText(shouldSmoothFonts);
paint->setSubpixelText(useSubpixelText);
- paint->setHinting(SkPaint::kNo_Hinting);
+
+ // When rendering using CoreGraphics, disable hinting when webkit-font-smoothing:antialiased or
+ // text-rendering:geometricPrecision is used.
+ // See crbug.com/152304
+ if (font && (font->fontDescription().fontSmoothing() == Antialiased || font->fontDescription().textRendering() == GeometricPrecision))
+ paint->setHinting(SkPaint::kNo_Hinting);
}
// These CoreText Text Spacing feature selectors are not defined in CoreText.
« no previous file with comments | « Source/platform/fonts/linux/FontPlatformDataLinux.cpp ('k') | Source/platform/fonts/win/FontPlatformDataWin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698