[Solved] Qt text rendering issue on windows xp korean version
-
wrote on 24 Feb 2012, 08:11 last edited by
This is a quite old issue to me. please take a look following pictures
!http://db.tt/lMNLgnt5(default style in windows xp korean)!
You can notice that the font used in menu bar and list widget looks different than others. (in korean windows xp, QApplication::font() returns "Gulim(굴림)" font by default).
now i changed style sheet like following
@
QWidget { font-family: "Tahoma" }
@and the window looks different now
!http://db.tt/9uEMYVDe(after change font style as 'tahoma')!
You see? now all pre-wierdly looked font is now rendered correctly.
For this kind of issue, in Korean Windows XP the glorious QtCreator that I've been wrestling with nowadays looks like...
!http://db.tt/aoyDiHoH(ugly qtcreator)!
and
!http://db.tt/4ZRq3ZG9(another ugly look)!
please compare it with any normal other windows application in my desktop
!http://db.tt/d8nauTba(irfanview)!
I tried to use "-stylesheet" option when running QtCreator, but he never accepted this option. Any ideas?
--EDITED--
P.S Image itself looks as if it is rescaled in this post. In my real life it looks more ugly than it looks here...
-
wrote on 24 Feb 2012, 09:50 last edited by
You could try changing the font used by Qt apps using the qtconfig application (part of Qt itself). That should effect all Qt programs run by your user.
-
wrote on 24 Feb 2012, 10:49 last edited by
Thanks, now I'm back to my place where no windows box exists unfortunately. I'll try to do that next week. BTW, does qtconfig application exists in win32 platform? I thought it is only for X-window thing in unixy world
-
wrote on 24 Feb 2012, 10:55 last edited by
Hmmm... I just checked, you are right, it does not seem to get build on windows. Sorry, I am not using windows regularly:-( I just assumed it would be there as well.
-
wrote on 28 Feb 2012, 10:26 last edited by
Still nobody to know about this kind of issue?
-
wrote on 22 Mar 2012, 07:00 last edited by
I found that Qt (as of 4.8) doesn't consider the cleartype setting in windows xp.
It could get current font smoothing type configuration from registry(HKCU\Control Panel\Desktop\FontSmoothingType) and then set every font's style strategy in qt_set_windows_font_resources() which is located in qapplication_win.cpp@
static void qt_set_windows_font_resources()
{
#ifndef Q_WS_WINCE
NONCLIENTMETRICS ncm;
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0);QFont menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont, true); QFont messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont, true); QFont statusFont = qt_LOGFONTtoQFont(ncm.lfStatusFont, true); QFont titleFont = qt_LOGFONTtoQFont(ncm.lfCaptionFont, true); LOGFONT lfIconTitleFont; SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0); QFont iconTitleFont = qt_LOGFONTtoQFont(lfIconTitleFont, true); QApplication::setFont(menuFont, "QMenu"); QApplication::setFont(menuFont, "QMenuBar"); QApplication::setFont(messageFont, "QMessageBox"); QApplication::setFont(statusFont, "QTipLabel"); QApplication::setFont(statusFont, "QStatusBar"); QApplication::setFont(titleFont, "Q3TitleBar"); QApplication::setFont(titleFont, "QWorkspaceTitleBar"); QApplication::setFont(iconTitleFont, "QAbstractItemView"); QApplication::setFont(iconTitleFont, "QDockWidgetTitle");
@
As it coule be realized, every function call to qt_LOGFONTtoQFont() could return a QFont object whose styleStrategy property correctly considering mentioned registry settings. For example,
@
// ### maybe move to qapplication_win
QFont qt_LOGFONTtoQFont(LOGFONT& lf, bool /scale/)
{
QString family = QString::fromWCharArray(lf.lfFaceName);
QFont qf(family);
qf.setItalic(lf.lfItalic);
if (lf.lfWeight != FW_DONTCARE)
qf.setWeight(weightFromInteger(lf.lfWeight));
int lfh = qAbs(lf.lfHeight);
qf.setPointSizeF(lfh * 72.0 / GetDeviceCaps(shared_dc(),LOGPIXELSY));
qf.setUnderline(false);
qf.setOverline(false);
qf.setStrikeOut(false);// ----- begin of mod QSettings s("HKEY_CURRENT_USER\Control Panel\Desktop", QSettings::NativeFormat); const int clearTypeEnum = 2; if ( clearTypeEnum==s.value("FontSmoothingType",1) ) { qf.setStyleStrategy(QFont::PreferAntialias); } // ---- end of mod return qf;
}
@Now, I'm feeling like to report this, kinda officially, but don't know how to.
I wish QtCreator itself could display its ui component more natuarally as well as other Qt application in my case.
-
wrote on 22 Mar 2012, 07:48 last edited by
Please report this on http://bugreports.qt-project.org/ ! It will get lost here... :-(
-
wrote on 22 Mar 2012, 12:32 last edited by
did my first bug report. "here":https://bugreports.qt-project.org/browse/QTBUG-24924
feels good no matter it could help or not. thanks.