180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2012 Google Inc.
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "system_preferences.h"
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#import <Cocoa/Cocoa.h>
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruvoid setSystemPreferences() {
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // Set LCD font smoothing level for this application (does not affect other
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // applications). Based on resetDefaultsToConsistentValues() in
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum {
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        NoFontSmoothing     = 0,
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        LightFontSmoothing  = 1,
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        MediumFontSmoothing = 2,
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        StrongFontSmoothing = 3,
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    };
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    [defaults setInteger:MediumFontSmoothing forKey:@"AppleFontSmoothing"];
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    [pool release];
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
29