| Summary: | Font Manager Needs the Ability to Control Font DPI | ||
|---|---|---|---|
| Product: | [Unmaintained] kcontrol | Reporter: | Matt T. Proud <khanreaper> |
| Component: | general | Assignee: | Daniel Molkentin <molkentin> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | CC: | asraniel, l.lunak, yhager |
| Priority: | NOR | ||
| Version First Reported In: | 3.4.1 | ||
| Target Milestone: | --- | ||
| Platform: | Gentoo Packages | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Matt T. Proud
2005-08-30 10:30:50 UTC
*** This bug has been confirmed by popular vote. *** *** Bug 124637 has been marked as a duplicate of this bug. *** SVN commit 542498 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
M +36 -5 kcontrol/fonts/fonts.cpp
M +3 -0 kcontrol/fonts/fonts.h
M +13 -1 kcontrol/krdb/krdb.cpp
M +11 -0 startkde
--- trunk/KDE/kdebase/workspace/kcontrol/fonts/fonts.cpp #542497:542498
@@ -618,13 +618,26 @@
cbAA = new QCheckBox( i18n( "Use a&nti-aliasing for fonts" ), this);
cbAA->setWhatsThis( 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());
+ cbDpi = new QCheckBox( i18n( "Force DPI" ), this );
+ lay->addWidget( cbDpi );
+ comboDpi = new QComboBox( this );
+ comboDpi->insertItem( i18n( "Normal fonts (96 DPI)" ));
+ comboDpi->insertItem( i18n( "Huge fonts (120 DPI)" ));
+ comboDpi->setDisabled( true );
+ connect( cbDpi, SIGNAL( toggled( bool )), comboDpi, SLOT( setEnabled( bool )));
+ connect( cbDpi, SIGNAL( toggled( bool )), SLOT( changed()));
+ connect( comboDpi, SIGNAL( activated( int )), SLOT( changed()));
+ lay->addWidget( comboDpi );
+ lay->addStretch();
+
layout->addStretch(1);
aaSettings=new FontAASettings(this);
@@ -653,6 +666,7 @@
useAA = true;
cbAA->setChecked(useAA);
aaSettings->defaults();
+ cbDpi->setChecked(false);
emit changed(true);
}
@@ -665,6 +679,13 @@
kDebug(1208) << "AA:" << useAA << endl;
cbAA->setChecked(useAA);
+ KConfig cfgfonts("kcmfonts", true);
+ cfgfonts.setGroup("General");
+ int dpi = cfgfonts.readNumEntry( "fontDPI", 0 );
+ cbDpi->setChecked( dpi == 96 || dpi == 120 );
+ comboDpi->setCurrentItem( dpi == 120 ? 1 : 0 );
+ dpi_original = dpi;
+
emit changed(false);
}
@@ -673,9 +694,18 @@
for ( FontUseItem* i = fontUseList.first(); i; i = fontUseList.next() )
i->writeFont();
-
KGlobal::config()->sync();
+ KConfig cfgfonts("kcmfonts");
+ cfgfonts.setGroup("General");
+ int dpi;
+ if( !cbDpi->isChecked())
+ dpi = 0;
+ else
+ dpi = comboDpi->currentItem() == 0 ? 96 : 120;
+ cfgfonts.writeEntry( "fontDPI", dpi );
+ cfgfonts.sync();
+
// KDE-1.x support
KSimpleConfig* config = new KSimpleConfig( QDir::homePath() + "/.kderc" );
config->setGroup( "General" );
@@ -692,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 or DPI settings will only affect newly started applications.</p>"
+ ), i18n("Font Settings Changed"), "FontSettingsChanged", false);
useAA_original = useAA;
+ dpi_original = dpi;
}
runRdb(KRdbExportXftSettings);
--- trunk/KDE/kdebase/workspace/kcontrol/fonts/fonts.h #542497:542498
@@ -111,7 +111,10 @@
private:
bool useAA, useAA_original;
+ int dpi_original;
QCheckBox *cbAA;
+ QCheckBox *cbDpi;
+ QComboBox* comboDpi;
Q3PtrList <FontUseItem> fontUseList;
FontAASettings *aaSettings;
};
--- trunk/KDE/kdebase/workspace/kcontrol/krdb/krdb.cpp #542497:542498
@@ -38,7 +38,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>
@@ -543,6 +543,18 @@
}
if(!subPixel.isEmpty())
contents += "Xft.rgba: " + subPixel + '\n';
+ KConfig cfgfonts("kcmfonts", true);
+ cfgfonts.setGroup("General");
+ if( cfgfonts.readNumEntry( "fontDPI", 0 ) != 0 )
+ contents += "Xft.dpi: " + cfgfonts.readEntry( "fontDPI" ) + '\n';
+ else
+ {
+ KProcIO proc;
+ proc << "xrdb" << "-quiet" << "-remove" << "-nocpp";
+ proc.writeStdin( QByteArray( "Xft.dpi" ), true );
+ proc.closeWhenDone();
+ proc.start( KProcess::Block );
+ }
}
if (contents.length() > 0)
--- trunk/KDE/kdebase/workspace/startkde #542497:542498
@@ -72,6 +72,7 @@
kcmrandrrc [Screen1]
kcmrandrrc [Screen2]
kcmrandrrc [Screen3]
+kcmfonts General fontDPI 0
EOF
kstartupconfig
if test $? -ne 0; then
@@ -136,6 +137,16 @@
done
fi
+if test "$kcmfonts_general_fontdpi" -eq 120; then
+ xrdb -quiet -merge -nocpp <<EOF
+Xft.dpi: 120
+EOF
+elif test "$kcmfonts_general_fontdpi" -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)
#
IMHO this is not really "RESOLVED": you can now only change between 96, 120 or "NULL". It would be far better to (additionally?) allow a custom value/number. IMHO dAniel hAhler is right. And maybe having a box for setting it inside KDE Control Center\Appearance & Themes\Fonts When using KDE inside of a VMware virtual machine with the vmware-tools installed, and you resize the VMWare application then something recalculates the DPI with the assumption that the "physical" monitor dimensions is static. In a virtual machine, this does not hold true, since there is a virtual monitor that changes size in proportion to a change in resolution and the DPI in this case should remain constant. It would be nice if KDE would offer a means of forcing a DPI no matter what resolution is currently being used. |