summaryrefslogtreecommitdiffstats
path: root/kcontrol/krdb
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-10-04 17:04:23 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-10-07 10:30:28 +0900
commite8d86645043847265b61825c9a1f20a6b93cc924 (patch)
tree36d0de030110787276cc4273758e671268104145 /kcontrol/krdb
parent6d39ea6ae8fffaa9419131d1b70f4d78f55bea44 (diff)
downloadtdebase-e8d86645043847265b61825c9a1f20a6b93cc924.tar.gz
tdebase-e8d86645043847265b61825c9a1f20a6b93cc924.zip
Added support for variable font DPI (range 64-512) in user session.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kcontrol/krdb')
-rw-r--r--kcontrol/krdb/krdb.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/kcontrol/krdb/krdb.cpp b/kcontrol/krdb/krdb.cpp
index 8c30c3286..25db21f3c 100644
--- a/kcontrol/krdb/krdb.cpp
+++ b/kcontrol/krdb/krdb.cpp
@@ -547,8 +547,21 @@ void runRdb( uint flags )
TDEConfig cfgfonts("kcmfonts", true);
cfgfonts.setGroup("General");
- if( cfgfonts.readNumEntry( "forceFontDPI", 0 ) != 0 )
- contents += "Xft.dpi: " + cfgfonts.readEntry( "forceFontDPI" ) + '\n';
+ int dpicfg = cfgfonts.readNumEntry("forceFontDPI", 0);
+ // "forceFontDPIEnable" must be read after "forceFontDPI" to make sure it is
+ // correctly initialized on the first run when upgrading to the new format,
+ // without the user even noticying it. The first time "forceFontDPIEnable"
+ // will not exist and its correct value will be deduced by the existing value
+ // of "forceFontDPI", which contains the value prior to the update.
+ bool dpiEnable = cfgfonts.readBoolEntry("forceFontDPIEnable", dpicfg > 0);
+ if (dpicfg < 64 || dpicfg > 512)
+ {
+ dpicfg = 96;
+ }
+ if (dpiEnable)
+ {
+ contents += "Xft.dpi: " + TQString::number(dpicfg) + '\n';
+ }
}
if (contents.length() > 0)