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.h" | 5 #include "ui/gfx/font_render_params.h" |
6 | 6 |
7 #include <fontconfig/fontconfig.h> | 7 #include <fontconfig/fontconfig.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/containers/mru_cache.h" | 10 #include "base/containers/mru_cache.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // less than that looks awful; do the same here. Requesting subpixel | 226 // less than that looks awful; do the same here. Requesting subpixel |
227 // rendering or positioning doesn't make sense either. | 227 // rendering or positioning doesn't make sense either. |
228 params.hinting = FontRenderParams::HINTING_FULL; | 228 params.hinting = FontRenderParams::HINTING_FULL; |
229 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; | 229 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; |
230 params.subpixel_positioning = false; | 230 params.subpixel_positioning = false; |
231 } else { | 231 } else { |
232 // Fontconfig doesn't support configuring subpixel positioning; check a | 232 // Fontconfig doesn't support configuring subpixel positioning; check a |
233 // flag. | 233 // flag. |
234 params.subpixel_positioning = | 234 params.subpixel_positioning = |
235 actual_query.for_web_contents | 235 actual_query.for_web_contents |
236 ? CommandLine::ForCurrentProcess()->HasSwitch( | 236 ? base::CommandLine::ForCurrentProcess()->HasSwitch( |
237 switches::kEnableWebkitTextSubpixelPositioning) | 237 switches::kEnableWebkitTextSubpixelPositioning) |
238 : IsBrowserTextSubpixelPositioningEnabled(actual_query); | 238 : IsBrowserTextSubpixelPositioningEnabled(actual_query); |
239 | 239 |
240 // To enable subpixel positioning, we need to disable hinting. | 240 // To enable subpixel positioning, we need to disable hinting. |
241 if (params.subpixel_positioning) | 241 if (params.subpixel_positioning) |
242 params.hinting = FontRenderParams::HINTING_NONE; | 242 params.hinting = FontRenderParams::HINTING_NONE; |
243 } | 243 } |
244 | 244 |
245 // Use the first family from the list if Fontconfig didn't suggest a family. | 245 // Use the first family from the list if Fontconfig didn't suggest a family. |
246 if (family_out && family_out->empty() && !actual_query.families.empty()) | 246 if (family_out && family_out->empty() && !actual_query.families.empty()) |
(...skipping 20 matching lines...) Expand all Loading... |
267 float GetFontRenderParamsDeviceScaleFactor() { | 267 float GetFontRenderParamsDeviceScaleFactor() { |
268 return device_scale_factor_for_internal_display; | 268 return device_scale_factor_for_internal_display; |
269 } | 269 } |
270 | 270 |
271 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 271 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
272 device_scale_factor_for_internal_display = device_scale_factor; | 272 device_scale_factor_for_internal_display = device_scale_factor; |
273 } | 273 } |
274 #endif | 274 #endif |
275 | 275 |
276 } // namespace gfx | 276 } // namespace gfx |
OLD | NEW |