94 | 94 |
// qApplication must be loaded first
|
95 | 95 |
CHECK(qApp);
|
96 | 96 |
|
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 | |
|
134 | 97 |
#ifdef MOZC_SHOW_BUILD_NUMBER_ON_TITLE
|
135 | 98 |
// Install WindowTilteModifier for official dev channel
|
136 | 99 |
// append a special footer (Dev x.x.x) to the all Windows.
|