OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/font_render_params_linux.h" | 5 #include "ui/gfx/font_render_params_linux.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gfx/display.h" | |
9 #include "ui/gfx/switches.h" | 10 #include "ui/gfx/switches.h" |
10 | 11 |
11 #if defined(TOOLKIT_GTK) | 12 #if defined(TOOLKIT_GTK) |
12 #include <gtk/gtk.h> | 13 #include <gtk/gtk.h> |
13 #else | 14 #else |
14 #include <fontconfig/fontconfig.h> | 15 #include <fontconfig/fontconfig.h> |
15 #endif | 16 #endif |
16 | 17 |
17 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS) | 18 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS) |
18 #include "ui/gfx/linux_font_delegate.h" | 19 #include "ui/gfx/linux_font_delegate.h" |
19 #endif | 20 #endif |
20 | 21 |
21 namespace gfx { | 22 namespace gfx { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 bool SubpixelPositioningRequested(bool renderer) { | 26 bool SubpixelPositioningRequested(bool renderer) { |
27 if (renderer) { | |
28 return CommandLine::ForCurrentProcess()->HasSwitch( | |
Alexei Svitkine (slow)
2014/04/09 20:43:23
Nit: Extract CommandLine::ForCurrentProcess() into
Daniel Erat
2014/04/09 21:03:11
Done.
| |
29 switches::kEnableWebkitTextSubpixelPositioning) || | |
30 (Display::HasForceDeviceScaleFactor() && | |
Alexei Svitkine (slow)
2014/04/09 20:43:23
Nit: Could you add a comment explaining the motiva
Daniel Erat
2014/04/09 21:03:11
Done.
| |
31 Display::GetForcedDeviceScaleFactor() != 1.0); | |
32 } | |
26 return CommandLine::ForCurrentProcess()->HasSwitch( | 33 return CommandLine::ForCurrentProcess()->HasSwitch( |
27 renderer ? | |
28 switches::kEnableWebkitTextSubpixelPositioning : | |
29 switches::kEnableBrowserTextSubpixelPositioning); | 34 switches::kEnableBrowserTextSubpixelPositioning); |
30 } | 35 } |
31 | 36 |
32 // Initializes |params| with the system's default settings. |renderer| is true | 37 // Initializes |params| with the system's default settings. |renderer| is true |
33 // when setting WebKit renderer defaults. | 38 // when setting WebKit renderer defaults. |
34 void LoadDefaults(FontRenderParams* params, bool renderer) { | 39 void LoadDefaults(FontRenderParams* params, bool renderer) { |
35 #if defined(TOOLKIT_GTK) | 40 #if defined(TOOLKIT_GTK) |
36 params->antialiasing = true; | 41 params->antialiasing = true; |
37 // TODO(wangxianzhu): autohinter is now true to keep original behavior | 42 // TODO(wangxianzhu): autohinter is now true to keep original behavior |
38 // of WebKit, but it might not be the best value. | 43 // of WebKit, but it might not be the best value. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 LoadDefaults(&default_params, /* renderer */ true); | 159 LoadDefaults(&default_params, /* renderer */ true); |
155 loaded_defaults = true; | 160 loaded_defaults = true; |
156 return default_params; | 161 return default_params; |
157 } | 162 } |
158 | 163 |
159 bool GetDefaultWebkitSubpixelPositioning() { | 164 bool GetDefaultWebkitSubpixelPositioning() { |
160 return SubpixelPositioningRequested(true); | 165 return SubpixelPositioningRequested(true); |
161 } | 166 } |
162 | 167 |
163 } // namespace gfx | 168 } // namespace gfx |
OLD | NEW |