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

Unified Diff: Source/platform/fonts/linux/FontPlatformDataLinux.cpp

Issue 407553002: [Linux] Enable subpixel text on high-dpi regardless of hinting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase w/head Created 6 years, 5 months 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
« no previous file with comments | « Source/core/rendering/RenderLayer.cpp ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/linux/FontPlatformDataLinux.cpp
diff --git a/Source/platform/fonts/linux/FontPlatformDataLinux.cpp b/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
index ab12969ab5dfe270a6343755d1a389a01b5d8611..9be3655e6edac86e32c33e710f57d8553328490b 100644
--- a/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
+++ b/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
@@ -35,6 +35,7 @@
#include "platform/LayoutTestSupport.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/fonts/harfbuzz/FontPlatformDataHarfBuzz.h"
+#include "platform/graphics/GraphicsContext.h"
#include "public/platform/linux/WebFontInfo.h"
#include "public/platform/linux/WebFontRenderStyle.h"
#include "public/platform/linux/WebSandboxSupport.h"
@@ -72,7 +73,8 @@ void FontPlatformData::setSubpixelRendering(bool useSubpixelRendering)
useSkiaSubpixelRendering = useSubpixelRendering;
}
-void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*) const
+void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context)
+ const
{
paint->setAntiAlias(m_style.useAntiAlias);
paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle));
@@ -81,10 +83,13 @@ void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*) const
if (m_style.useAntiAlias)
paint->setLCDRenderText(m_style.useSubpixelRendering);
+ // Do not enable subpixel text on low-dpi if full hinting is requested.
+ bool useSubpixelText = RuntimeEnabledFeatures::subpixelFontScalingEnabled()
+ && context && (paint->getHinting() != SkPaint::kFull_Hinting
+ || context->deviceScaleFactor() > 1.0f);
+
// TestRunner specifically toggles the subpixel positioning flag.
- if (RuntimeEnabledFeatures::subpixelFontScalingEnabled()
- && paint->getHinting() != SkPaint::kFull_Hinting
- && !LayoutTestSupport::isRunningLayoutTest())
+ if (useSubpixelText && !LayoutTestSupport::isRunningLayoutTest())
paint->setSubpixelText(true);
else
paint->setSubpixelText(m_style.useSubpixelPositioning);
« no previous file with comments | « Source/core/rendering/RenderLayer.cpp ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698