1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
10 static BOOL font_smoothing_enabled
= FALSE
;
12 static void SaveInitialSettings() {
13 ::SystemParametersInfo(SPI_GETFONTSMOOTHING
, 0, &font_smoothing_enabled
, 0);
16 // Technically, all we need to do is disable ClearType. However,
17 // for some reason, the call to SPI_SETFONTSMOOTHINGTYPE doesn't
18 // seem to work, so we just disable font smoothing all together
19 // (which works reliably).
20 static void InstallLayoutTestSettings() {
21 ::SystemParametersInfo(SPI_SETFONTSMOOTHING
, FALSE
, 0, 0);
24 static void RestoreInitialSettings() {
25 ::SystemParametersInfo(
26 SPI_SETFONTSMOOTHING
, static_cast<UINT
>(font_smoothing_enabled
), 0, 0);
29 static void SimpleSignalHandler(int signalNumber
) {
30 // Try to restore the settings and then go down cleanly.
31 RestoreInitialSettings();
32 exit(128 + signalNumber
);
35 int main(int, char**) {
36 // Hooks the ways we might get told to clean up...
37 signal(SIGINT
, SimpleSignalHandler
);
38 signal(SIGTERM
, SimpleSignalHandler
);
40 SaveInitialSettings();
42 InstallLayoutTestSettings();
44 // Let the script know we're ready.
48 // Wait for any key (or signal).
51 RestoreInitialSettings();