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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 QueryFontconfig(actual_query, ¶ms, family_out); | 242 QueryFontconfig(actual_query, ¶ms, family_out); |
243 if (!params.antialiasing) { | 243 if (!params.antialiasing) { |
244 // Cairo forces full hinting when antialiasing is disabled, since anything | 244 // Cairo forces full hinting when antialiasing is disabled, since anything |
245 // less than that looks awful; do the same here. Requesting subpixel | 245 // less than that looks awful; do the same here. Requesting subpixel |
246 // rendering or positioning doesn't make sense either. | 246 // rendering or positioning doesn't make sense either. |
247 params.hinting = FontRenderParams::HINTING_FULL; | 247 params.hinting = FontRenderParams::HINTING_FULL; |
248 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; | 248 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; |
249 params.subpixel_positioning = false; | 249 params.subpixel_positioning = false; |
250 } else { | 250 } else { |
251 // Fontconfig doesn't support configuring subpixel positioning; check a | 251 // Fontconfig doesn't support configuring subpixel positioning; check a |
252 // flag. | 252 // flag. |
Daniel Erat
2015/03/20 23:51:50
please delete this now-obsolete comment.
stapelberg
2015/03/31 18:11:57
Done.
| |
253 params.subpixel_positioning = | 253 params.subpixel_positioning = actual_query.device_scale_factor > 1.0f; |
254 actual_query.for_web_contents | |
255 ? base::CommandLine::ForCurrentProcess()->HasSwitch( | |
256 switches::kEnableWebkitTextSubpixelPositioning) | |
Daniel Erat
2015/03/20 23:51:50
this looks like it was the only place where this f
stapelberg
2015/03/31 18:11:57
Done.
| |
257 : actual_query.device_scale_factor > 1.0f; | |
258 | 254 |
259 // To enable subpixel positioning, we need to disable hinting. | 255 // To enable subpixel positioning, we need to disable hinting. |
260 if (params.subpixel_positioning) | 256 if (params.subpixel_positioning) |
261 params.hinting = FontRenderParams::HINTING_NONE; | 257 params.hinting = FontRenderParams::HINTING_NONE; |
262 } | 258 } |
263 | 259 |
264 // Use the first family from the list if Fontconfig didn't suggest a family. | 260 // Use the first family from the list if Fontconfig didn't suggest a family. |
265 if (family_out && family_out->empty() && !actual_query.families.empty()) | 261 if (family_out && family_out->empty() && !actual_query.families.empty()) |
266 *family_out = actual_query.families[0]; | 262 *family_out = actual_query.families[0]; |
267 | 263 |
(...skipping 18 matching lines...) Expand all Loading... | |
286 float GetFontRenderParamsDeviceScaleFactor() { | 282 float GetFontRenderParamsDeviceScaleFactor() { |
287 return device_scale_factor_for_internal_display; | 283 return device_scale_factor_for_internal_display; |
288 } | 284 } |
289 | 285 |
290 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 286 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
291 device_scale_factor_for_internal_display = device_scale_factor; | 287 device_scale_factor_for_internal_display = device_scale_factor; |
292 } | 288 } |
293 #endif | 289 #endif |
294 | 290 |
295 } // namespace gfx | 291 } // namespace gfx |
OLD | NEW |