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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 params = delegate->GetDefaultFontRenderParams(); | 241 params = delegate->GetDefaultFontRenderParams(); |
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 params.subpixel_positioning = actual_query.device_scale_factor > 1.0f; |
252 // flag. | |
253 params.subpixel_positioning = | |
254 actual_query.for_web_contents | |
sadrul
2015/03/31 18:20:06
Looks like this was the only use of |FondRenderPar
stapelberg
2015/03/31 18:29:29
Yes, I think so. I’ll do that in a separate CL tho
| |
255 ? base::CommandLine::ForCurrentProcess()->HasSwitch( | |
256 switches::kEnableWebkitTextSubpixelPositioning) | |
257 : actual_query.device_scale_factor > 1.0f; | |
258 | 252 |
259 // To enable subpixel positioning, we need to disable hinting. | 253 // To enable subpixel positioning, we need to disable hinting. |
260 if (params.subpixel_positioning) | 254 if (params.subpixel_positioning) |
261 params.hinting = FontRenderParams::HINTING_NONE; | 255 params.hinting = FontRenderParams::HINTING_NONE; |
262 } | 256 } |
263 | 257 |
264 // Use the first family from the list if Fontconfig didn't suggest a family. | 258 // 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()) | 259 if (family_out && family_out->empty() && !actual_query.families.empty()) |
266 *family_out = actual_query.families[0]; | 260 *family_out = actual_query.families[0]; |
267 | 261 |
(...skipping 18 matching lines...) Expand all Loading... | |
286 float GetFontRenderParamsDeviceScaleFactor() { | 280 float GetFontRenderParamsDeviceScaleFactor() { |
287 return device_scale_factor_for_internal_display; | 281 return device_scale_factor_for_internal_display; |
288 } | 282 } |
289 | 283 |
290 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 284 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
291 device_scale_factor_for_internal_display = device_scale_factor; | 285 device_scale_factor_for_internal_display = device_scale_factor; |
292 } | 286 } |
293 #endif | 287 #endif |
294 | 288 |
295 } // namespace gfx | 289 } // namespace gfx |
OLD | NEW |