[cairo-bugs] [Bug 28549] Gamma-corrected alpha blending for text output

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Aug 8 02:55:11 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=28549

--- Comment #5 from octoploid <octoploid at yandex.com> ---
I think the consensus is that this is not a freetype bug.

If you use qt-5 (KDE) you can get nice alpha blended fonts if you 
set  QPlatformIntegration::FontSmoothingGamma to 1.8.

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.

Similarly for Chromium you can get alpha blended fonts with a simple patch:

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

The reason this is not the default is because most people use crappy
TrueType fonts. And for them a gamma of 1.8 will make look fonts too light.

You really have to use freetype's new CFF engine to get good results.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20150808/fe72a502/attachment.html>


More information about the cairo-bugs mailing list