freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] update on gamma correction and freetype


From: Markus Trippelsdorf
Subject: [ft-devel] update on gamma correction and freetype
Date: Sat, 21 Mar 2015 23:22:32 +0100

As a quick follow up on the interesting discussion from 2013 here is how
you can enable gamma 1.8 for text blending in qt5 and the Chromium
browser on Linux. It will look best with fonts that use freetype's CFF
rasterizer and of course one could play with different gamma values (1.8
just looks best to me).

For qt5 you need to patch qtbase:

diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp 
b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 258359d20f28..8181aeaf5c8b 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -357,7 +357,7 @@ QVariant 
QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
         break; // Not implemented, use defaults
     case QPlatformIntegration::FontSmoothingGamma:
         // Match Qt 4.8 text rendering, and rendering of other X11 toolkits.
-        return qreal(1.0);
+        return qreal(1.8);
     case QPlatformIntegration::StartDragDistance: {
         // The default (in QPlatformTheme::defaultThemeHint) is 10 pixels, but
         // on a high-resolution screen it makes sense to increase it.

For Chromium, src/third_party/skia needs to be patched:

diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index d08f68a1d91c..97fec8b47826 100644
--- a/include/core/SkPostConfig.h
+++ b/include/core/SkPostConfig.h
@@ -389,12 +389,9 @@
 
 //////////////////////////////////////////////////////////////////////
 
-#if defined(SK_GAMMA_EXPONENT) && defined(SK_GAMMA_SRGB)
-#  error "cannot define both SK_GAMMA_EXPONENT and SK_GAMMA_SRGB"
-#elif defined(SK_GAMMA_SRGB)
-#  define SK_GAMMA_EXPONENT (0.0f)
-#elif !defined(SK_GAMMA_EXPONENT)
-#  define SK_GAMMA_EXPONENT (2.2f)
-#endif
+#undef SK_GAMMA_EXPONENT
+#undef SK_GAMMA_CONTRAST
+#  define SK_GAMMA_EXPONENT (1.8f)
+#  define SK_GAMMA_CONTRAST (0.0f)
 
 #endif // SkPostConfig_DEFINED

-- 
Markus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]