Bug 82427 - Cannot turn sub-pixel rendering off
Summary: Cannot turn sub-pixel rendering off
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Unmaintained
Component: kcmfonts (other bugs)
Version First Reported In: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Daniel Molkentin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-29 07:57 UTC by Jeremy Stanley
Modified: 2005-10-07 15:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Stanley 2004-05-29 07:57:01 UTC
Version:            (using KDE KDE 3.2.2)
Installed from:    RedHat RPMs
Compiler:          gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7) 
OS:                Linux

I can't turn off sub-pixel hinting with kcontrol.  I can change modes between RGB, BGR, VRGB, and VBGR with no difficulty, but when sub-pixel hinting is supposedly turned off, I still get RGB hinting.

System:  Clean install of Fedora Core 2 on an HP Pavilion ze4240 laptop (1024x768 LCD with Radeon Mobility U1 graphics).  The problem does not affect my desktop (which as a CRT monitor); I believe KDE notices my laptop's LCD and "helpfully" enables sub-pixel rendering without being asked.  Unchecking the option in kcontrol has no effect.
Comment 1 Jeremy Stanley 2004-05-29 18:20:50 UTC
Okay, I think I've figured out what the problem is.  KDE's font configurator comments out the subpixel hinting section from fonts.conf when you uncheck "sub-pixel hinting".  However, KDE seems to use RGB by default if nothing is selected.  If I explicitly set rgba=none in fonts.conf, then sub-pixel rendering is turned off.
Comment 2 Jeremy Stanley 2004-05-29 18:26:23 UTC
To clarify:  KDE seems to use RGB by default if nothing is selected AND the display is a digitally-connected LCD.
Comment 3 Nicos Gollan 2005-04-05 23:35:37 UTC
This is still a bug in 3.3.2. Just inserting this XML stanza in ~/.fonts.conf solves the problem for good:

<match target="font">
  <edit name="rgba" mode="assign"><const>none</const></edit>
</match>

The bad thing is that there doesn't seem to be a place to put settings that kcontrol won't overwrite on the next apply, so this is rather serious.
Comment 4 Sebastien ROHAUT 2005-08-09 08:57:00 UTC
I confirm this problem on Fedora Core 4 and KDE 3.4.2. Very ugly fonts on my nc6000 laptop. In fact, I never, never, seen a case where sub-pixel hinting gives best results on a LCD screen. Why can't we disable it ?
Comment 5 Lubos Lunak 2005-10-07 15:43:47 UTC
SVN commit 468231 by lunakl:

Remove the (AFAIK) nonsensical greyscale subpixel hinting style
(r355454) and instead always write the changed setting in order
to override the global defaults.
BUG: 82427



 M  +1 -22     fonts.cpp  
 M  +21 -47    kxftconfig.cpp  
 M  +0 -1      kxftconfig.h  


--- trunk/KDE/kdebase/workspace/kcontrol/fonts/fonts.cpp #468230:468231
@@ -50,26 +50,6 @@
 #undef Unsorted
 #undef None
 
-static const char *aa_greyscale_xpm[]={
-"12 12 6 1",
-"a c #dcdcdc",
-"b c #c3c3c3",
-"c c #a0a0a0",
-"d c #808080",
-"e c #585858",
-"f c #303030",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa",
-"ffeeddccbbaa"};
 static const char *aa_rgb_xpm[]={
 "12 12 3 1",
 "a c #0000ff",
@@ -139,8 +119,7 @@
 "aaaaaaaaaaaa",
 "aaaaaaaaaaaa"};
 
-static QPixmap aaPixmaps[]={ QPixmap(aa_greyscale_xpm), QPixmap(aa_rgb_xpm),
-                             QPixmap(aa_bgr_xpm), QPixmap(aa_vrgb_xpm), QPixmap(aa_vbgr_xpm) };
+static QPixmap aaPixmaps[]={ QPixmap(aa_rgb_xpm), QPixmap(aa_bgr_xpm), QPixmap(aa_vrgb_xpm), QPixmap(aa_vbgr_xpm) };
 
 /**** DLL Interface ****/
 typedef KGenericFactory<KFonts, QWidget> FontFactory;
