Codebase list mozc / 2712a07
Use the default font on Windows We have specified Meiryo to GUI tools in Vista and later for better look and feel. However, at least on Windows 10, it doesn't look good actually, and probably it'd be better to remove such a customization in favor of simplicity. BUG= TEST= REF_BUG= REF_CL=140821194 REF_TIME=2016-12-02T16:58:04+09:00 REF_TIME_RAW=1480665484 +0900 Hiroyuki Komatsu 7 years ago
2 changed file(s) with 1 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
2929
3030 MAJOR=2
3131 MINOR=19
32 BUILD=2666
32 BUILD=2667
3333 REVISION=102
3434 # This version represents the version of Mozc IME engine (converter, predictor,
3535 # etc.). This version info is included both in the Mozc server and in the Mozc
9494 // qApplication must be loaded first
9595 CHECK(qApp);
9696
97 #ifdef OS_WIN
98 // Get the font from MessageFont
99 NONCLIENTMETRICSW ncm = { 0 };
100
101 // We don't use |sizeof(NONCLIENTMETRICSW)| because it is fragile when the
102 // code is copied-and-pasted without caring about WINVER.
103 // http://blogs.msdn.com/b/oldnewthing/archive/2003/12/12/56061.aspx
104 const size_t kSizeOfNonClientMetricsWForVistaOrLater =
105 CCSIZEOF_STRUCT(NONCLIENTMETRICSW, iPaddedBorderWidth);
106 ncm.cbSize = kSizeOfNonClientMetricsWForVistaOrLater;
107 if (::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0)) {
108 // Windows font scale is 0..100 while Qt's scale is 0..99.
109 // If lfWeight is 0 (default weight), we don't set the Qt's font weight.
110 if (ncm.lfMessageFont.lfWeight > 0) {
111 font_.setWeight(static_cast<int>(
112 99.0 * ncm.lfMessageFont.lfWeight / 1000.0));
113 }
114 font_.setItalic(static_cast<bool>(ncm.lfMessageFont.lfItalic));
115 font_.setUnderline(static_cast<bool>(ncm.lfMessageFont.lfUnderline));
116 font_.setStrikeOut(static_cast<bool>(ncm.lfMessageFont.lfStrikeOut));
117 string face_name;
118 Util::WideToUTF8(ncm.lfMessageFont.lfFaceName, &face_name);
119 font_.setFamily(QString::fromUtf8(face_name.c_str()));
120 HDC hdc = ::GetDC(NULL);
121 if (hdc != NULL) {
122 // Get point size from height:
123 // http://msdn.microsoft.com/ja-jp/library/cc428368.aspx
124 const int KPointToHeightFactor= 72;
125 font_.setPointSize(abs(::MulDiv(ncm.lfMessageFont.lfHeight,
126 KPointToHeightFactor,
127 ::GetDeviceCaps(hdc, LOGPIXELSY))));
128 ::ReleaseDC(NULL, hdc);
129 }
130 qApp->setFont(font_);
131 }
132 #endif
133
13497 #ifdef MOZC_SHOW_BUILD_NUMBER_ON_TITLE
13598 // Install WindowTilteModifier for official dev channel
13699 // append a special footer (Dev x.x.x) to the all Windows.