Fixed QT font DPI to avoid double scaling

This commit is contained in:
liuxinhao 2022-08-15 15:11:13 +08:00
parent 3397eb35d9
commit e50e820d43
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 45d7ab7118b99033aca71700c2f5dbded695c53d Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Mon, 15 Aug 2022 14:58:13 +0800
Subject: [PATCH] fix(hidpi): Fixed QT font DPI to avoid double scaling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 设置缩放两倍时通过QT_FONT_DPI固定QT字体DPI避免QT_SCALE_FACTOR和Xft.dpi对字体进行两次缩放过大的问题
Closes #I5LQSK #I5LQQQ
---
plugins/xsettings/xsettings-manager.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/plugins/xsettings/xsettings-manager.cpp b/plugins/xsettings/xsettings-manager.cpp
index 9612a85..7532668 100644
--- a/plugins/xsettings/xsettings-manager.cpp
+++ b/plugins/xsettings/xsettings-manager.cpp
@@ -346,10 +346,19 @@ void XSettingsManager::scale_change_workarounds(int32_t scale)
KLOG_WARNING("There was a problem when setting QT_AUTO_SCREEN_SCALE_FACTOR=0: %s", error.c_str());
}
+
+ /* FIXME: 由于QT_SCALE_FACTOR将会放大窗口以及pt大小字体而缩放将会更改Xft.dpi属性该属性也会导致qt pt字体大小放大字体将会放大过多。
+ 目前暂时解决方案缩放两倍时固定Qt字体DPI 96由QT_SCALE_FACTOR环境变量对窗口以及字体进行放大.
+ 后续应弃用QT_SCALE_FACTOR方案
+ */
if (!XSettingsUtils::update_user_env_variable("QT_SCALE_FACTOR", scale == 2 ? "2" : "1", error))
{
KLOG_WARNING("There was a problem when setting QT_SCALE_FACTOR=%d: %s", scale, error.c_str());
}
+ else if ( scale==2 && !XSettingsUtils::update_user_env_variable("QT_FONT_DPI","96",error) )
+ {
+ KLOG_WARNING("There was a problem when setting QT_FONT_DPI=96: %s", error.c_str());
+ }
}
}
else
--
2.33.0

View File

@ -1,12 +1,13 @@
Name: kiran-cc-daemon
Version: 2.3.1
Release: 2
Release: 3
Summary: DBus daemon for Kiran Desktop
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-coredump-Fix-coredump-problem-caused-by-nullpoin.patch
Patch0002: 0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch
BuildRequires: cmake >= 3.2
@ -146,6 +147,9 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
%changelog
* Mon Aug 15 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.3.1-3
- KYOS-F: Fixed QT font DPI to avoid double scaling(#I5LQSK,#I5LQQQ)
* Tue Aug 09 2022 tangjie02 <tangjie02@kylinsec.com.cn> - 2.3.1-2
- KYOS-B: Fix coredump problem caused by nullpointer to SPwd.