[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdebase
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2006-09-17 21:25:05
Message-ID: 1158528305.896075.19745.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 585725 by lunakl:
Make it possible to explicitly force 96DPI or 120DPI.
Apparently there are enough people who for some strange
reason think that using the real DPI is a bug.
FEATURE: 111754
Approved by Coolo.
M +58 -5 kcontrol/fonts/fonts.cpp
M +3 -0 kcontrol/fonts/fonts.h
M +5 -1 kcontrol/krdb/krdb.cpp
M +11 -0 startkde
--- branches/KDE/3.5/kdebase/kcontrol/fonts/fonts.cpp #585724:585725
@@ -26,6 +26,7 @@
#include <kipc.h>
#include <kmessagebox.h>
#include <knuminput.h>
+#include <kprocio.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <stdlib.h>
@@ -596,13 +597,39 @@
cbAA = new QCheckBox( i18n( "Use a&nti-aliasing for fonts" ), this);
QWhatsThis::add(cbAA, i18n("If this option is selected, KDE will smooth the edges \
of curves in " "fonts."));
- lay->addStretch();
QPushButton *aaSettingsButton = new QPushButton( i18n( "Configure..." ), this);
connect(aaSettingsButton, SIGNAL(clicked()), SLOT(slotCfgAa()));
connect(cbAA, SIGNAL(toggled(bool)), aaSettingsButton, SLOT(setEnabled(bool)));
lay->addWidget( cbAA );
lay->addWidget( aaSettingsButton );
+ lay->addStretch();
+ lay = new QHBoxLayout( layout, KDialog::spacingHint());
+ cbForceDpi = new QCheckBox( i18n( "Force fonts DPI" ), this );
+ lay->addWidget( cbForceDpi );
+ comboForceDpi = new QComboBox( this );
+ comboForceDpi->insertItem( i18n( "96 DPI" ));
+ comboForceDpi->insertItem( i18n( "120 DPI" ));
+ comboForceDpi->setDisabled( true );
+ QString whatsthis = i18n(
+ "<p>This option forces a specific DPI value for fonts. It may be useful"
+ " when the real DPI of the hardware is not detected properly and it"
+ " is also often misused when poor quality fonts are used that do not"
+ " look well with DPI values other than 96 or 120 DPI.</p>"
+ "<p>The use of this option is generally discouraged. For selecting proper \
DPI" + " value a better option is explicitly configuring it for the whole X \
server if" + " possible (e.g. DisplaySize in xorg.conf or adding <i>-dpi \
value</i> to" + " ServerLocalArgs= in $KDEDIR/share/config/kdm/kdmrc). When \
fonts do not render" + " properly with real DPI value better fonts should be \
used or configuration" + " of font hinting should be checked.</p>" );
+ QWhatsThis::add(cbForceDpi, whatsthis);
+ QWhatsThis::add(comboForceDpi, whatsthis);
+ connect( cbForceDpi, SIGNAL( toggled( bool )), comboForceDpi, SLOT( setEnabled( \
bool ))); + connect( cbForceDpi, SIGNAL( toggled( bool )), SLOT( changed()));
+ connect( comboForceDpi, SIGNAL( activated( int )), SLOT( changed()));
+ lay->addWidget( comboForceDpi );
+ lay->addStretch();
+
layout->addStretch(1);
aaSettings=new FontAASettings(this);
@@ -643,6 +670,13 @@
useAA_original = useAA = aaSettings->load( useDefaults );
cbAA->setChecked(useAA);
+ KConfig cfgfonts("kcmfonts", true);
+ cfgfonts.setGroup("General");
+ int dpi = cfgfonts.readNumEntry( "forceFontDPI", 0 );
+ cbForceDpi->setChecked( dpi == 96 || dpi == 120 );
+ comboForceDpi->setCurrentItem( dpi == 120 ? 1 : 0 );
+ dpi_original = dpi;
+
emit changed( useDefaults );
}
@@ -651,9 +685,27 @@
for ( FontUseItem* i = fontUseList.first(); i; i = fontUseList.next() )
i->writeFont();
-
KGlobal::config()->sync();
+ KConfig cfgfonts("kcmfonts");
+ cfgfonts.setGroup("General");
+ int dpi;
+ if( !cbForceDpi->isChecked())
+ dpi = 0;
+ else
+ dpi = comboForceDpi->currentItem() == 0 ? 96 : 120;
+ cfgfonts.writeEntry( "forceFontDPI", dpi );
+ cfgfonts.sync();
+ // if the setting is reset in the module, remove the dpi value,
+ // otherwise don't explicitly remove it and leave any possible system-wide value
+ if( dpi == 0 && dpi_original != 0 ) {
+ KProcIO proc;
+ proc << "xrdb" << "-quiet" << "-remove" << "-nocpp";
+ proc.writeStdin( QCString( "Xft.dpi" ), true );
+ proc.closeWhenDone();
+ proc.start( KProcess::Block );
+ }
+
// KDE-1.x support
KSimpleConfig* config = new KSimpleConfig( QDir::homeDirPath() + "/.kderc" );
config->setGroup( "General" );
@@ -670,12 +722,13 @@
kapp->processEvents(); // Process font change ourselves
- if(aaSettings->save( useAA ) || (useAA != useAA_original) ) {
+ if(aaSettings->save( useAA ) || (useAA != useAA_original) || dpi != dpi_original) \
{ KMessageBox::information(this,
i18n(
- "<p>You have changed anti-aliasing related settings. This change will only \
affect newly started applications.</p>"
- ), i18n("Anti-Aliasing Settings Changed"), "AAsettingsChanged", false);
+ "<p>Some changes such as anti-aliasing will only affect newly started \
applications.</p>" + ), i18n("Font Settings Changed"), "FontSettingsChanged", \
false); useAA_original = useAA;
+ dpi_original = dpi;
}
runRdb(KRdbExportXftSettings);
--- branches/KDE/3.5/kdebase/kcontrol/fonts/fonts.h #585724:585725
@@ -110,7 +110,10 @@
private:
bool useAA, useAA_original;
+ int dpi_original;
QCheckBox *cbAA;
+ QCheckBox *cbForceDpi;
+ QComboBox* comboForceDpi;
QPtrList <FontUseItem> fontUseList;
FontAASettings *aaSettings;
};
--- branches/KDE/3.5/kdebase/kcontrol/krdb/krdb.cpp #585724:585725
@@ -34,7 +34,7 @@
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kstandarddirs.h>
-#include <kprocess.h>
+#include <kprocio.h>
#include <ksavefile.h>
#include <ktempfile.h>
#include <klocale.h>
@@ -533,6 +533,10 @@
}
if(!subPixel.isEmpty())
contents += "Xft.rgba: " + subPixel + '\n';
+ KConfig cfgfonts("kcmfonts", true);
+ cfgfonts.setGroup("General");
+ if( cfgfonts.readNumEntry( "forceFontDPI", 0 ) != 0 )
+ contents += "Xft.dpi: " + cfgfonts.readEntry( "forceFontDPI" ) + '\n';
}
if (contents.length() > 0)
--- branches/KDE/3.5/kdebase/startkde #585724:585725
@@ -68,6 +68,7 @@
kcmrandrrc [Screen1]
kcmrandrrc [Screen2]
kcmrandrrc [Screen3]
+kcmfonts General forceFontDPI 0
EOF
kstartupconfig
if test $? -ne 0; then
@@ -146,6 +147,16 @@
esac
fi
+if test "$kcmfonts_general_forcefontdpi" -eq 120; then
+ xrdb -quiet -merge -nocpp <<EOF
+Xft.dpi: 120
+EOF
+elif test "$kcmfonts_general_forcefontdpi" -eq 96; then
+ xrdb -quiet -merge -nocpp <<EOF
+Xft.dpi: 96
+EOF
+fi
+
# Source scripts found in <localprefix>/env/*.sh and <prefixes>/env/*.sh
# (where <localprefix> is $KDEHOME or ~/.kde, and <prefixes> is where KDE is \
installed) #
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic