From a1a836e148f3d58ce1e330b3d2b2dca5b151d44a Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 4 Oct 2021 17:04:23 +0900 Subject: Added support for variable font DPI (range 64-512) in user session. Signed-off-by: Michele Calgaro (cherry picked from commit e8d86645043847265b61825c9a1f20a6b93cc924) --- kcontrol/krdb/krdb.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'kcontrol/krdb') diff --git a/kcontrol/krdb/krdb.cpp b/kcontrol/krdb/krdb.cpp index d01bd998e..0943a6ccc 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) -- cgit v1.2.1