Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Qt text rendering issue on windows xp korean version
Forum Updated to NodeBB v4.3 + New Features

[Solved] Qt text rendering issue on windows xp korean version

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 5.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joonhwan
    wrote on last edited by
    #1

    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...

    joonhwan at gmail dot com

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        joonhwan
        wrote on last edited by
        #3

        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

        joonhwan at gmail dot com

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            joonhwan
            wrote on last edited by
            #5

            Still nobody to know about this kind of issue?

            joonhwan at gmail dot com

            1 Reply Last reply
            0
            • J Offline
              J Offline
              joonhwan
              wrote on last edited by
              #6

              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.

              joonhwan at gmail dot com

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tobias.hunger
                wrote on last edited by
                #7

                Please report this on http://bugreports.qt-project.org/ ! It will get lost here... :-(

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  joonhwan
                  wrote on last edited by
                  #8

                  did my first bug report. "here":https://bugreports.qt-project.org/browse/QTBUG-24924
                  feels good no matter it could help or not. thanks.

                  joonhwan at gmail dot com

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved