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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // less than that looks awful; do the same here. Requesting subpixel | 210 // less than that looks awful; do the same here. Requesting subpixel |
211 // rendering or positioning doesn't make sense either. | 211 // rendering or positioning doesn't make sense either. |
212 params.hinting = FontRenderParams::HINTING_FULL; | 212 params.hinting = FontRenderParams::HINTING_FULL; |
213 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; | 213 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; |
214 params.subpixel_positioning = false; | 214 params.subpixel_positioning = false; |
215 } else { | 215 } else { |
216 // Fontconfig doesn't support configuring subpixel positioning; check a | 216 // Fontconfig doesn't support configuring subpixel positioning; check a |
217 // flag. | 217 // flag. |
218 params.subpixel_positioning = | 218 params.subpixel_positioning = |
219 query.for_web_contents ? | 219 query.for_web_contents ? |
220 CommandLine::ForCurrentProcess()->HasSwitch( | 220 base::CommandLine::ForCurrentProcess()->HasSwitch( |
221 switches::kEnableWebkitTextSubpixelPositioning) : | 221 switches::kEnableWebkitTextSubpixelPositioning) : |
222 IsBrowserTextSubpixelPositioningEnabled(); | 222 IsBrowserTextSubpixelPositioningEnabled(); |
223 | 223 |
224 // To enable subpixel positioning, we need to disable hinting. | 224 // To enable subpixel positioning, we need to disable hinting. |
225 if (params.subpixel_positioning) | 225 if (params.subpixel_positioning) |
226 params.hinting = FontRenderParams::HINTING_NONE; | 226 params.hinting = FontRenderParams::HINTING_NONE; |
227 } | 227 } |
228 | 228 |
229 // Use the first family from the list if Fontconfig didn't suggest a family. | 229 // Use the first family from the list if Fontconfig didn't suggest a family. |
230 if (family_out && family_out->empty() && !query.families.empty()) | 230 if (family_out && family_out->empty() && !query.families.empty()) |
(...skipping 16 matching lines...) Expand all Loading... |
247 synchronized_cache->cache.Clear(); | 247 synchronized_cache->cache.Clear(); |
248 } | 248 } |
249 | 249 |
250 #if defined(OS_CHROMEOS) | 250 #if defined(OS_CHROMEOS) |
251 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 251 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
252 device_scale_factor_for_internal_display = device_scale_factor; | 252 device_scale_factor_for_internal_display = device_scale_factor; |
253 } | 253 } |
254 #endif | 254 #endif |
255 | 255 |
256 } // namespace gfx | 256 } // namespace gfx |
OLD | NEW |