--- trunk/KDE/kdebase/workspace/kcontrol/fonts/kxftconfig.cpp #468230:468231
@@ -257,9 +257,7 @@
 
 static KXftConfig::SubPixel::Type strToType(const char *str)
 {
-    if(0==strcmp(str, "\0"))
-        return KXftConfig::SubPixel::Greyscale;
-    else if(0==strcmp(str, "rgb"))
+    if(0==strcmp(str, "rgb"))
         return KXftConfig::SubPixel::Rgb;
     else if(0==strcmp(str, "bgr")) 
         return KXftConfig::SubPixel::Bgr;
@@ -286,9 +284,7 @@
 #else
 static bool strToType(const char *str, KXftConfig::SubPixel::Type &type)
 {   
-    if(0==memcmp(str, "\0", 1))
-        type=KXftConfig::SubPixel::Greyscale;
-    else if(0==memcmp(str, "rgb", 3))
+    if(0==memcmp(str, "rgb", 3))
         type=KXftConfig::SubPixel::Rgb;
     else if(0==memcmp(str, "bgr", 3))
         type=KXftConfig::SubPixel::Bgr;
@@ -777,21 +773,14 @@
 
 bool KXftConfig::getSubPixelType(SubPixel::Type &type)
 {
-    if(SubPixel::None!=m_subPixel.type && !m_subPixel.toBeRemoved)
-    {
-        type=m_subPixel.type;
-        return true;
-    }
-    else
-        return false;
+    type=m_subPixel.type;
+    return SubPixel::None!=m_subPixel.type;
 }
 
 void KXftConfig::setSubPixelType(SubPixel::Type type)
 {
-    if((SubPixel::None==type && SubPixel::None!=m_subPixel.type && !m_subPixel.toBeRemoved) ||
-       (SubPixel::None!=type && (type!=m_subPixel.type || m_subPixel.toBeRemoved)) )
+    if(type!=m_subPixel.type)
     {
-        m_subPixel.toBeRemoved=(SubPixel::None==type);
         m_subPixel.type=type;
         m_madeChanges=true;
     }
@@ -881,8 +870,6 @@
         default:
         case SubPixel::None:
             return i18n("None");
-        case SubPixel::Greyscale:
-            return i18n("Grayscale");
         case SubPixel::Rgb:
             return i18n("RGB");
         case SubPixel::Bgr:
@@ -901,8 +888,6 @@
         default:
         case SubPixel::None:
             return "none";
-        case SubPixel::Greyscale:
-            return "";
         case SubPixel::Rgb:
             return "rgb";
         case SubPixel::Bgr:
@@ -1273,33 +1258,22 @@
 
 void KXftConfig::applySubPixelType()
 {
-    if(SubPixel::None==m_subPixel.type || m_subPixel.toBeRemoved)
-    {
-        if(!m_subPixel.node.isNull())
-        {
-            m_doc.documentElement().removeChild(m_subPixel.node);
-            m_subPixel.node.clear();
-        }
-    }
-    else
-    {
-        QDomElement matchNode = m_doc.createElement("match"),
-                    typeNode  = m_doc.createElement("const"),
-                    editNode  = m_doc.createElement("edit");
-        QDomText    typeText  = m_doc.createTextNode(toStr(m_subPixel.type));
+    QDomElement matchNode = m_doc.createElement("match"),
+                typeNode  = m_doc.createElement("const"),
+                editNode  = m_doc.createElement("edit");
+    QDomText    typeText  = m_doc.createTextNode(toStr(m_subPixel.type));
 
-        matchNode.setAttribute("target", "font");
-        editNode.setAttribute("mode", "assign");
-        editNode.setAttribute("name", "rgba");
-        editNode.appendChild(typeNode);
-        typeNode.appendChild(typeText);
-        matchNode.appendChild(editNode);
-        if(m_subPixel.node.isNull())
-            m_doc.documentElement().appendChild(matchNode);
-        else
-            m_doc.documentElement().replaceChild(matchNode, m_subPixel.node);
-        m_subPixel.node=matchNode;
-    }
+    matchNode.setAttribute("target", "font");
+    editNode.setAttribute("mode", "assign");
+    editNode.setAttribute("name", "rgba");
+    editNode.appendChild(typeNode);
+    typeNode.appendChild(typeText);
+    matchNode.appendChild(editNode);
+    if(m_subPixel.node.isNull())
+        m_doc.documentElement().appendChild(matchNode);
+    else
+        m_doc.documentElement().replaceChild(matchNode, m_subPixel.node);
+    m_subPixel.node=matchNode;
 }
 
 void KXftConfig::applyHintStyle()
@@ -1454,7 +1428,7 @@
 
 void KXftConfig::outputSubPixelType(std::ofstream &f, bool ifNew)
 {
-    if(!m_subPixel.toBeRemoved && ((ifNew && NULL==m_subPixel.end) || (!ifNew && NULL!=m_subPixel.end)) && SubPixel::None!=m_subPixel.type)
+    if((ifNew && NULL==m_subPixel.end) || (!ifNew && NULL!=m_subPixel.end))
         f << "match edit rgba = " << toStr(m_subPixel.type) << ';' << endl;
 }
 
--- trunk/KDE/kdebase/workspace/kcontrol/fonts/kxftconfig.h #468230:468231
@@ -89,7 +89,6 @@
         enum Type
         {
             None,
-            Greyscale,
             Rgb,
             Bgr,
             Vrgb,