| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace gfx { | 9 namespace gfx { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 // Initializes |params| with the system's default settings. | 13 // Returns the system's default settings. |
| 14 void LoadDefaults(FontRenderParams* params) { | 14 FontRenderParams LoadDefaults() { |
| 15 params->antialiasing = true; | 15 FontRenderParams params; |
| 16 params->autohinter = true; | 16 params.antialiasing = true; |
| 17 params->use_bitmaps = true; | 17 params.autohinter = true; |
| 18 params->subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; | 18 params.use_bitmaps = true; |
| 19 params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; |
| 19 | 20 |
| 20 // Use subpixel text positioning to keep consistent character spacing when | 21 // Use subpixel text positioning to keep consistent character spacing when |
| 21 // the page is scaled by a fractional factor. | 22 // the page is scaled by a fractional factor. |
| 22 params->subpixel_positioning = true; | 23 params.subpixel_positioning = true; |
| 23 // Slight hinting renders much better than normal hinting on Android. | 24 // Slight hinting renders much better than normal hinting on Android. |
| 24 params->hinting = FontRenderParams::HINTING_SLIGHT; | 25 params.hinting = FontRenderParams::HINTING_SLIGHT; |
| 26 |
| 27 return params; |
| 25 } | 28 } |
| 26 | 29 |
| 27 } // namespace | 30 } // namespace |
| 28 | 31 |
| 29 const FontRenderParams& GetDefaultFontRenderParams() { | 32 const FontRenderParams& GetDefaultFontRenderParams() { |
| 30 static bool loaded_defaults = false; | 33 static FontRenderParams default_params = LoadDefaults(); |
| 31 static FontRenderParams default_params; | |
| 32 if (!loaded_defaults) | |
| 33 LoadDefaults(&default_params); | |
| 34 loaded_defaults = true; | |
| 35 return default_params; | 34 return default_params; |
| 36 } | 35 } |
| 37 | 36 |
| 37 const FontRenderParams& GetDefaultWebKitFontRenderParams() { |
| 38 return GetDefaultFontRenderParams(); |
| 39 } |
| 40 |
| 38 FontRenderParams GetCustomFontRenderParams( | 41 FontRenderParams GetCustomFontRenderParams( |
| 39 bool for_web_contents, | 42 bool for_web_contents, |
| 40 const std::vector<std::string>* family_list, | 43 const std::vector<std::string>* family_list, |
| 41 const int* pixel_size, | 44 const int* pixel_size, |
| 42 const int* point_size, | 45 const int* point_size, |
| 46 const int* style, |
| 43 std::string* family_out) { | 47 std::string* family_out) { |
| 44 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
| 45 return GetDefaultFontRenderParams(); | 49 return GetDefaultFontRenderParams(); |
| 46 } | 50 } |
| 47 | 51 |
| 48 const FontRenderParams& GetDefaultWebKitFontRenderParams() { | |
| 49 return GetDefaultFontRenderParams(); | |
| 50 } | |
| 51 | |
| 52 } // namespace gfx | 52 } // namespace gfx |
| OLD | NEW |